[cairo] Embedding jpeg in pdf

Jeremy Lea reg at openpave.org
Fri Jul 18 11:36:16 PDT 2008


On Fri, Jul 18, 2008 at 04:21:33PM +0430, Behdad Esfahbod wrote:
> On Tue, 2008-07-15 at 17:31 +0200, Jan Struyf wrote:
> > 
> > A more general approach would be useful, as Jeremy Lea also pointed out, 
> > because it can be used to import EPS figures in PS output or PDF figures 
> > in PDF output without the need for a PS/PDF interpreter.
> This is not how cairo works though.  Cairo code MUST be able to render
> to any cairo backend.  That just doesn't work with what you suggest.  We
> can have PS/PDF-specific API for pass through of EPS/PDF, but that's a
> different thing.

My proposal does not break this assumption.  It was to provide a feature
where the consumer of the cairo interface had a chance to perform its
own rendering or let cairo handle the fallback.  If cairo chose not to
call this rendering callback, it should render just the same (at least
to the level of image fallbacks).

It has the advantage that cairo does not need to know anything about the
magic the consumer is doing (which specifically means it does not need
to be linked to libjpeg, libpng or libtiff).  The consumer could be just
shipping out the raw jpeg data it has lying around, or re-encoding the
image surface on the fly.  For EPS/PDF, the application should already
have provided a bitmap of the content in the image surface, but could
pass through the raw content on the callback[1].  The same for PS/PDF

The disadvantage is that the consumer needs to know how to do the magic.


[1] Of course, there are many applications where the consumer should be
able to decide that they want different output from different backends. 
Putting up a box with "EPS content goes here" might be exactly the right
behavior for some applications.

FreeBSD - Because the best things in life are free...

More information about the cairo mailing list