GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cairodriver/read.c
Go to the documentation of this file.
1 #include "cairodriver.h"
2 
3 void read_image(void)
4 {
5  G_debug(1, "read_image");
6 
7  if (!cairo || !surface)
8  return;
9 
10  if (file_type == FTYPE_PPM) {
11  G_debug(1, "Reading image from %s", file_name);
12  read_ppm();
13  }
14  else if (file_type == FTYPE_BMP) {
15  G_debug(1, "Reading image from %s", file_name);
16  read_bmp();
17  }
18 #if CAIRO_HAS_PNG_FUNCTIONS
19  else if (file_type == FTYPE_PNG) {
20  cairo_surface_t *img_surf;
21 
22  G_debug(1, "Reading image from %s", file_name);
23 
24  img_surf = cairo_image_surface_create_from_png(file_name);
25  if (!img_surf)
26  return;
27 
28  cairo_save(cairo);
29  cairo_set_source_surface(cairo, img_surf, 0, 0);
30  cairo_paint(cairo);
31  cairo_restore(cairo);
32 
33  cairo_surface_destroy(img_surf);
34  }
35 #endif
36  /* vector format files are written directly to file */
37 
38  modified = 0;
39 }
#define FTYPE_BMP
Definition: cairodriver.h:26
int modified
#define FTYPE_PPM
Definition: cairodriver.h:25
char * file_name
cairo_t * cairo
tuple surface
Definition: tools.py:1397
#define FTYPE_PNG
Definition: cairodriver.h:27
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition: gis/debug.c:51
void read_ppm(void)
int file_type
void read_image(void)
void read_bmp(void)