Skip to main content

reading pixel depth in linux

Forum

Would anyone know how to read the current pixel depth in linux
(like 8 bpp 16 bpp or 32 etc). The XF86VidModeGetModeLine will
give you the x and y and frequency but how do you read the bits
per pixel?

Submitted by CombatWombat on Fri, 09/07/04 - 7:30 PM Permalink

Can't answer the question immediately, but can help you find the information you're after (xfree86 didn't exist the last time I was doing any serious X windows programming :)

Can I ask what you're wanting to do with the information? (ie is it for direct graphics access, for a utility program that tells you the bit depth, or is it for setting up a Pixmap with the same depth as a Window?)

One thing to look at may be the DGA extension (http://www.xfree86.org/current/XDGA.3.html)

You might find it useful to look at a slightly higher-level interface than using the X-extensions directly (eg the SDL media layer: http://www.libsdl.org/index.php)

Finally, a PDF of a book called "Programming Linux Games" is available at: http://unia.ual.es/docs/sdl/plg-final.pdf In terms of copyright of the PDF, AFAIK this has been made freely available by the author.

Cheers,

Mark

Forum

Would anyone know how to read the current pixel depth in linux
(like 8 bpp 16 bpp or 32 etc). The XF86VidModeGetModeLine will
give you the x and y and frequency but how do you read the bits
per pixel?


Submitted by CombatWombat on Fri, 09/07/04 - 7:30 PM Permalink

Can't answer the question immediately, but can help you find the information you're after (xfree86 didn't exist the last time I was doing any serious X windows programming :)

Can I ask what you're wanting to do with the information? (ie is it for direct graphics access, for a utility program that tells you the bit depth, or is it for setting up a Pixmap with the same depth as a Window?)

One thing to look at may be the DGA extension (http://www.xfree86.org/current/XDGA.3.html)

You might find it useful to look at a slightly higher-level interface than using the X-extensions directly (eg the SDL media layer: http://www.libsdl.org/index.php)

Finally, a PDF of a book called "Programming Linux Games" is available at: http://unia.ual.es/docs/sdl/plg-final.pdf In terms of copyright of the PDF, AFAIK this has been made freely available by the author.

Cheers,

Mark