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

J.A. Magallón jamagallon at ono.com
Thu Oct 30 02:24:07 PDT 2008

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.

What I suspect I should do is to paint in white filtered by my grayscale
alpha to get to the destination surface. But I can't get it right.

My code is basicly like this:

        // Clear the region to get some base color to draw on top

	// set the source alpha, image() is A8
        // set the source color

The above code paints the image in negative.
What should I use as base color/alpha to fill the surface, and what
operator to paint the image the right way ?

And other question is: How could I disable image interpolation in
cairo_paint() ? I want to zoom my image and see big square pixels, not
the (fancy, btw) interpolation that cairo does by default ?

Thanks in advance for your time.

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