[cairo] JPEG support patch
Vladimir Vukicevic
vladimir at pobox.com
Fri Jan 19 11:30:03 PST 2007
Hmm.. there already is a surface_pattern, and surfaces can have
arbitrary data attached to them. It seems like the pdf backend can just
check for some well-known compressed_data_key data to be set on the
surface, that would be a struct that looks like:
struct compressed_image_data {
char *type; // "image/jpeg"
unsigned long data_length;
unsigned char *data;
};
(or whatever -- maybe a getter function so that the data doesn't have to
stay in memory, etc.)
If it finds one of those and recognizes the type, it can embed the image
data directly. I don't understand why doing this would require adding
any API to cairo itself (other than the image data struct/global key) --
certainly there could be helper libraries that would simplify the image
loading process, but other than that, it would just be a few changes to
the PDF backend using already existing infrastructure...
- Vlad
Bill Spitzak wrote:
> You are right, cairo would not require DevIL, only the image_pattern
> types. Although if the pdf surface was able to recognize the jpeg
> image_pattern, it may mean the pdf surface would end up depending on DevIL.
>
> Even if this was done, I think cairo should be able to *write* a png
> file without requiring DevIL, just libpng. But it may not be able to
> read a png without it.
>
> Vladimir Vukicevic wrote:
>> Bill Spitzak wrote:
>>> Actually DevIL is the library I was thinking of when I was trying to
>>> make a proposal for a new cairo pattern t.
>>>
>>> Perhaps Cairo can just require DevIL.
>>
>> What purpose would there be to having Cairo require DevIL, rather than
>> just having there be a middle layer shim library that can use DevIL to
>> load data into cairo surfaces/cairo patterns? There isn't anything
>> preventing you from creating cairo_image_pattern_create() on top of
>> existing public cairo APIs from another library. I wouldn't call it
>> cairo_ to avoid confusion, but something similar.
>>
>> - Vlad
>> _______________________________________________
>> cairo mailing list
>> cairo at cairographics.org
>> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
>>
>
More information about the cairo
mailing list