[cairo] Re: Embeding JPG in PDF
Bill Spitzak
spitzak at d2.com
Fri Jan 12 12:58:48 PST 2007
Jeremy Lea wrote:
> 5. Some way of passing out a cairo surface which could be used as a
> source for operations, but which is not a fully decoded image. It
> would need to know what cairo backend it was targeting, and then it
> could place a pointer to a backend specific rendering callback in the
> surface. The backends would then to taught about this pointer, and
> if it was not NULL, call it with enough backend details (including
> transformation matrix and clip path) to enable the function to render
> to the backend surface. The function would have the option of
> punting, saying TO_COMPLEX_FOR_ME. The backend would then fall back
> to requesting the full image surface, and use image surface fallbacks
> to render the image.
>
> This is the point at which the JPEG image backend would add a
> callback if it detected being rendered to a PDF surface, which would
> say "Yes, I know how to put myself into a PDF", and do the magic.
>
> This would be the only change in the cairo API - an additional per
> surface pointer which would hint to the backend that it had special
> knowledge of rendering. This isn't such a high price to pay, since
> it could be used by other libraries and it could have other uses.
I definatly do not like this. It should be reversed. What I would
propose is:
1. This object *IS* a cairo surface. The normal cairo functions will get
the width/height and uncompressed data. If possible the decoding of this
data will be deferred until it is asked for.
2. It is the *destination* surface's job to recognize these. The
jpeg_image_surface would not know anything about pdf's. Instead the pdf
cairo_t will know about jpegs. When asked to draw a surface, the pdf
will check if it in fact a jpeg_image_surface. It can then use
jpeg_surface-specific code to get the jpeg data and put it into the pdf.
Ideally this will all be done such that if the only use of the surface
is to draw it on a pdf then no decompression is done.
3. This adds nothing to the cairo api, except new types of surfaces.
More information about the cairo
mailing list