[Customdrawn] Some patches

Giuliano Colla giuliano.colla at fastwebnet.it
Tue Apr 3 10:29:30 CEST 2012

Il 03/04/2012 00:56, Giuliano Colla ha scritto:
> Il 02/04/2012 14:56, Felipe Monteiro de Carvalho ha scritto:
>> On Mon, Apr 2, 2012 at 12:27 PM, Giuliano Colla
>> <giuliano.colla at fastwebnet.it>  wrote:
>>> But if slowness is not an X11-only issue, then this approach should be
>>> considered. After all that's the reason why other widgesets are 
>>> faster. It
>>> is not that they're smarter in painting than you. They just distribute
>>> activity between the main thread and their own threads.
>> One of my main interrests now in LCL-CustomDrawn is using it to build
>> the next Mac OS X release of the Virtual Magnifying Glass. The VMG
>> takes a fullscreen screenshot and draws it and then draws a movable
>> lens in the screen which magnifies part of the screen.
> ...
>> I think it will probably be slow in LCL-CustomDrawn-X11, although I
>> haven't tested yet since it requires screenshot support and this
>> backend lacks this feature. It would be really interresting to
>> investigate how to make screenshots in X11 and implement this to test
>> the Virtual Magnifying Glass.
> I think that what you need is XGetImage:
> http://tronche.com/gui/x/xlib/graphics/XGetImage.html
> which will return a pointer to an XImage structure, described here:
> http://tronche.com/gui/x/xlib/graphics/images.html#XImage
> (as you already know, because you've used it in 
> DrawRawImageToGc_XPutimage)
> XGetImage is defined in Xlib, so it should be a child play for you to 
> implement it.
> The only difference with your XPutImage call is that you get an XImage 
> instead of sending one, and that the window you must use isn't the 
> form window, but the root window of the display.
> You may obtain the root window with a call to XRootWindow, or 
> XDefaultRootWindow. (it makes a difference only if you have more than 
> one display, e.g. using Xinerama)
> Then you'll need to perform the conversion, in order to transform the 
> raw image in the format you need.
> I've never used that myself. It's also possible that that way you get 
> only the desktop background, but the only way to know is to test.

I've verified that with XGetImage on the root window you really get the 
image of your screen, and not only the desktop background:


If you give me some hints (e.g. which backend supports screen capture, 
where it's implemented, and how the main program uses that feature. IOW 
which are the source files to look at), I can try and do the same for 
X11, just to see what happens.


More information about the Customdrawn mailing list