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

Tavmjong Bah <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On Thu, 2016-01-28 at 17:18 -0500, William Kappler wrote:
> 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.

We (Inkscape) would love to see a floating point format to avoid issues
such as banding in gradients.

Tav

> :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
> William E. Kappler II
> LinkedIn · Blog · Project Website
> 
> On Thu, Jan 28, 2016 at 3:11 PM, Bill Spitzak <[email protected]>
> 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@geek-cent
> > ral.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
> > > [email protected]
> > > http://lists.cairographics.org/mailman/listinfo/cairo
> > > 
> > 
> > --
> > cairo mailing list
> > [email protected]
> > http://lists.cairographics.org/mailman/listinfo/cairo
> -- 
> 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.