Xlib - Problems taking an screenshot

343 views Asked by At

I'm developing a C++ program that takes an screenshot with Xlib.

First of all I open the display and I get an XImage pointer with XGetImage().

After that I can get all the pixels with XGetPixel(). It returns a decimal value, so we have to convert it to RGB.

Now, the simplest method is save as ".ppm" image. It works fine but something fails:

¿Transparency?

Some pixel's colours are wrong.

The ppm depth is 24 bits, so I think the problem may be transparency but,

¿ Is that the problem ? ¿ How can I get the alpha channel ?

¿ Should I use another library like OpenGL ?

Thanks!

0

There are 0 answers