[Xcb] BitBlt like method?

Peter Harris git at peter.is-a-geek.org
Mon Nov 23 06:54:53 PST 2009


On Sun, Nov 22, 2009 at 9:15 PM, IT CPPower wrote:
> I'm trying to for a specific color on the specified Window/Child (HDC), and
> return the location of that pixel. I'm creating a shared library, and since
> it'll be cross-platform  I'll need the alternate of HDC because how else
> would I specify the target window I need to search for the color in right?
> (In windows i'd get a HDC like 5647382, and pass that onto
> CreateDIBSection/BitBlt and then use something like GetObject->bmBits to get
> the colors data and then search in there). I need to do this in Linux now...

A question very much like this one was answered only yesterday:
http://lists.freedesktop.org/archives/xcb/2009-November/005342.html

Summary: don't. There's probably a better way to do what you're really
trying to do. Why are you trying to scan a pixmap for a specific
color?

To answer the direct question: A GC is somewhat like an HDC, in that
it holds the brush (and the rest of the context), but in X11 the GC
does not bind to a particular drawable (window or pixmap). CopyArea is
the equivalent to BitBlt, and it takes a source drawable, a
destination drawable, and a GC (unlike BitBlt, which only takes a
source and destination DC). GetImage (to replace your GetObject) takes
xcb_window_t (like HWND) or xcb_pixmap_t (like HBITMAP) directly.

Peter Harris


More information about the Xcb mailing list