[cairo] Get pixeldata from image

Carl Worth cworth at cworth.org
Mon Nov 20 07:57:47 PST 2006


On Mon, 20 Nov 2006 20:08:59 +0800, Steve Chaplin wrote:
> cairo.ImageSurface.get_data_as_rgba() takes a cairo.FORMAT_ARGB32
> surface and returns the data as rgba. It does not return the original
> data because the original data is not in rgba format.

Yuck!

Can we eliminate that function please?

We wrote the bindings guide to avoid semantic mismatches like
this. This thread provides a perfect example:

	Poster: How can I get a non-copying get_data?

	Cairo folks: What are you talking about? The get_data function
	doesn't do copying?

	???

I'd really like to be able to answer questions and have discussions
without having to clarify language choice first. I'd also like to be
able to answer questions without having binding-specific expertise. It
would be a shame to have to say "Oh, you're going to have to go find
someone who knows the pycairo details, since I don't."

(Admittedly, I don't know of a lot of other problems in pycairo, but
this one should be fixed.)

> The current release of pycairo does not have a
> cairo.ImageSurface.get_data() function. In CVS there is a
> cairo.ImageSurface.get_data() which I added today. So if you want to
> install using CVS you can test the new function.

So now there's a nice, non-copying get_data and a copying
get_data_as_rgb. Those names are much too similar for one to copy and
one to not. At the very least, the copying one should have a different
name.

But even then, the bindings shouldn't have functions that cairo itself
does not. If there's functionality missing, we should get it into
cairo itself so that all bindings can have it.

Then again, do we need a separate copying function here? One can
already copy data with cairo_set_source_surface;cairo_paint.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20061120/af9eedc8/attachment.pgp


More information about the cairo mailing list