[comp.windows.x.motif] Bitmap => XImage => Widget

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();
}