Exemplo n.º 1
0
Arquivo: img.c Projeto: Gingar/port
/* Compute 8-bit background for filling buffer with cimg->*_gamma
 * (performs rounding) */
void compute_background_8(unsigned char *rgb, struct cached_image *cimg)
{
	unsigned short red, green, blue;

	round_color_sRGB_to_48(&red, &green, &blue
		, cimg->background_color);
	rgb[0]=apply_gamma_single_16_to_8(red
		,cimg->red_gamma/user_gamma);
	rgb[1]=apply_gamma_single_16_to_8(green
		,cimg->green_gamma/user_gamma);
	rgb[2]=apply_gamma_single_16_to_8(blue
		,cimg->blue_gamma/user_gamma);
}
Exemplo n.º 2
0
void xbm_start(struct cached_image *cimg)
{
    struct xbm_decoder *deco;
    unsigned short r,g,b;

    deco=mem_alloc(sizeof(struct xbm_decoder));
    cimg->decoder=deco;
    deco->state=0;
    deco->width=-1;
    deco->height=-1;
    deco->buffer_pos=0;
    deco->partnum=0;
    deco->in_data_block=0;

    round_color_sRGB_to_48(&r,&g,&b,cimg->background_color);
    deco->barvicky[0]=apply_gamma_single_16_to_8(r,display_red_gamma);
    deco->barvicky[1]=apply_gamma_single_16_to_8(g,display_green_gamma);
    deco->barvicky[2]=apply_gamma_single_16_to_8(b,display_blue_gamma);

    round_color_sRGB_to_48(&r,&g,&b,get_foreground(cimg->background_color));
    deco->barvicky[3]=apply_gamma_single_16_to_8(r,display_red_gamma);
    deco->barvicky[4]=apply_gamma_single_16_to_8(g,display_green_gamma);
    deco->barvicky[5]=apply_gamma_single_16_to_8(b,display_blue_gamma);


}