GRASS Programmer's Manual
6.4.2(2012)
|
00001 00002 #include <stdio.h> 00003 #include <stdlib.h> 00004 #include <string.h> 00005 00006 #include <grass/config.h> 00007 #include <grass/gis.h> 00008 #include "pngdriver.h" 00009 00010 void write_image(void) 00011 { 00012 char *p = file_name + strlen(file_name) - 4; 00013 00014 if (!modified) 00015 return; 00016 00017 if (mapped) 00018 return; 00019 00020 if (G_strcasecmp(p, ".ppm") == 0) { 00021 write_ppm(); 00022 if (has_alpha) 00023 write_pgm(); 00024 } 00025 else if (G_strcasecmp(p, ".bmp") == 0) 00026 write_bmp(); 00027 #ifdef HAVE_PNG_H 00028 else if (G_strcasecmp(p, ".png") == 0) 00029 write_png(); 00030 #endif 00031 else 00032 G_fatal_error("write_image: unknown file type: %s", p); 00033 00034 modified = 0; 00035 }