20 #ifdef HAVE_PANGOCAIRO
37 gdImageDestroy((gdImagePtr)us->
data);
59 im = gdImageCreateFromGd(us->
f);
62 im = gdImageCreateFromGd2(us->
f);
67 us->
data = (
void*)gdImageCreateFromPng(us->
f);
72 us->
data = (
void*)gdImageCreateFromGif(us->
f);
77 us->
data = (
void*)gdImageCreateFromJpeg(us->
f);
83 us->
data = (
void*)gdImageCreateFromXpm(us->
f);
88 us->
data = (
void*)gdImageCreateFromWbmp(us->
f);
100 return (gdImagePtr)(us->
data);
103 static gdImagePtr gd_rotateimage(gdImagePtr im,
int rotation)
105 gdImagePtr im2 = gdImageCreate(im->sy, im->sx);
107 gdImageCopyRotated(im2, im, im2->sx / 2., im2->sy / 2.,
108 0, 0, im->sx, im->sy, rotation);
115 gdImagePtr im2, im = (gdImagePtr) job->
context;
117 if ((im2 = gd_loadimage(job, us))) {
119 im2 = gd_rotateimage(im2, job->
rotation);
125 #ifdef HAVE_PANGOCAIRO
128 cairo_t *cr = (cairo_t *) job->
context;
129 unsigned int x, y, stride, width, height, px;
131 cairo_surface_t *surface;
134 if ((im = gd_loadimage(job, us))) {
140 data = malloc (stride * height);
141 surface = cairo_image_surface_create_for_data (
data, CAIRO_FORMAT_ARGB32,
142 width, height, stride);
145 if (im->saveAlphaFlag) {
146 for (y = 0; y < height; y++) {
147 for (x = 0; x < width; x++) {
148 px = gdImageTrueColorPixel(im, x, y);
149 *
data++ = gdTrueColorGetBlue(px);
150 *
data++ = gdTrueColorGetGreen(px);
151 *
data++ = gdTrueColorGetRed(px);
152 *
data++ = (0x7F-gdTrueColorGetAlpha(px)) << 1;
157 for (y = 0; y < height; y++) {
158 for (x = 0; x < width; x++) {
159 px = gdImageTrueColorPixel(im, x, y);
160 *
data++ = gdTrueColorGetBlue(px);
161 *
data++ = gdTrueColorGetGreen(px);
162 *
data++ = gdTrueColorGetRed(px);
169 for (y = 0; y < height; y++) {
170 for (x = 0; x < width; x++) {
171 px = gdImagePalettePixel(im, x, y);
172 *
data++ = im->blue[px];
173 *
data++ = im->green[px];
174 *
data++ = im->red[px];
175 *
data++ = (px==im->transparent)?0x00:0xff;
181 cairo_translate(cr, b.
LL.
x, -b.
UR.
y);
182 cairo_scale(cr, (b.
UR.
x - b.
LL.
x)/(us->
w), (b.
UR.
y - b.
LL.
y)/(us->
h));
183 cairo_set_source_surface (cr, surface, 0, 0);
187 cairo_surface_destroy(surface);
194 gdImagePtr im =
NULL;
197 if ((im = gd_loadimage(job, us))) {
204 gvputs(job,
"/myctr 0 def\n");
205 gvputs(job,
"/myarray [\n");
207 for (y = 0; y < Y; y++) {
209 for (x = 0; x < X; x++) {
210 px = gdImageTrueColorPixel(im, x, y);
212 gdTrueColorGetRed(px),
213 gdTrueColorGetGreen(px),
214 gdTrueColorGetBlue(px));
220 for (y = 0; y < Y; y++) {
222 for (x = 0; x < X; x++) {
223 px = gdImagePalettePixel(im, x, y);
233 gvputs(job,
"/myproc { myarray myctr get /myctr myctr 1 add def } def\n");
237 (b.
LL.
x + (b.
UR.
x - b.
LL.
x) * (1. - (job->
dpi.
x) / 96.) / 2.),
238 (b.
LL.
y + (b.
UR.
y - b.
LL.
y) * (1. - (job->
dpi.
y) / 96.) / 2.));
246 gvprintf(job,
"%d %d 8 [%d 0 0 %d 0 %d]\n", X, Y, X, -Y, Y);
248 gvputs(job,
"{myproc} false 3 colorimage\n");
262 #ifdef HAVE_PANGOCAIRO
318 #ifdef HAVE_PANGOCAIRO
void(* datafree)(usershape_t *us)
gvplugin_installed_t gvloadimage_gd_types[]
int gvputs(GVJ_t *job, const char *s)
boolean gvusershape_file_access(usershape_t *us)
void gvusershape_file_release(usershape_t *us)
if(aagss+aagstacksize-1<=aagssp)
void gvprintf(GVJ_t *job, const char *format,...)