akakatak akakatak - 6 months ago 88
C Question

XGetImage with pre-allocated memory buffer

Now I am dealing with some Xlib programming and want to take screenshots frequently and efficiently.

It seems that

internally allocates memory buffer for an image.
I want to use pre-allocated memory buffer in order to avoid massive memory allocation. Is there any way to do so?


You should use XGetSubImage it works with previously defined XImage and this way you can reuse the image.