25#include <gdk-pixbuf/gdk-pixbuf.h>
29 #pragma comment( lib, "gvc.lib" )
30 #pragma comment( lib, "glib-2.0.lib" )
31 #pragma comment( lib, "cairo.lib" )
32 #pragma comment( lib, "gobject-2.0.lib" )
33 #pragma comment( lib, "graph.lib" )
34 #pragma comment( lib, "gdk-pixbuf.lib" )
44static void gdk_set_mimedata_from_file (cairo_surface_t *
image,
const char *mime_type,
const char *file)
49 const char *id_prefix =
"gvloadimage_gdk-";
51 fp = fopen (file,
"rb");
54 fseek (fp, 0, SEEK_END);
60 if (fread(
data, (
size_t)
len, 1, fp) != 1) {
72 cairo_surface_set_mime_data(
image, CAIRO_MIME_TYPE_UNIQUE_ID,
73 (
unsigned char*)unique_id,
74 strlen(unique_id),
free, unique_id);
82 gdk_set_mimedata_from_file (
image, CAIRO_MIME_TYPE_PNG, us->
name);
85 gdk_set_mimedata_from_file (
image, CAIRO_MIME_TYPE_JPEG, us->
name);
94 cairo_surface_t *surface;
102 const bool is_last = cairo_surface_get_reference_count(
data->surface) == 1;
103 cairo_surface_destroy(
data->surface);
114 cairo_surface_t *cairo_image =
NULL;
115 cairo_pattern_t *pattern;
122 if (us->
datafree == gdk_freeimage) {
125 cairo_image = cairo_surface_reference(
data->surface);
149 gdk_cairo_set_source_pixbuf (cr,
image, 0, 0);
150 pattern = cairo_get_source (cr);
151 assert(cairo_pattern_get_type (pattern) == CAIRO_PATTERN_TYPE_SURFACE);
152 cairo_pattern_get_surface (pattern, &cairo_image);
153 cairo_image = cairo_surface_reference (cairo_image);
155 gdk_set_mimedata (cairo_image, us);
157 *
data = (data_t){.surface = cairo_surface_reference(cairo_image),
172 cairo_surface_t *
image;
174 image = gdk_loadimage(job, us);
177 cairo_translate(cr, b.
LL.
x, -b.
UR.
y);
178 cairo_scale(cr, (b.
UR.
x - b.
LL.
x) / us->
w, (b.
UR.
y - b.
LL.
y) / us->
h);
179 cairo_set_source_surface (cr,
image, 0, 0);
182 cairo_surface_destroy (
image);
193#ifdef HAVE_PANGOCAIRO
194 {FORMAT_BMP_CAIRO,
"bmp:cairo", 1, &engine_gdk,
NULL},
195 {FORMAT_JPEG_CAIRO,
"jpe:cairo", 2, &engine_gdk,
NULL},
196 {FORMAT_JPEG_CAIRO,
"jpg:cairo", 2, &engine_gdk,
NULL},
197 {FORMAT_JPEG_CAIRO,
"jpeg:cairo", 2, &engine_gdk,
NULL},
199 {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)
Memory allocation wrappers that exit on failure.
static void * gv_alloc(size_t size)
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)