[cairo] Image Format / Pre-Multiplied Alpha Related Feature Request

William Kappler wekapple at ncsu.edu
Thu Jan 28 14:18:04 PST 2016


Thanks for the suggestion.

I'm not dealing with a single color, but that did give me an idea that
perhaps I could render color without alpha and then alpha on its own, and
just blend the data together on my end. I'm not sure if that will work or
not, I need to play with it.

A floating point format would be great, though, if that's possible at some
point in the future. It would potentially have utility beyond my specific
usage.


:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
William E. Kappler II
LinkedIn <https://www.linkedin.com/in/williamkappler> · Blog
<http://williamkappler.blogspot.com/> · Project Website
<https://github.com/WilliamKappler/onathacar/wiki>

On Thu, Jan 28, 2016 at 3:11 PM, Bill Spitzak <spitzak at gmail.com> wrote:

> Non-premultiplying of the destination buffer would involve changing all
> the compositing math.
>
> For instance OVER changes from A+B(1-a) to (A+Bb(1-a))/(a+b-ab)
>
> This almost always is more complicated, which is why premultiplied is
> almost always used in rendering and compositing. Also in most cases the
> background image has to be stored in floating point, as the multiply and
> division here will get you the same inaccuracy you are having with
> premultiplied.
>
> If your Cairo rendering is a solid color (ie paths and fill and fonts, but
> all using the same color) then you can get a non-premultiplied version by
> saving only the alpha channel and replacing the color with the solid color.
> This may cover a lot of the uses you want for texture maps. You may also be
> able to bleed out the color from alpha=1 pixels into neighboring
> transparent pixels, I have used this as a method to remove premultiplied
> inaccuracy.
>
> A floating-point format for Cairo would be a good solution however, as it
> would be accurate, whether or not it is premultiplied.
>
> Non-premultiplied source images are supported in most cases by choosing
> the correct compositing operations and using the alpha as a mask.
>
>
> On Thu, Jan 28, 2016 at 1:40 AM, Lawrence D'Oliveiro <
> ldo at geek-central.gen.nz> wrote:
>
>> On Thu, 28 Jan 2016 02:39:17 -0500, William Kappler wrote:
>>
>> > The issue is not any external format like OpenEXR, but that so far as
>> > I am aware, there is no way to extract non-pre-multiplied information
>> > out of Cairo.
>>
>> If you really wanted to, you could trade off resolution for bit depth
>> by doing oversampling.
>> --
>> cairo mailing list
>> cairo at cairographics.org
>> http://lists.cairographics.org/mailman/listinfo/cairo
>>
>
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20160128/8b5278b6/attachment.html>


More information about the cairo mailing list