GRASS Programmer's Manual  6.4.2(2012)
cairodriver/write.c
Go to the documentation of this file.
00001 #include "cairodriver.h"
00002 
00003 #if CAIRO_HAS_XLIB_SURFACE
00004 #include <X11/Xlib.h>
00005 #include <cairo-xlib.h>
00006 #endif
00007 
00008 void write_image(void)
00009 {
00010     G_debug(1, "write_image");
00011 
00012     if (!modified)
00013         return;
00014 
00015     if (mapped)
00016         return;
00017 
00018     if (!cairo || !surface)
00019         return;
00020 
00021     if (file_type == FTYPE_PPM) {
00022         G_debug(1, "Writing image to %s", file_name);
00023         write_ppm();
00024     }
00025     else if (file_type == FTYPE_BMP) {
00026         G_debug(1, "Writing image to %s", file_name);
00027         write_bmp();
00028     }
00029 #if CAIRO_HAS_PNG_FUNCTIONS
00030     else if (file_type == FTYPE_PNG) {
00031         G_debug(1, "Writing image to %s", file_name);
00032         cairo_surface_write_to_png(surface, file_name);
00033     }
00034 #endif
00035 #if CAIRO_HAS_XLIB_SURFACE
00036     else if (file_type == FTYPE_X11) {
00037         XFlush(cairo_xlib_surface_get_display(surface));
00038     }
00039 #endif
00040     /* vector format files are written directly to file */
00041 
00042     modified = 0;
00043 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines