akakatak akakatak - 1 year ago 189
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download