void w_getpal( W_COLOR *palette)
void w_setpal( W_COLOR *palette)
The first function copies the current palette (the palette currently
used by the display) inside the palette variable. The second function
applies the palette palette at the screen.
Following is an example to create and attribute a palette to a window:
void create_palette( WINDOW *win) {
W_COLOR *palette;
/* 1) reserve memory */
palette = (W_COLOR*)malloc(app.color*sizeof(W_COLOR));
/* 2) initialize the palette with the current one */
w_getpal( palette);
/* 3) link the palette to the window */
win->graf.palette = palette;
}
Don't forget to free the memory when the window is destroyed:
/* Destroy function */
void destroy( WINDOW *win) {
WindClose( win);
free( win->graf.palette);
WindDelete( win);
}
Of course, WinDom uses the standard VDI palette format: the three
words stand for primar components (red, green, blue), and each
component has a value between 0 and 1000.