GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
Loading...
Searching...
No Matches
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 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 read_image(void)
22{
23 char *p = png.file_name + strlen(png.file_name) - 4;
24
25 if (G_strcasecmp(p, ".ppm") == 0) {
26 read_ppm();
27 if (png.has_alpha)
28 read_pgm();
29 }
30 else if (G_strcasecmp(p, ".bmp") == 0)
31 read_bmp();
32#ifdef HAVE_PNG_H
33 else if (G_strcasecmp(p, ".png") == 0)
34 read_png();
35#endif
36 else
37 G_fatal_error("read_image: unknown file type: %s", p);
38
39 png.modified = 0;
40}
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 read_image(void)
GRASS png display driver - header file.
void read_bmp(void)
void read_ppm(void)
void read_png(void)
Definition read_png.c:44
void read_pgm(void)