GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-a16a02f7eb
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
(C) 2007-2014 by Glynn Clements and the GRASS Development Team
7
8
This program is free software under the GNU General Public License
9
(>=v2). Read the file COPYING that comes with GRASS for details.
10
11
\author Glynn Clements
12
*/
13
14
#include <stdio.h>
15
#include <stdlib.h>
16
#include <string.h>
17
18
#include <
grass/config.h
>
19
#include <
grass/gis.h
>
20
#include "
pngdriver.h
"
21
22
void
write_image
(
void
)
23
{
24
char
*p =
png
.
file_name
+ strlen(
png
.
file_name
) - 4;
25
26
if
(!
png
.
modified
)
27
return
;
28
29
if
(
png
.
mapped
)
30
return
;
31
32
if
(
G_strcasecmp
(p,
".ppm"
) == 0) {
33
write_ppm
();
34
if
(
png
.
has_alpha
)
35
write_pgm
();
36
}
37
else
if
(
G_strcasecmp
(p,
".bmp"
) == 0)
38
write_bmp
();
39
#ifdef HAVE_PNG_H
40
else
if
(
G_strcasecmp
(p,
".png"
) == 0)
41
write_png
();
42
#endif
43
else
44
G_fatal_error
(
"write_image: unknown file type: %s"
, p);
45
46
png
.
modified
= 0;
47
}
config.h
G_fatal_error
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
G_strcasecmp
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
Definition:
strings.c:47
gis.h
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
write_png
void write_png(void)
Definition:
write_png.c:55
png_state::file_name
char * file_name
Definition:
pngdriver.h:32
png_state::mapped
int mapped
Definition:
pngdriver.h:36
png_state::has_alpha
int has_alpha
Definition:
pngdriver.h:35
png_state::modified
int modified
Definition:
pngdriver.h:46
lib
pngdriver
write.c
Generated on Sat Oct 5 2024 06:57:20 for GRASS GIS 8 Programmer's Manual by
1.9.1