GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-6596d49e63
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 contributor)
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 }
void cairo_write_image(void)
GRASS cairo display driver - header file.
void cairo_write_ppm(void)
void cairo_write_bmp(void)
#define FTYPE_PPM
Definition: cairodriver.h:54
#define FTYPE_X11
Definition: cairodriver.h:60
cairo_surface_t * surface
struct cairo_state ca
#define FTYPE_PNG
Definition: cairodriver.h:56
void cairo_write_xid(void)
Definition: write_xid.c:5
#define FTYPE_BMP
Definition: cairodriver.h:55
cairo_t * cairo
int G_debug(int, const char *,...) __attribute__((format(printf
char * file_name
Definition: cairodriver.h:66