Path: utzoo!mnetor!uunet!husc6!m2c!ulowell!apollo!oj From: oj@apollo.uucp (Ellis Oliver Jones) Newsgroups: comp.windows.x Subject: Re: XCreateBitmapFromData() bug/feature question Message-ID: <3a1c5230.d5b2@apollo.uucp> Date: 6 Feb 88 00:35:00 GMT References: <8802042049.AA06105@amadeus.silvlis.com> <10572@jade.BBN.COM> Reply-To: oj@apollo.UUCP (Ellis Oliver Jones) Organization: Apollo Computer, Chelmsford, MA Lines: 28 Matt Landau's answer to Mark Baushke was right on: >>I have a sequential stream of bytes which I want to make into an icon. >>On my Sun, I need to 'swap' the bytes on each 'short' word in order to >>make the image look correct.... >One portable way of doing this is to use XCreateImage to make an >XImage structure But all you *really* need to do is declare a local XImage structure and initialize the proper fields. You can code this up in C so it will work the same on a VAX and a Motorola processor: XImage myim; myim.format = XYBitmap; /* causes XCopyPlane behavior on XPutImage */ myim.data = @pointer to your own data@; myim.width = @width of data in pixels@; myim.height = @height in pixels@; myim.bytes_per_line = @whatever the bitmap pitch is@; myim.bitmap_unit = 16; /* short word bitmap */ myim.bitmap_bit_order = MSBFirst; /* same for 680x0 and VAX, but depends on frame buffer */ myim.byte_order = LSBFirst; /* this is "natural" for a VAX */ myim.bitmap_pad = @whatever comes at the ends of lines @; myim.xoffset = 0; /*probably*/ myim.depth = 1; /* the depth*/ XPutImage ( dpy, drawable, gc, &myim, srcx, srcy, dstx, dsty, @width@, @height@); Have fun! /oj