GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
pngdriver/read.c
Go to the documentation of this file.
1
/*!
2
\file lib/pngdriver/read.c
3
4
\brief GRASS png display driver - read 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
read_image
(
void
)
23
{
24
char
*p =
png
.
file_name
+ strlen(
png
.
file_name
) - 4;
25
26
if
(
G_strcasecmp
(p,
".ppm"
) == 0) {
27
read_ppm
();
28
if
(
png
.
has_alpha
)
29
read_pgm
();
30
}
31
else
if
(
G_strcasecmp
(p,
".bmp"
) == 0)
32
read_bmp
();
33
#ifdef HAVE_PNG_H
34
else
if
(
G_strcasecmp
(p,
".png"
) == 0)
35
read_png
();
36
#endif
37
else
38
G_fatal_error
(
"read_image: unknown file type: %s"
, p);
39
40
png
.
modified
= 0;
41
}
G_fatal_error
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
pngdriver.h
GRASS png display driver - header file.
config.h
read_bmp
void read_bmp(void)
Definition:
pngdriver/read_bmp.c:79
png
struct png_state png
Definition:
pngdriver/graph_set.c:32
gis.h
png_state::modified
int modified
Definition:
pngdriver.h:47
G_strcasecmp
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
Definition:
strings.c:47
png_state::file_name
char * file_name
Definition:
pngdriver.h:33
png_state::has_alpha
int has_alpha
Definition:
pngdriver.h:36
read_png
void read_png(void)
Definition:
read_png.c:45
read_ppm
void read_ppm(void)
Definition:
pngdriver/read_ppm.c:22
read_image
void read_image(void)
Definition:
pngdriver/read.c:22
read_pgm
void read_pgm(void)
Definition:
pngdriver/read_ppm.c:69
lib
pngdriver
read.c
Generated on Tue Feb 14 2023 05:56:01 for GRASS GIS 8 Programmer's Manual by
1.8.13