31 fprintf(
output,
"P6\n%d %d\n255\n",
png.width,
png.height);
33 for (y = 0, p =
png.grid; y <
png.height; y++) {
34 for (
x = 0;
x <
png.width;
x++, p++) {
40 fputc((
unsigned char)
r,
output);
41 fputc((
unsigned char)
g,
output);
42 fputc((
unsigned char)
b,
output);
56 mask_name[strlen(mask_name) - 2] =
'g';
58 output = fopen(mask_name,
"wb");
64 fprintf(
output,
"P5\n%d %d\n255\n",
png.width,
png.height);
66 for (y = 0, p =
png.grid; y <
png.height; y++) {
67 for (
x = 0;
x <
png.width;
x++, p++) {
73 fputc((
unsigned char)(255 - a),
output);
void G_free(void *buf)
Free allocated memory.
void png_get_pixel(unsigned int pixel, 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.
void output(const char *fmt,...)
char * G_store(const char *s)
Copy string to allocated memory.