Loading...
Searching...
No Matches
pngdriver/write.c
Go to the documentation of this file.
/*!
\file lib/pngdriver/write.c
\brief GRASS png display driver - write image (lower level functions)
(C) 2007-2014 by Glynn Clements and the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
\author Glynn Clements
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <grass/config.h>
#include <grass/gis.h>
#include "pngdriver.h"
void write_image(void)
{
char *p = png.file_name + strlen(png.file_name) - 4;
if (!png.modified)
return;
if (png.mapped)
return;
if (G_strcasecmp(p, ".ppm") == 0) {
write_ppm();
if (png.has_alpha)
write_pgm();
}
else if (G_strcasecmp(p, ".bmp") == 0)
write_bmp();
#ifdef HAVE_PNG_H
else if (G_strcasecmp(p, ".png") == 0)
write_png();
#endif
else
G_fatal_error("write_image: unknown file type: %s", p);
png.modified = 0;
}
G_fatal_error
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
Definition gis/error.c:159
png
struct png_state png
Definition pngdriver/graph_set.c:32
write_image
void write_image(void)
Definition pngdriver/write.c:22
pngdriver.h
GRASS png display driver - header file.
write_pgm
void write_pgm(void)
Definition pngdriver/write_ppm.c:49
write_ppm
void write_ppm(void)
Definition pngdriver/write_ppm.c:21
write_bmp
void write_bmp(void)
Definition pngdriver/write_bmp.c:63
G_strcasecmp
int G_strcasecmp(const char *x, const char *y)
String compare ignoring case (upper or lower).
Definition strings.c:47
write_png
void write_png(void)
Definition write_png.c:55