[cairo] Embedding jpeg in pdf
reg at FreeBSD.org
Mon Jul 14 13:22:01 PDT 2008
On Sun, Jul 13, 2008 at 01:53:50PM +0930, Adrian Johnson wrote:
> There are a couple of ways this could be implemented.
Please also consider a rendering callback aproach. Allow cairo API
consumers to register a function (either at a global level or per cairo
surface?), which follows a signuture something like this:
where the the render type would be a union of types containing the raw
surface information (PDF/PS stream, XPixmap, GDI stuff, etc.), which the
callback can use. If the callback knows how to render this surface to
the specified backend, then it does it and returns success, else it
returns unsupported, and cairo falls back to rendering it as it does
now. Cairo should have already set the transforms and clips etc.
This means cairo knows nothing about image types, and allows a consumer
to add support for any additional types (like PDF or PS passthrough).
The consumer could set any pointers it needs as private data on the
surface, without any ownership problems, and giving the consumer freedom
to implement things in different ways (for example, keeping the filename
of the jpeg and mostly copying it, without having both encoded and
decoded versions in memory).
This would duplicate code in consumers, but if there was an example
function in the test suite, then people could copy that. One day, it
will be in a cario image support library which someone writes ;-)
FreeBSD - Because the best things in life are free...
More information about the cairo