[cairo] Hi all and a couple questions...

J.A. Magallón jamagallon at ono.com
Thu Oct 30 16:03:55 PDT 2008

On Thu, 30 Oct 2008 12:49:50 -0700, Bill Spitzak <spitzak at thefoundry.co.uk> wrote:

> J.A. Magallón wrote:
> > Hi to everyone...
> > 
> > I have just discovered cairo, and it's far far better than plain gdk.
> > I use it fot a portable application between Linux and Win, and
> > works flawlessly both in Xp and Vista.
> > Thanks for the good work!!.
> > 
> > Everything is working fine, but a thing.
> > I can't get a way to paint grayscale images without converting them
> > to 24/32 bits.
> > I'm writing a little app to do image processing that works with gray
> > images from a Bassler camera, and don't want to waste memory converting
> > them to RGB. But cairo does not have a plain 'gray image' surface
> > type, just an 'alpha channel' type. I have tried with several
> > source/fill colors, operators, etc but can't find the right combo.
> I also ran into this. Cairo treats an A8 surface as r=g=b=0, a=value 
> when it is used as a color. I suggested that instead it treat it as 
> r=g=b=a=value. I was worried about back-compatibility, but the response 
> was that most people thought it was a good idea and unlikely to break 
> anything because the current behavior is useless. So it is possible this 
> will change.
> I also tried a lot of tricks with compositing operators, but nothing 
> ever really worked. I ended up making a temporary rgba image.

I have find to work to use an A8 image made with 255 - original, and
just paint it as normal.
But I wanted to use the same data for processing and display.

Perhaps, now that 1.9 is open, it would be good to add a _G8 (gray 8)
surface type.

J.A. Magallon <jamagallon()ono!com>     \               Software is like sex:
                                         \         It's better when it's free
Mandriva Linux release 2009.0 (Cooker) for i586
Linux 2.6.25-jam18 (gcc 4.3.1 20080626 (GCC) #1 SMP

More information about the cairo mailing list