22#include <gdk-pixbuf/gdk-pixbuf.h>
26 #pragma comment( lib, "gvc.lib" )
27 #pragma comment( lib, "glib-2.0.lib" )
28 #pragma comment( lib, "cairo.lib" )
29 #pragma comment( lib, "gobject-2.0.lib" )
30 #pragma comment( lib, "graph.lib" )
31 #pragma comment( lib, "gdk-pixbuf.lib" )
41static void gdk_set_mimedata_from_file (cairo_surface_t *
image,
const char *mime_type,
const char *file)
46 const char *id_prefix =
"gvloadimage_gdk-";
48 fp = fopen (file,
"rb");
51 fseek (fp, 0, SEEK_END);
57 if (fread(
data, (
size_t)
len, 1, fp) != 1) {
69 cairo_surface_set_mime_data(
image, CAIRO_MIME_TYPE_UNIQUE_ID,
70 (
unsigned char*)unique_id,
71 strlen(unique_id),
free, unique_id);
79 gdk_set_mimedata_from_file (
image, CAIRO_MIME_TYPE_PNG, us->
name);
82 gdk_set_mimedata_from_file (
image, CAIRO_MIME_TYPE_JPEG, us->
name);
91 cairo_surface_destroy(us->
data);
98 cairo_surface_t *cairo_image =
NULL;
99 cairo_pattern_t *pattern;
106 if (us->
datafree == gdk_freeimage) {
107 cairo_image = cairo_surface_reference(us->
data);
131 gdk_cairo_set_source_pixbuf (cr,
image, 0, 0);
132 pattern = cairo_get_source (cr);
133 assert(cairo_pattern_get_type (pattern) == CAIRO_PATTERN_TYPE_SURFACE);
134 cairo_pattern_get_surface (pattern, &cairo_image);
135 cairo_image = cairo_surface_reference (cairo_image);
137 gdk_set_mimedata (cairo_image, us);
138 us->
data = cairo_surface_reference(cairo_image);
151 cairo_surface_t *
image;
153 image = gdk_loadimage(job, us);
156 cairo_translate(cr, b.
LL.
x, -b.
UR.
y);
157 cairo_scale(cr, (b.
UR.
x - b.
LL.
x) / us->
w, (b.
UR.
y - b.
LL.
y) / us->
h);
158 cairo_set_source_surface (cr,
image, 0, 0);
161 cairo_surface_destroy (
image);
172#ifdef HAVE_PANGOCAIRO
173 {FORMAT_BMP_CAIRO,
"bmp:cairo", 1, &engine_gdk,
NULL},
174 {FORMAT_JPEG_CAIRO,
"jpe:cairo", 2, &engine_gdk,
NULL},
175 {FORMAT_JPEG_CAIRO,
"jpg:cairo", 2, &engine_gdk,
NULL},
176 {FORMAT_JPEG_CAIRO,
"jpeg:cairo", 2, &engine_gdk,
NULL},
178 {FORMAT_ICO_CAIRO,
"ico:cairo", 1, &engine_gdk,
NULL},
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
static char * agxbdisown(agxbuf *xb)
static double len(glCompPoint p)
void gvusershape_file_release(usershape_t *us)
bool gvusershape_file_access(usershape_t *us)
gvplugin_installed_t gvloadimage_gdk_types[]
void(* datafree)(usershape_t *us)