예제 #1
0
파일: uicolor.c 프로젝트: martinpiper/VICE
static void uicolor_init_video_colors()
{
    short i;
    DWORD pixelr, pixelg, pixelb;
    
    for (i = 0; i < 256; i++)
    {
	unsigned char* pixelrbyte = (unsigned char*)&pixelr;
	unsigned char* pixelgbyte = (unsigned char*)&pixelg;
	unsigned char* pixelbbyte = (unsigned char*)&pixelb;
	pixelrbyte[0] = i;
	pixelrbyte[1] = 0;
	pixelrbyte[2] = 0;
	pixelgbyte[0] = 0;
	pixelgbyte[1] = i;
	pixelgbyte[2] = 0;
	pixelbbyte[0] = 0;
	pixelbbyte[1] = 0;
	pixelbbyte[2] = i;
       
	video_render_setrawrgb(i, 
			       pixelr,
			       pixelg,
			       pixelb);
    }
    
    video_render_initraw();
}
예제 #2
0
void uicolor_init_video_colors()
{
    short i;
    XColor colorr, colorg, colorb;
    Display *display;

    display = x11ui_get_display_ptr();
    for (i = 0; i < 256; i++) {
        colorr.flags = DoRed | DoGreen | DoBlue;
        colorr.red =  i << 8;
        colorr.green =  0;
        colorr.blue = 0;

        colorg.flags = DoRed | DoGreen | DoBlue;
        colorg.red =  0;
        colorg.green =  i << 8;
        colorg.blue = 0;

        colorb.flags = DoRed | DoGreen | DoBlue;
        colorb.red =  0;
        colorb.green =  0;
        colorb.blue = i << 8;

        if (!XAllocColor(display, colormap, &colorr)) {
            log_error(LOG_DEFAULT, "Cannot allocate color \"#%04X%04X%04X\".", colorr.red, colorr.green, colorr.blue);
        }
        if (!XAllocColor(display, colormap, &colorg)) {
            log_error(LOG_DEFAULT, "Cannot allocate color \"#%04X%04X%04X\".", colorg.red, colorg.green, colorg.blue);
        }
        if (!XAllocColor(display, colormap, &colorb)) {
            log_error(LOG_DEFAULT, "Cannot allocate color \"#%04X%04X%04X\".", colorb.red, colorb.green, colorb.blue);
        }
        video_render_setrawrgb(i, (DWORD)colorr.pixel, (DWORD)colorg.pixel, (DWORD)colorb.pixel);
    }

    video_render_initraw();
}