19 #include <sys/types.h> 34 static void map_file(
void)
45 png.handle = CreateFileMapping((HANDLE) _get_osfhandle(fd),
50 ptr = MapViewOfFile(
png.handle, FILE_MAP_WRITE, 0, 0, size);
54 ptr = mmap(
NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t) 0);
55 if (ptr == MAP_FAILED)
84 unsigned int red, grn, blu;
91 p =
getenv(
"GRASS_RENDER_FILE");
92 if (!p || strlen(p) == 0)
94 G_debug(1,
"png: GRASS_RENDER_FILE: %s", p);
98 p =
getenv(
"GRASS_RENDER_TRUECOLOR");
104 p =
getenv(
"GRASS_RENDER_FILE_MAPPED");
105 do_map = p && strcmp(p,
"TRUE") == 0;
114 p =
getenv(
"GRASS_RENDER_FILE_READ");
115 do_read = p && strcmp(p,
"TRUE") == 0;
128 p =
getenv(
"GRASS_RENDER_TRANSPARENT");
133 p =
getenv(
"GRASS_RENDER_BACKGROUNDCOLOR");
135 (sscanf(p,
"%02x%02x%02x", &red, &grn, &blu) == 3 ||
153 if (do_read && do_map)
GRASS png display driver - header file.
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.
const char * PNG_Graph_get_file(void)
Get render file.
unsigned int png_get_color(int r, int g, int b, int a)
void PNG_Erase(void)
Erase screen.
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
int PNG_Graph_set(void)
Start up graphics processing.
void void G_verbose_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
void png_init_color_table(void)