[comp.windows.x] GrayScale colormap in XView 2.0.

laucy@warwick.ac.uk (TS Wong) (09/13/90)

Is there anyone know how to create a GrayScale Colormap in XView 2.0?
Thanks in advance.

-------------------
laucy@uk.ac.warwick.cs

cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) (09/14/90)

>Is there anyone know how to create a GrayScale Colormap in XView 2.0?
>Thanks in advance.

You need to set the attribute XV_VISUAL_CLASS to GreyScale on your window
and on your colormap segment (if you are using XView colormap segments
rather than manipulating Xlib colormaps directly).  For example

     frame = (Frame) xv_create (NULL, FRAME,
                                XV_VISUAL_CLASS, GreyScale,
                                NULL);

     cms = (Cms) xv_create (NULL, CMS,
                            XV_VISUAL_CLASS, GreyScale,
                            CMS_SIZE, 128,
                            ... /* other attributes */
                            NULL);

     xv_set (frame, WIN_CMS, cms, NULL);

Note that the XV_VISUAL_CLASS of the CMS must agree with the XV_VISUAL_CLASS
of the window with which the CMS is associated.

XV_VISUAL_CLASS is new in XView 2.0 and is documented in the release notes
but appears not to have made it into "Converting Sunview Applications" or
the second edition of the "XView Programming Manual" (it does not appear
in the index of either manual.

			Chris Flatters