nanogui: Drawing transparent bitmaps
Subject:
Drawing transparent bitmaps
From:
"Uwe Klatt" ####@####.####
Date:
27 Feb 2007 08:48:49 +0000
Message-Id: <002301c75a4c$05e3ad90$081710ac@arnstein.miwe.de>
Hello,
today I modified the fb16 graphic driver for displaying transparent bitmaps.
I want to know if somebody knows a "better" solution for this "problem".
In my application I use bmp files for user interface and normally there is
no transparency feature available for this file format.
I decided to use WHITE (all Bits ON) for transparency.
Then I used the existing ROP-Mode MWROP_SRC_OVER.
This ROP is not used at the moment.
I had to modify only two functions:
linear16_blit and linear16_stretchblit
You can find both in fblin16.c
In linear16_blit I replaced
applyOp(MWROP_TO_MODE(op), *src, dst, ADDR16);
with
if(op == MWROP_SRC_OVER) {
if(*src != 0xFFFF)
*dst = *src;
}
else
applyOp(MWROP_TO_MODE(op), *src, dst, ADDR16);
and in linear16_stretchblit I replaced
*dst++ = pixel;
with
if((op == MWROP_SRC_OVER) && (pixel == 0xFFFF))
dst++;
else
*dst++ = pixel;
Bye
Uwe