[cairo] BUG: CAIRO_FORMAT_ARGB32, image_surface transparency = CAIRO_IMAGE_IS_OPAQUE after write_png()
ajohnson at redneon.com
Tue Jun 7 11:47:01 UTC 2016
On 07/06/16 16:59, Lawrence D'Oliveiro wrote:
> On Tue, 7 Jun 2016 08:19:47 +0930, Adrian Johnson wrote:
>> Cairo analyses image transparency to ensure it uses the most
>> efficient format when writing out images to
>> PNG, PDF, and PS.
> I don’t mind PDF and PostScript, they’re quite complicated formats. But
> I thought the PNG reading/writing capability built into Cairo was
> supposed to be, and I quote, “a toy API”
> Optimizing out the alpha channel would have to count as an “advanced”
> feature, not a “toy” one, I would have thought.
"Advanced features" would be things that require additional API to
control. Substituting operations with more efficient operations that
produce identical results is something that cairo does a lot of. We
already have the code for optimizing away the alpha channel. Making the
PNG surface use is it is trivial and does not require any extra API.
It is helpful when writing out PNG images for debugging purposes to know
if an ARGB32 image is opaque. It also reduces the size of the 2978 out
of 3458 reference images in cairo test suite that are opaque.
More information about the cairo