29static void gvloadimage_poppler_free(
usershape_t *us)
31 g_object_unref(us->
data);
34static PopplerDocument* gvloadimage_poppler_load(
GVJ_t * job,
usershape_t *us)
36 PopplerDocument *document =
NULL;
44 if (us->
datafree == gvloadimage_poppler_free)
61 if (g_path_is_absolute(us->
name)) {
62 absolute = g_strdup (us->
name);
64 char *dir = g_get_current_dir();
65 absolute = g_build_filename(dir, us->
name,
NULL);
70 char *uri = g_filename_to_uri(absolute,
NULL, &
error);
74 printf(
"%s\n",
error->message);
79 document = poppler_document_new_from_file (uri,
NULL, &
error);
81 if (document ==
NULL) {
82 printf(
"%s\n",
error->message);
89 num_pages = poppler_document_get_n_pages (document);
91 printf(
"poppler fail: num_pages %d, must be at least 1", num_pages);
103 us->
datafree = gvloadimage_poppler_free;
116 PopplerDocument* document = gvloadimage_poppler_load(job, us);
120 cairo_surface_t *surface;
125 page = poppler_document_get_page (document, 0);
129 surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (
int)us->
w, (
int)us->
h);
130 cairo_surface_reference(surface);
132 cairo_set_source_surface(cr, surface, 0, 0);
133 cairo_translate(cr, b.
LL.
x, -b.
UR.
y);
134 cairo_scale(cr, (b.
UR.
x - b.
LL.
x)/(us->
w), (b.
UR.
y - b.
LL.
y)/(us->
h));
135 poppler_page_render (page, cr);
143 gvloadimage_poppler_cairo
149#ifdef HAVE_PANGOCAIRO
void gvusershape_file_release(usershape_t *us)
bool gvusershape_file_access(usershape_t *us)
static gvloadimage_engine_t engine_cairo
gvplugin_installed_t gvloadimage_poppler_types[]
void(* datafree)(usershape_t *us)