On Mon, 20 Jan 1997, Andrew Baucom wrote:
> Hi,
> Does anyone have any example code I could view to see how to create a
> custom colormap?
This is what I did for a similar project.
/* select an 8-bit pseudocolor visual */
XVisualInfo xvi;
XMatchVisualInfo(dpy,0,8,PseudoColor,&xvi);
/* create a custom colormap */
Colormap colormap;
colormap=XCreateColormap(dpy,fl_default_window(),xvi.visual,AllocAll);
XColor colortable[256];
/* initialize colortable to the colors you want */
XStoreColors(fl_get_display(),colormap,colortable,256);
/* set the canvas's colormap */
fl_set_canvas_colormap(Canvas,colormap);
All this must be done _before_ you call fl_show_form. There is still more
though. If your not using a SGI system, you need to have the active
colormap switch to canvas's colormap when the mouse enters the canvas.
|Gazing up to the breeze of the heavens \ on a quest, meaning, reason |
|came to be, how it begun \ all alone in the family of the sun |
|curiosity teasing everyone \ on our home, third stone from the sun. |
|Trent Piepho (xyzzy@u.washington.edu) -- Metallica |
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html