[cairo] Re: Embedding JPG in PDF

Carl Worth cworth at cworth.org
Fri Jan 19 23:43:29 PST 2007


On Wed, 10 Jan 2007 21:37:59 -0800, Carl Worth wrote:
> [1.1.2 pdfimg-pattern.c <application/octet-stream (7bit)>]
...
>     /* cairo_paint should work here, but it seems to be resulting in a
>      * repeating image currently, so instead setup a rectangle
>      * corresponding to the image size and fill it. */
>     cairo_rectangle (cr, 0, 0,
> 		     cairo_image_surface_get_width (img) / 300.0,
> 		     cairo_image_surface_get_height (img) / 300.0);
>     cairo_fill (cr);
...
> [1.1.3 pdfimg-300dpi-user-space.c <application/octet-stream (7bit)>]
...
>     /* cairo_paint should work here, but it seems to be resulting in a
>      * repeating image currently, so instead setup a rectangle
>      * corresponding to the image size and fill it. */
>     cairo_rectangle (cr,
> 		     300 * 0.5, 300 * 0.5,
> 		     cairo_image_surface_get_width (img),
> 		     cairo_image_surface_get_height (img));
>     cairo_fill (cr);
...

As mentioned in a separate thread, the bug with erroneous repeating
images in PDF output is now fixed. So with the latest cairo, the above
two ugly cairo_rectangle;cairo_fill sequences can each be replaced
with simply:

	cairo_paint (cr);

exactly as this API was originally intended to work. I've re-tested
exactly that change with both of these examples and it works great.

I apologize for that nasty bug being there, (and I particularly
disliked how it cluttered up these examples that would have been so
much cleaner without it).

So that fix is in cairo now, and will appear in the (extremely
imminent) 1.3.12 snapshot and in the (not-too-far-in-the-future-now)
1.4.0 release.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070119/3c9bdc2d/attachment.pgp


More information about the cairo mailing list