[comp.windows.x] XCreateImage

hds@io.UUCP (H.David Scarbro x6608) (01/05/89)

Is the following an Xlib bug (it is certainly an Xlib programming subtlety)?

The function XCreateImage uses the values from the Display structure passed to
it to initialize byte_order, bitmap_unit, bitmap_bit_order and bits_per_pixel
in the XImage structure that it returns.  In general this seems wrong.
Shouldn't these values should be set relative to the client, not the server?


----
David Scarbro                          UUCP: ..!{sun!sunne,mit-eddie}!ileaf!hds
Interleaf, Inc.                        Internet: hds@ileaf.com
10 Canal Park, Cambridge, MA 02141     Phone: (617)577-9800 x6608

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (01/05/89)

    The function XCreateImage uses the values from the Display structure passed
    to it to initialize byte_order, bitmap_unit, bitmap_bit_order and
    bits_per_pixel in the XImage structure that it returns.  In general this
    seems wrong.  Shouldn't these values should be set relative to the client,
    not the server?

XCreateImage is, umm, something of a crock.  It's a pretty special-case
interface, as it turns out, and the fact that there isn't a more generic
interface (which probably ought to have the generic name XCreateImage) is
even more of a crock.  The simplest workaround is to just manually smash
the values after you've created the image.  If want to worry about the
Xlib implementation underneath you getting confused, you might then want
to call _XInitImageFuncPtrs(image), but this is currently an internal
interface and so somewhat dangerous (although we have clients, e.g. xwud)
that do this.

This problem has been known for quite some time, but it doesn't seem to be
very high on anybody's priority list.