home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.open-look
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!agate!linus!linus.mitre.org!mdw!tgimber
- From: tgimber@mdw.mitre.org (Tedd W Gimber)
- Subject: Re: OL RectButton labelImage byte ordering
- Message-ID: <1993Jan5.112923.2006@linus.mitre.org>
- Sender: news@linus.mitre.org (NONUSER)
- Nntp-Posting-Host: mdw.mitre.org
- Organization: Mitre Corporation, McLean, VA
- References: <1993Jan1.000817.15630@parc.xerox.com>
- Date: Tue, 5 Jan 1993 11:29:23 GMT
- Lines: 55
-
- In article <1993Jan1.000817.15630@parc.xerox.com> coombs@ivan.uucp () writes:
- >I created bitmaps with the 'bitmap' program. I then used XCreateImage
- >to generate the image for XtNlabelImage on rect buttons. But the image
- >was wrong. After an extended chase, I found that setting the images'
- >byte_order and bimap_bit_order to LSBFirst solved the problem.
- >
- >Setting the orders with ImageByteOrder and BitmapBitOrder did not solve
- >the problem.
- >
- >I ran all pieces on the same machine: 'bitmap', CC, and my
- >application.
- >
- >I tried 'iconedit', which generated the same output as 'bitmap'.
- >
- >I am not comfortable with hard coding the ordering. Is there a better
- >solution?
- >
- >Thanks. --Jim
-
- I came across this exact problem last month. The trick is to set the
- attributes bitmap_bit_order and byte_order in the XImage structure to LSBFirst.
-
- Here's an extract of my code:
-
- /*-------------------------------------------------------------------------*/
- IconButton::IconButton(WidgetRoot& parent, String iLabel, int iChoice,
- const Color *fg, const Color *bg, char *bitmap,
- unsigned int width, unsigned int height)
- : Button(iLabel, iChoice)
- {
- image=XCreateImage(parent.getDisplay(),
- OlVisualOfObject(parent.getWidget()),
- 1, XYBitmap, 0, bitmap, width, height, 32,
- (width+7)/8);
-
- image->byte_order=LSBFirst;
- image->bitmap_bit_order=LSBFirst;
-
- widget = XtVaCreateManagedWidget(label, oblongButtonWidgetClass,
- parent.getWidget(),
- XtNlabelType, (XtArgVal)OL_IMAGE,
- XtNlabelImage, (XtArgVal)image,
- XtNforeground, (XtArgVal)fg->getColor().pixel,
- XtNbackground, (XtArgVal)bg->getColor().pixel,
- XtNinputFocusColor, (XtArgVal)bg->getColor().pixel,
- XtNfontColor, (XtArgVal)fg->getColor().pixel,
- NULL);
-
- }
- /*-------------------------------------------------------------------------*/
-
- The parameters bitmap, width, and height are from the included file
- produced by 'bitmap' or iconedit. Hope this helps.
-
- Tedd
-