13 int i_width, i_height, maxval;
14 unsigned int rgb_mask =
get_color(255, 255, 255, 0);
24 if (fscanf(input,
"P6 %d %d %d", &i_width, &i_height, &maxval) != 3)
31 (
"PNG: input file has incorrect dimensions: expected: %dx%d got: %dx%d",
35 for (x = 0; x <
width; x++, p++) {
61 int i_width, i_height, maxval;
62 unsigned int rgb_mask =
get_color(255, 255, 255, 0);
68 mask_name[strlen(mask_name) - 2] =
'g';
70 input = fopen(mask_name,
"rb");
72 G_fatal_error(
"PNG: couldn't open input mask file %s", mask_name);
74 if (fscanf(input,
"P5 %d %d %d", &i_width, &i_height, &maxval) != 3)
81 (
"PNG: input mask file has incorrect dimensions: expected: %dx%d got: %dx%d",
87 for (x = 0; x <
width; x++, p++) {
void G_free(void *buf)
Free allocated memory.
char * G_store(const char *s)
Copy string to allocated memory.
unsigned int get_color(int r, int g, int b, int a)
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.