// Because graphics.c is not included, we must have a copy here. void Chrom_Key_Alpha(REBVAL *v,REBCNT col,REBINT blitmode) { REBOOL found=FALSE; int i; REBCNT *p; p=(REBCNT *)VAL_IMAGE_HEAD(v); i=VAL_IMAGE_WIDTH(v)*VAL_IMAGE_HEIGHT(v); switch(blitmode) { case BLIT_MODE_COLOR: for(;i>0;i--,p++) { if(*p==col) { found=TRUE; *p=col|0xff000000; } } case BLIT_MODE_LUMA: for(;i>0;i--,p++) { if(BRIGHT(((REBRGB *)p))<=col) { found=TRUE; *p|=0xff000000; } } break; } if(found) VAL_IMAGE_TRANSP(v)=VITT_ALPHA; }
/* * vga_set_textattr: * @vga: VGAtext object * @textattr: VGA text attribute byte * * Set the VGAText's graphics context to use the text attribute given using * the current VGA palette. May not actually result in a call to the * graphics server, since redundant calls may be optimized out. */ static void vga_set_textattr(VGAText *vga, guchar textattr) { guchar fg, bg; /* * Blink logic for text attributes * ----------------------------------- * * has no blink bit: normal (fg = fg, bg = bg) * has blink bit, icecolor: high intensity bg (bg = hi(bg)) * has blink bit, no icecolor, blink_state off: fg = bg [hide] * has blink bit, no icecolor, blink_state on: normal (fg = fg) */ if (!GETBLINK(textattr)) { fg = GETFG(textattr); bg = GETBG(textattr); } else if (vga->pvt->icecolor) { /* High intensity background / iCEColor */ fg = GETFG(textattr); bg = BRIGHT(GETBG(textattr)); } else if (vga->pvt->blink_state) { /* Blinking, but in on state so it appears normal */ fg = GETFG(textattr); bg = GETBG(textattr); if (vga->pvt->blink_timeout_id == -1) vga_start_blink_timer(vga); } else { /* Hide, blink off state */ fg = GETBG(textattr); bg = GETBG(textattr); if (vga->pvt->blink_timeout_id == -1) vga_start_blink_timer(vga); } if (vga->pvt->fg != fg) { #ifdef USE_DEPRECATED_GDK gdk_gc_set_rgb_fg_color(vga->pvt->gc, vga_palette_get_color(vga->pvt->pal, fg)); #else /* Nothing we can really do like this */ #endif vga->pvt->fg = fg; } if (vga->pvt->bg != bg) { #ifdef USE_DEPRECATED_GDK gdk_gc_set_rgb_bg_color(vga->pvt->gc, vga_palette_get_color(vga->pvt->pal, bg)); #else #endif vga->pvt->bg = bg; } }