[Kde-graphics-devel] Status update

Mosfet dan.duley at verizon.net
Tue Jan 4 00:17:18 CET 2005


No, you cannot depend on pixmaps being any particular depth. Right now on my 
machine it's not 24bpp, and I'm running a brand new X.org CVS checkout.

I use a 16bpp video mode with LSB byte order, so that's what pixmaps are. 
Pixmaps will always have the same color depth as the visual you are using. 

A lot of non-X11 geeks don't realize what happens when you convert an image to 
a pixmap. No matter if your using Qt, MImage, ImageMagick, or Imlib you first 
convert the toolkit's image into an XImage. An XImage is a scanline-based 
image but is in the byte order and depth of the X server's visual. This means 
if the X server is 16bpp the XImage will be 16bpp or below. 

Then you place the XImage on the server, preferably with MIT-SHM. What you get 
back is a X11 pixmap handle to the image. X11 pixmaps are really only integer 
ID's to an XImage on the X server. You can't directly access the scanlines 
anymore. If you want to directly access the bits you need to copy the image 
back to your client, (convert the pixmap to an image), but you have to 
remember it's been truncated to whatever depth your X11 visual is.

That's why I don't like programs that convert an image to a pixmap to display 
it, then convert it back to an image to edit it. You'll end up loosing color 
resolution. You should keep the image around in your client and just convert 
to pixmaps to display it.

On Monday 03 January 2005 02:28 pm, Dirk Schönberger wrote:
>
> This mean you cannot be sure that your QPixmaps are at least RGB / 24 bit
> deep, irregardless of the X server you use.
> Didn't know this. Ouch!


More information about the Kde-graphics-devel mailing list