get_from_drawable for bitmaps
- From: Havoc Pennington <hp redhat com>
- To: gtk-devel-list gnome org
- Subject: get_from_drawable for bitmaps
- Date: 23 Aug 2001 23:45:04 -0400
Hi,
This patch allows gdk_pixbuf_get_from_image/get_from_drawable to be
called with no colormap if the source drawable is a bitmap. It then
fills in the pixbuf with opaque white for on bits and transparent
black for off bits.
Also, it fixes some bugs in the old one-bit visual, I hope.
Not sure about one change; I removed:
data = srow[xx >> 3] >> (7 - (xx & 7)) & 1;
replaced with:
data = srow[xx >> 3] & (image->byte_order == GDK_MSB_FIRST ?
(0x80 >> (xx & 7)) :
(1 << (xx & 7)));
The existing code doesn't seem to work, I didn't really unpack it
enough to see why.
Can image->byte_order ever be different from current CPU order?
XGetPixel() in Xlib uses the field in the image, but current
get_from_drawable() code just does a compile time thing (I think), so
maybe I could write:
#ifdef LITTLE
data = srow[xx >> 3] & (1 << (xx & 7));
#else
data = srow[xx >> 3] & (0x80 >> (xx & 7));
#endif
However, gdk_image_new_bitmap() for example seems to always use
MSBFirst, so that's at least one way to get MSBFirst on any CPU,
right?
I really, really hate this bitshifting graphics code hell. ;-)
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]