GRASS Programmer's Manual  6.4.2(2012)
cairodriver/read.c
Go to the documentation of this file.
00001 #include "cairodriver.h"
00002 
00003 void read_image(void)
00004 {
00005     G_debug(1, "read_image");
00006 
00007     if (!cairo || !surface)
00008         return;
00009 
00010     if (file_type == FTYPE_PPM) {
00011         G_debug(1, "Reading image from %s", file_name);
00012         read_ppm();
00013     }
00014     else if (file_type == FTYPE_BMP) {
00015         G_debug(1, "Reading image from %s", file_name);
00016         read_bmp();
00017     }
00018 #if CAIRO_HAS_PNG_FUNCTIONS
00019     else if (file_type == FTYPE_PNG) {
00020         cairo_surface_t *img_surf;
00021 
00022         G_debug(1, "Reading image from %s", file_name);
00023 
00024         img_surf = cairo_image_surface_create_from_png(file_name);
00025         if (!img_surf)
00026             return;
00027 
00028         cairo_save(cairo);
00029         cairo_set_source_surface(cairo, img_surf, 0, 0);
00030         cairo_paint(cairo);
00031         cairo_restore(cairo);
00032 
00033         cairo_surface_destroy(img_surf);
00034     }
00035 #endif
00036     /* vector format files are written directly to file */
00037 
00038     modified = 0;
00039 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines