28 reader (
void *closure,
unsigned char *
data,
unsigned int length)
31 if (length == fread(data, 1, length, (FILE *)closure)
32 || feof((FILE *)closure))
33 return CAIRO_STATUS_SUCCESS;
34 return CAIRO_STATUS_READ_ERROR;
39 cairo_surface_destroy((cairo_surface_t*)(us->
data));
44 cairo_surface_t *surface =
NULL;
53 surface = (cairo_surface_t*)(us->
data);
65 #ifdef CAIRO_HAS_PNG_FUNCTIONS
67 surface = cairo_image_surface_create_from_png_stream(reader, us->
f);
68 cairo_surface_reference(surface);
75 us->
data = (
void*)surface;
85 cairo_t *cr = (cairo_t *) job->
context;
86 cairo_surface_t *surface;
93 surface = cairo_loadimage(job, us);
96 cairo_translate(cr, b.
LL.
x, -b.
UR.
y);
97 cairo_scale(cr, (b.
UR.
x - b.
LL.
x)/(us->
w), (b.
UR.
y - b.
LL.
y)/(us->
h));
98 cairo_set_source_surface (cr, surface, 0, 0);
106 cairo_surface_t *surface;
107 cairo_format_t format;
108 int X, Y, x, y, stride;
109 unsigned char *
data, *ix,
alpha, red, green, blue;
111 surface = cairo_loadimage(job, us);
113 format = cairo_image_surface_get_format(surface);
114 if ((format != CAIRO_FORMAT_ARGB32) && (format != CAIRO_FORMAT_RGB24))
117 X = cairo_image_surface_get_width(surface);
118 Y = cairo_image_surface_get_height(surface);
119 stride = cairo_image_surface_get_stride(surface);
120 data = cairo_image_surface_get_data(surface);
126 gvputs(job,
"/myctr 0 def\n");
127 gvputs(job,
"/myarray [\n");
128 for (y = 0; y < Y; y++) {
130 ix = data + y * stride;
131 for (x = 0; x < X; x++) {
140 gvprintf(job,
"%02x%02x%02x", red, green, blue);
145 gvputs(job,
"/myproc { myarray myctr get /myctr myctr 1 add def } def\n");
149 (b.
LL.
x + (b.
UR.
x - b.
LL.
x) * (1. - (job->
dpi.
x) / 96.) / 2.),
150 (b.
LL.
y + (b.
UR.
y - b.
LL.
y) * (1. - (job->
dpi.
y) / 96.) / 2.));
154 ((b.
UR.
x - b.
LL.
x) * 72. / 96.),
155 ((b.
UR.
y - b.
LL.
y) * 72. / 96.));
158 gvprintf(job,
"%d %d 8 [%d 0 0 %d 0 %d]\n", X, Y, X, -Y, Y);
160 gvputs(job,
"{myproc} false 3 colorimage\n");
167 pango_loadimage_cairo
void(* datafree)(usershape_t *us)
gvplugin_installed_t gvloadimage_pango_types[]
int gvputs(GVJ_t *job, const char *s)
boolean gvusershape_file_access(usershape_t *us)
void gvusershape_file_release(usershape_t *us)
void gvprintf(GVJ_t *job, const char *format,...)