Loading...
Searching...
No Matches
cairodriver/read.c
Go to the documentation of this file.
/*!
\file lib/cairodriver/read.c
\brief GRASS cairo display driver - read image (lower level functions)
(C) 2007-2008, 2011 by Lars Ahlzen and the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
\author Lars Ahlzen <lars ahlzen.com> (original contributor)
\author Glynn Clements
*/
#include "cairodriver.h"
void cairo_read_image(void)
{
G_debug(1, "read_image");
if (!cairo || !surface)
return;
if (ca.file_type == FTYPE_PPM) {
G_debug(1, "Reading image from %s", ca.file_name);
cairo_read_ppm();
}
else if (ca.file_type == FTYPE_BMP) {
G_debug(1, "Reading image from %s", ca.file_name);
cairo_read_bmp();
}
#if CAIRO_HAS_PNG_FUNCTIONS
else if (ca.file_type == FTYPE_PNG) {
cairo_surface_t *img_surf;
G_debug(1, "Reading image from %s", ca.file_name);
img_surf = cairo_image_surface_create_from_png(ca.file_name);
if (!img_surf)
return;
cairo_save(cairo);
cairo_set_source_surface(cairo, img_surf, 0, 0);
cairo_paint(cairo);
cairo_restore(cairo);
cairo_surface_destroy(img_surf);
}
#endif
#if CAIRO_HAS_XLIB_XRENDER_SURFACE
else if (ca.file_type == FTYPE_X11) {
G_debug(1, "Reading XID from %s", ca.file_name);
cairo_read_xid();
}
#endif
/* vector format files are written directly to file */
ca.modified = 0;
}
cairo_read_image
void cairo_read_image(void)
Definition cairodriver/read.c:17
cairodriver.h
GRASS cairo display driver - header file.
FTYPE_PPM
#define FTYPE_PPM
Definition cairodriver.h:54
FTYPE_X11
#define FTYPE_X11
Definition cairodriver.h:60
cairo_read_bmp
void cairo_read_bmp(void)
Definition cairodriver/read_bmp.c:82
cairo_read_xid
void cairo_read_xid(void)
Definition read_xid.c:5
surface
cairo_surface_t * surface
Definition cairodriver/graph.c:45
ca
struct cairo_state ca
Definition cairodriver/graph.c:42
FTYPE_PNG
#define FTYPE_PNG
Definition cairodriver.h:56
FTYPE_BMP
#define FTYPE_BMP
Definition cairodriver.h:55
cairo
cairo_t * cairo
Definition cairodriver/graph.c:46
cairo_read_ppm
void cairo_read_ppm(void)
Definition cairodriver/read_ppm.c:19
G_debug
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition debug.c:66