Re: how to display a XImage with 16bits depth in a drawable with a depth of 24bits ?

2009-03-03 Thread aivils
Citēju hd h.dupon...@laposte.net:


 Glynn Clements a écrit :
  hd wrote:
 
 
  I my app, I receive a raw image in 16 bits depth.
  My defaut visual have a depth of 24 bits (and all other Visual have 24
  or 32bits depth on my X server).
 
  To display the bitmap I try to create an XImage with XCreateImage() and
  display it with XPutImage().
  But X displays a bad match error
 
  If I try to display a raw image with the same depth (24bits) as the
  visual (24bits), my app works.
 
  Question : XImage APIs (XCreateImage() / XPutImage() / ...) can convert
  'on the fly' the depth of the bitmap to match the visual depth
  or must I convert myself the raw bitmap to match the visual depth ?
  (convert each pixel from 16bits to 24 bits)
 
 
  You must convert yourself, or use a higher-level interface. The core X
  protocol doesn't do format conversions.
 
  If you want the conversion to be done in hardware, look at OpenGL or
  XRender. It's implementation-dependent whether either of these
  supports a specific format (other than 24-bit RGB), so you still need
  to provide a software conversion.
 

It is done in the xloadimage source:
ftp://ftp.x.org/R5contrib/xloadimage.4.1.tar.gz

Aivils

 thanks a lot for your help.
 regards


___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Re: how to display a XImage with 16bits depth in a drawable with a depth of 24bits ?

2009-03-02 Thread hd

Glynn Clements a écrit :
 hd wrote:

   
 I my app, I receive a raw image in 16 bits depth.
 My defaut visual have a depth of 24 bits (and all other Visual have 24 
 or 32bits depth on my X server).

 To display the bitmap I try to create an XImage with XCreateImage() and 
 display it with XPutImage().
 But X displays a bad match error

 If I try to display a raw image with the same depth (24bits) as the 
 visual (24bits), my app works.

 Question : XImage APIs (XCreateImage() / XPutImage() / ...) can convert 
 'on the fly' the depth of the bitmap to match the visual depth
 or must I convert myself the raw bitmap to match the visual depth ? 
 (convert each pixel from 16bits to 24 bits)
 

 You must convert yourself, or use a higher-level interface. The core X
 protocol doesn't do format conversions.

 If you want the conversion to be done in hardware, look at OpenGL or
 XRender. It's implementation-dependent whether either of these
 supports a specific format (other than 24-bit RGB), so you still need
 to provide a software conversion.
   
thanks a lot for your help.
regards


___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: how to display a XImage with 16bits depth in a drawable with a depth of 24bits ?

2009-02-27 Thread Glynn Clements

hd wrote:

 I my app, I receive a raw image in 16 bits depth.
 My defaut visual have a depth of 24 bits (and all other Visual have 24 
 or 32bits depth on my X server).
 
 To display the bitmap I try to create an XImage with XCreateImage() and 
 display it with XPutImage().
 But X displays a bad match error
 
 If I try to display a raw image with the same depth (24bits) as the 
 visual (24bits), my app works.
 
 Question : XImage APIs (XCreateImage() / XPutImage() / ...) can convert 
 'on the fly' the depth of the bitmap to match the visual depth
 or must I convert myself the raw bitmap to match the visual depth ? 
 (convert each pixel from 16bits to 24 bits)

You must convert yourself, or use a higher-level interface. The core X
protocol doesn't do format conversions.

If you want the conversion to be done in hardware, look at OpenGL or
XRender. It's implementation-dependent whether either of these
supports a specific format (other than 24-bit RGB), so you still need
to provide a software conversion.

-- 
Glynn Clements gl...@gclements.plus.com
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg