Re: Image Format / Pre-Multiplied Alpha Related Feature Request

Bill Spitzak <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAL-8oAjB4D+xV51ndw_PpS0_bsJxd=J_+Xvj=NapUV=pAQ=xEQ@mail.gmail.com>
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 <
[email protected]> 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
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
>

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.