Beispiel #1
0
static void
GrSetSystemPaletteWrapper(void *r)
{
	nxSetSystemPaletteReq *req = r;
	GR_PALETTE	       pal;

	pal.count = req->count;
	memcpy(pal.palette, req->palette, sizeof(pal.palette));
	GrSetSystemPalette(req->first, &pal);
}
Beispiel #2
0
// ncolors <= 256
int NX_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors)
{
    int        i ;
    GR_PALETTE pal ;

    Dprintf ("enter NX_SetColors\n") ;

    if (ncolors > 256) return 0 ;
    
    pal.count = ncolors ;
    for (i = 0; i < ncolors; ++ i) {
        pal.palette [i].r = colors [i].r ;
        pal.palette [i].g = colors [i].g ;
        pal.palette [i].b = colors [i].b ;
    }
    GrSetSystemPalette (firstcolor, & pal) ;

    Dprintf ("leave NX_SetColors\n") ;
    return 1 ;
}
Beispiel #3
0
/*
 * set the server palette to the requested colour
 * NOTE: this has only been tested for 8-bit colour!
 */
int
XStoreColor(Display *dpy, Colormap cmap, XColor *xc)
{
    unsigned char ind;

    ind = xc->pixel & 0xff;		/* colour map index */
    /*
     * the colours are passed as 16-bit values so divide by 256 to
     * get 8-bit RGB values
     */
    srv_pal.palette[0].r = (xc->red / 256) & 0xff;
    srv_pal.palette[0].g = (xc->green / 256) & 0xff;
    srv_pal.palette[0].b = (xc->blue / 256) & 0xff;
    srv_pal.count = 1;
#if 0
    /* DEBUG */
    printf("XStoreColor: ind=%d, r=%02x, g=%02x, b=%02x\n", ind, \
           srv_pal.palette[0].r, srv_pal.palette[0].g, \
           srv_pal.palette[0].b);
#endif
    GrSetSystemPalette(ind, &srv_pal);

    return(0);
}