GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
cairodriver/write.c
Go to the documentation of this file.
1 /*!
2  \file lib/cairodriver/write.c
3 
4  \brief GRASS cairo display driver - write image (lower level functions)
5 
6  (C) 2007-2008 by Lars Ahlzen 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 Lars Ahlzen <lars ahlzen.com> (original contibutor)
12  \author Glynn Clements
13 */
14 
15 #include "cairodriver.h"
16 
18 {
19  G_debug(1, "write_image");
20 
21  if (!ca.modified)
22  return;
23 
24  if (ca.mapped)
25  return;
26 
27  if (!cairo || !surface)
28  return;
29 
30  if (ca.file_type == FTYPE_PPM) {
31  G_debug(1, "Writing image to %s", ca.file_name);
33  }
34  else if (ca.file_type == FTYPE_BMP) {
35  G_debug(1, "Writing image to %s", ca.file_name);
37  }
38 #if CAIRO_HAS_PNG_FUNCTIONS
39  else if (ca.file_type == FTYPE_PNG) {
40  G_debug(1, "Writing image to %s", ca.file_name);
41  cairo_surface_write_to_png(surface, ca.file_name);
42  }
43 #endif
44 #if CAIRO_HAS_XLIB_XRENDER_SURFACE
45  else if (ca.file_type == FTYPE_X11) {
46  G_debug(1, "Writing XID to %s", ca.file_name);
48  }
49 #endif
50  /* vector format files are written directly to file */
51 
52  ca.modified = 0;
53 }
#define FTYPE_BMP
Definition: cairodriver.h:54
struct cairo_state ca
#define FTYPE_PPM
Definition: cairodriver.h:53
#define FTYPE_X11
Definition: cairodriver.h:59
char * file_name
Definition: cairodriver.h:65
cairo_t * cairo
void cairo_write_ppm(void)
#define FTYPE_PNG
Definition: cairodriver.h:55
void cairo_write_bmp(void)
void cairo_write_image(void)
GRASS cairo display driver - header file.
cairo_surface_t * surface
void cairo_write_xid(void)
Definition: write_xid.c:6
int G_debug(int, const char *,...) __attribute__((format(printf