[Xcb] xcb_image_get round trip

Jamey Sharp jamey at minilop.net
Fri Nov 10 01:42:24 PST 2006


On Fri, Nov 10, 2006 at 09:54:37AM +0100, Vincent Torri wrote:
> Hey,

Hi Vincent!

> there's a round trip in xcb_image_get. Shouldn't we change it like:

Yes, there is, and yes, it would be a good idea to fix it. I'm not sure
what the best fix is, though.

The entire API could use some careful thought. As usual, modelling
interfaces after Xlib gives ... poor interfaces. :-) I'd suggest looking
at the various bits of code that Ian and I have inserted in cairo and
the xcbneko demo to process images, and thinking about how it could be
made easier or more useful.

One observation is that XImage does several different things.
- It can convert images between a few different formats, including
  different endiannesses and (slowly) between different color depths.
- It can split images into smaller ones -- a useful generalization might
  be a way to ask for an image that has the same contents as a
  sub-rectangle of another image.
- It can read or write single pixels in images of several different
  formats.
- It can copy image buffers across an X connection.

Only the last one is X-specific. I've been searching for a while for
existing libraries that do part or all of the non-X functionality and
have no X dependencies, because I think that's clearly what we need here
(and in many projects). I found one that would do completely generic
pluggable format conversion, but it looked a bit over-engineered on
first glance and I don't remember what it was now.

> That is, the user call xcb_get_image and xcb_get_image_reply before, and 
> provide the reply with other necessary data. I don't know if it's 
> better that the check of the reply is done by the user or in
> xcb_image_get. Afer that, the user will have to free the reply.

As to your actual question: Forcing the user to provide the same
information twice is unpleasant, so if you're suggesting that I hope we
can avoid it.

Perhaps that means that we need to make the xcb_image library do both
the request and the reply, but maybe the image structure it returns
wouldn't necessarily have an actual image in it. When first returned it
would have the reply cookie instead. Then when you try to access it, the
reply is forced and the image becomes complete.

For extra bonus points, implement this without changing the API and so
without breaking any code that uses xcb_image currently. I think it can
probably be done...

> Also, maybe we should provide all the *_checked and *_unchecked versions 
> of the functions.

Yeah, probably.

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20061110/e4d70fbb/attachment.pgp


More information about the Xcb mailing list