Hi Ulrich!
Here's what I did:
> > I would like to know if any of guys could tell me the difference between
> > XGetImage and XCreateImage ... by that I mean when do I use the
> one or the
> > other!
> >
> > Here's my problem:
> > I've noticed that XGetImage doesn't set the color masks
> (they're all zeros
> > even for 16 bpp...)
>
> Hmmm. According to the docs, that would even be correct; XGetImage
> is only supposed to set the 'depth' member :-/
>
> This means that you probably should replace the XGetImage calls
> with XCreateImage followed by XGetSubImage (of the whole image) ...
>
In graphics/x11drv/bitmap.c in function X11DRV_BITMAP_GetXImage
XImage *bmpImage;
/* Create the XImage */
if(!(bmpImage = XCreateImage( display,
DefaultVisualOfScreen(X11DRV_GetXScreen()),
bmp->bitmap.bmBitsPixel,
ZPixmap, 0, NULL ,
bmp->bitmap.bmWidth,
bmp->bitmap.bmHeight,
32, 0 )))
{
return NULL;
}
/* Get the data from the bitmap */
bmpImage->data = xcalloc( bmpImage->bytes_per_line *
bmp->bitmap.bmHeight );
return XGetSubImage( display,
((X11DRV_PHYSBITMAP
*)bmp->DDBitmap->physBitmap)->pixmap,
0,0,
bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
AllPlanes, ZPixmap,
bmpImage, 0, 0 );
This works with 16 bpp or more bitmaps ... but the color masks are still not
right for 1,4,8 bpp bitmaps, they are all the same as 16bpp ((red)0xf800
(green)0x07e0 (blue)0x001f)
I don't know if you have an idea on how to get the right masks for each
bits_per_pixel value?
thanks
Francois Boisvert
Macadamian Technologies Inc.
http://www.macadamian.com
getximage.diff