Path: utzoo!attcan!uunet!husc6!bloom-beacon!EXPO.LCS.MIT.EDU!rws From: rws@EXPO.LCS.MIT.EDU (Bob Scheifler) Newsgroups: comp.windows.x Subject: Re: XPutPixel Message-ID: <8811151416.AA22845@EXPO.LCS.MIT.EDU> Date: 15 Nov 88 14:16:32 GMT References: <994@godot.radonc.unc.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 23 Why not make XImage.data (unsigned long *) and be done with it? Umm, if you think PutPixel is slow, imagine the server having to accept a depth 1 image (bit per pixel) in your proposed format, and have to compact it down to a bitmap format acceptable for blitting onto the screen. But, I lie. Note that in an XImage, depth and bits_per_pixel are two separate things. In theory, you can create an image that is 8 bits deep but stored 32 bits_per_pixel, and then when you get around to sending it XPutImage will do the appropriate conversion if the bits_per_pixel doesn't match the server. Unfortunately, Xlib doesn't have code to implement this conversion yet, but it's *supposed* to (small consolation, I know). Moreover, note that things like XPutPixel are actually performed by calling functions stored in the XImage. It is perfectly reasonable for these functions to be specialized to the particular image format; indeed the Xlib manual points this out. Unfortunately, there are some crocks in the interface routines that make this difficult (an internal Xlib routine probably needs to be exported), but certainly that was the intention.