GRASS 8 Programmer's Manual 8.6.0dev(2026)-8843f13794
Loading...
Searching...
No Matches
pngdriver/write.c
Go to the documentation of this file.
1/*!
2 \file lib/pngdriver/write.c
3
4 \brief GRASS png display driver - write image (lower level functions)
5
6 SPDX-FileCopyrightText: 2007-2014 Glynn Clements
7 SPDX-FileCopyrightText: GRASS Development Team
8 SPDX-License-Identifier: GPL-2.0-or-later
9
10 \author Glynn Clements
11 */
12
13#include <stdio.h>
14#include <stdlib.h>
15#include <string.h>
16
17#include <grass/config.h>
18#include <grass/gis.h>
19#include "pngdriver.h"
20
21void write_image(void)
22{
23 char *p = png.file_name + strlen(png.file_name) - 4;
24
25 if (!png.modified)
26 return;
27
28 if (png.mapped)
29 return;
30
31 if (G_strcasecmp(p, ".ppm") == 0) {
32 write_ppm();
33 if (png.has_alpha)
34 write_pgm();
35 }
36 else if (G_strcasecmp(p, ".bmp") == 0)
37 write_bmp();
38#ifdef HAVE_PNG_H
39 else if (G_strcasecmp(p, ".png") == 0)
40 write_png();
41#endif
42 else
43 G_fatal_error("write_image: unknown file type: %s", p);
44
45 png.modified = 0;
46}
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
Definition strings.c:45
struct png_state png
void write_image(void)
GRASS png display driver - header file.
void write_pgm(void)
void write_ppm(void)
void write_bmp(void)
void write_png(void)
Definition write_png.c:54