26reader (
void *closure,
unsigned char *
data,
unsigned int length)
29 if (length == fread(
data, 1, length, (FILE *)closure)
30 || feof((FILE *)closure))
31 return CAIRO_STATUS_SUCCESS;
32 return CAIRO_STATUS_READ_ERROR;
37 cairo_surface_destroy(us->
data);
42 cairo_surface_t *surface =
NULL;
63#ifdef CAIRO_HAS_PNG_FUNCTIONS
65 surface = cairo_image_surface_create_from_png_stream(
reader, us->
f);
66 cairo_surface_reference(surface);
84 cairo_surface_t *surface;
97 cairo_translate(cr, b.
LL.
x, -b.
UR.
y);
98 cairo_scale(cr, (b.
UR.
x - b.
LL.
x)/(us->
w), (b.
UR.
y - b.
LL.
y)/(us->
h));
99 cairo_set_source_surface (cr, surface, 0, 0);
107 cairo_surface_t *surface;
109 int X,
Y, x, y, stride;
110 unsigned char *
data, *ix,
alpha, red, green, blue;
117 format = cairo_image_surface_get_format(surface);
118 if ((
format != CAIRO_FORMAT_ARGB32) && (
format != CAIRO_FORMAT_RGB24))
121 X = cairo_image_surface_get_width(surface);
122 Y = cairo_image_surface_get_height(surface);
123 stride = cairo_image_surface_get_stride(surface);
124 data = cairo_image_surface_get_data(surface);
130 gvputs(job,
"/myctr 0 def\n");
131 gvputs(job,
"/myarray [\n");
132 for (y = 0; y <
Y; y++) {
134 ix =
data + y * stride;
135 for (x = 0; x <
X; x++) {
144 gvprintf(job,
"%02x%02x%02x", red, green, blue);
149 gvputs(job,
"/myproc { myarray myctr get /myctr myctr 1 add def } def\n");
153 (b.
LL.
x + (b.
UR.
x - b.
LL.
x) * (1. - (job->
dpi.
x) / 96.) / 2.),
154 (b.
LL.
y + (b.
UR.
y - b.
LL.
y) * (1. - (job->
dpi.
y) / 96.) / 2.));
158 ((b.
UR.
x - b.
LL.
x) * 72. / 96.),
159 ((b.
UR.
y - b.
LL.
y) * 72. / 96.));
164 gvputs(job,
"{myproc} false 3 colorimage\n");
#define X(prefix, name, str, type, subtype,...)
void gvusershape_file_release(usershape_t *us)
bool gvusershape_file_access(usershape_t *us)
int gvputs(GVJ_t *job, const char *s)
void gvprintf(GVJ_t *job, const char *format,...)
GVIO_API const char * format
static gvloadimage_engine_t engine_ps
static gvloadimage_engine_t engine_cairo
gvplugin_installed_t gvloadimage_pango_types[]
static void pango_loadimage_cairo(GVJ_t *job, usershape_t *us, boxf b, bool filled)
static void cairo_freeimage(usershape_t *us)
static void pango_loadimage_ps(GVJ_t *job, usershape_t *us, boxf b, bool filled)
static cairo_surface_t * cairo_loadimage(GVJ_t *job, usershape_t *us)
static cairo_status_t reader(void *closure, unsigned char *data, unsigned int length)
void(* datafree)(usershape_t *us)