GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cairodriver/write.c
Go to the documentation of this file.
1 #include "cairodriver.h"
2 
3 #if CAIRO_HAS_XLIB_SURFACE
4 #include <X11/Xlib.h>
5 #include <cairo-xlib.h>
6 #endif
7 
8 void write_image(void)
9 {
10  G_debug(1, "write_image");
11 
12  if (!modified)
13  return;
14 
15  if (mapped)
16  return;
17 
18  if (!cairo || !surface)
19  return;
20 
21  if (file_type == FTYPE_PPM) {
22  G_debug(1, "Writing image to %s", file_name);
23  write_ppm();
24  }
25  else if (file_type == FTYPE_BMP) {
26  G_debug(1, "Writing image to %s", file_name);
27  write_bmp();
28  }
29 #if CAIRO_HAS_PNG_FUNCTIONS
30  else if (file_type == FTYPE_PNG) {
31  G_debug(1, "Writing image to %s", file_name);
32  cairo_surface_write_to_png(surface, file_name);
33  }
34 #endif
35 #if CAIRO_HAS_XLIB_SURFACE
36  else if (file_type == FTYPE_X11) {
37  XFlush(cairo_xlib_surface_get_display(surface));
38  }
39 #endif
40  /* vector format files are written directly to file */
41 
42  modified = 0;
43 }
#define FTYPE_BMP
Definition: cairodriver.h:26
int modified
void write_bmp(void)
#define FTYPE_PPM
Definition: cairodriver.h:25
#define FTYPE_X11
Definition: cairodriver.h:31
void write_image(void)
void write_ppm(void)
char * file_name
cairo_t * cairo
tuple surface
Definition: tools.py:1397
#define FTYPE_PNG
Definition: cairodriver.h:27
int mapped
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition: gis/debug.c:51
int file_type