19 #include <sys/types.h>
34 static void map_file(
void)
45 png.handle = CreateFileMapping((HANDLE)_get_osfhandle(fd),
NULL,
46 PAGE_READWRITE, 0, size,
NULL);
49 ptr = MapViewOfFile(
png.handle, FILE_MAP_WRITE, 0, 0, size);
53 ptr = mmap(
NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)0);
54 if (ptr == MAP_FAILED)
83 unsigned int red, grn, blu;
90 p = getenv(
"GRASS_RENDER_FILE");
91 if (!p || strlen(p) == 0)
93 G_debug(1,
"png: GRASS_RENDER_FILE: %s", p);
97 p = getenv(
"GRASS_RENDER_TRUECOLOR");
103 p = getenv(
"GRASS_RENDER_FILE_MAPPED");
104 do_map = p && strcmp(p,
"TRUE") == 0;
113 p = getenv(
"GRASS_RENDER_FILE_READ");
114 do_read = p && strcmp(p,
"TRUE") == 0;
127 p = getenv(
"GRASS_RENDER_TRANSPARENT");
132 p = getenv(
"GRASS_RENDER_BACKGROUNDCOLOR");
134 (sscanf(p,
"%02x%02x%02x", &red, &grn, &blu) == 3 ||
152 if (do_read && do_map)
unsigned int png_get_color(int r, int g, int b, int a)
void png_init_color_table(void)
int G_str_to_color(const char *, int *, int *, int *)
Parse color string and set red,green,blue.
void G_free(void *)
Free allocated memory.
void void G_verbose_message(const char *,...) __attribute__((format(printf
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
int G_debug(int, const char *,...) __attribute__((format(printf
void PNG_Erase(void)
Erase screen.
const char * PNG_Graph_get_file(void)
Get render file.
int PNG_Graph_set(void)
Start up graphics processing.
GRASS png display driver - header file.