26 int i_width, i_height, maxval;
37 if (fscanf(input,
"P6 %d %d %d", &i_width, &i_height, &maxval) != 3)
40 if (fgetc(input) == EOF)
44 G_fatal_error(
"PNG: input file has incorrect dimensions: expected: "
75 int i_width, i_height, maxval;
82 mask_name[strlen(mask_name) - 2] =
'g';
84 input = fopen(mask_name,
"rb");
86 G_fatal_error(
"PNG: couldn't open input mask file %s", mask_name);
88 if (fscanf(input,
"P5 %d %d %d", &i_width, &i_height, &maxval) != 3)
91 if (fgetc(input) == EOF)
95 G_fatal_error(
"PNG: input mask file has incorrect dimensions: "
96 "expected: %dx%d got: %dx%d",
105 int k = fgetc(input);
107 k = k * 255 / maxval;
unsigned int png_get_color(int r, int g, int b, int a)
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.
GRASS png display driver - header file.