gt2245a@prism.gatech.EDU (KUAI, WENMING) (11/12/90)
The following is a short program that was expected to show a bitmap
image.
/
o-----------o -o ------ o/
/ \ \
/
/ /
/ /
o -o
The left is what I created using bitmap, but the right is what I actually
get(sort of). Could someone out there please give me some advice as what
my mistake is? Your help will be greatly appreciated.
William
P.S. simplenet is a file containing an array of bits representing
the image(100x100).
======================================================
#define BYTES_PER_LINE 13
#include <X11/Intrinsic.h>
#include <Xw/Xw.h>
#include <Xw/SRaster.h>
#include <Xw/RCManager.h>
#include "simplenet"
main(argc, argv)
int argc;
char *argv[];
{
Widget toplevel, welcome, demo, options;
Arg wargs[1];
char *message;
XImage *image;
toplevel = XtInitialize(argv[0], "NNGinit", NULL, 0, &argc, argv);
image = XCreateImage(XtDisplay(toplevel),
DefaultVisualOfScreen(XtScreen(toplevel)),
1, XYBitmap, 0, image_bits, image_width,
image_height, 8, BYTES_PER_LINE);
XtSetArg(wargs[0], XtNsRimage, image);
XtCreateManagedWidget("Demo", XwsrasterWidgetClass, toplevel, wargs, 1);
XtRealizeWidget(toplevel);
XtMainLoop();
}
etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) (11/12/90)
First of all, why are you specifying bytes_per_line? If you use 0, then the correct value is used. Otherwise, you should be using the equation : (image_width + 7) / 8. But this is not the problem since 13 is the correct value. Second of all, I am pretty sure that you have to change the image structure members bitmap_bit_order and byte_order to LSBFirst. Look at documentation for XCreatePixmapFromBitmapData in O'Reilly's book. -- Eric Taylor Baylor College of Medicine etaylor@wilkins.bmc.tmc.edu (713) 798-3776