[comp.windows.x] Standard Colormap

andrew@ee.su.oz.au (Andrew Ho) (01/15/91)

Hi,

  I am writing an image processing progm which requires
using a standard colormap. However, it seems to me that
the standard colormap cannot be created. The following is
my sample codes. Can anyone help me to find out what's
wrong ? 

  Thanks for any pointers.

andrew@ee.su.oz.au

/****************************************************/
#include <stdio.h>
#include <X11/Xatom.h>
#include <X11/X.h>
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include <Xw/Form.h>

Widget  top;
Widget  form;

XStandardColormap std_colormap;

main(argc, argv)
   int argc;
   char **argv;
{
    Arg  wargs[3];
    int j;

    top=XtInitialize(argv[0], "top", NULL, 0, &argc, argv);

    j=0;
    XtSetArg(wargs[j], XtNwidth, 50); j++;
    XtSetArg(wargs[j], XtNheight, 50); j++;
    form= XtCreateManagedWidget("form", XwformWidgetClass, top, wargs, j);

    XtRealizeWidget(top);

    if (XGetStandardColormap(XtDisplay(top), RootWindow(XtDisplay(top),
        DefaultScreen(XtDisplay(top))),
        &std_colormap, XA_RGB_DEFAULT_MAP) == 0)
       {
           printf("Cannot create std colormap\n");
       }
    
    XtMainLoop();
}

etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) (01/22/91)

Have you used the program xstdcmap to create the Standard Colormaps?
-- 
					Eric Taylor
					Baylor College of Medicine
					etaylor@wilkins.bcm.tmc.edu
					(713) 798-3776

mouse@lightning.mcrcim.mcgill.EDU (01/22/91)

> I am writing an image processing progm which requires using a
> standard colormap.  However, it seems to me that the standard
> colormap cannot be created.  The following is my sample code[s].

[...]
>     if (XGetStandardColormap(XtDisplay(top), RootWindow(XtDisplay(top),
>         DefaultScreen(XtDisplay(top))),
>         &std_colormap, XA_RGB_DEFAULT_MAP) == 0)

XGetStandardColormap does not create a standard colormap.  It merely
finds one if one has previously been created.  (Incidentally,
XGetStandardColormap has been superseded by XGetRGBColormap.)  Try
using xstdcmap to create the standard colormap first.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu