25 int i_width, i_height, maxval;
36 if (fscanf(input,
"P6 %d %d %d", &i_width, &i_height, &maxval) != 3)
42 G_fatal_error(
"PNG: input file has incorrect dimensions: expected: "
73 int i_width, i_height, maxval;
80 mask_name[strlen(mask_name) - 2] =
'g';
82 input = fopen(mask_name,
"rb");
84 G_fatal_error(
"PNG: couldn't open input mask file %s", mask_name);
86 if (fscanf(input,
"P5 %d %d %d", &i_width, &i_height, &maxval) != 3)
92 G_fatal_error(
"PNG: input mask file has incorrect dimensions: "
93 "expected: %dx%d got: %dx%d",
102 int k = fgetc(input);
104 k = k * 255 / maxval;
void G_free(void *buf)
Free allocated memory.
unsigned int png_get_color(int r, int g, int b, int a)
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
GRASS png display driver - header file.
char * G_store(const char *s)
Copy string to allocated memory.