On 26 Nov 2002 14:31:04 +0100 Sven Neumann <[EMAIL PROTECTED]> babbled:
> Hi,
>
> Carsten Haitzler (The Rasterman) <[EMAIL PROTECTED]> writes:
>
> > destination has an alpha channel but has been willed with a solid white
> > rectangle (RGBA: 0xff,0xff,0xff,0xff)
> > source has an icon - lets say like the gnome png icons so it has a soft drop
> > shadow where the transparency gradually changes from opaque to transparent
> > at the edges of the icon to show a shadow.
> >
> > when we blend this icon onto the destination, parts of the destination image
> > approximately where the alpha pixel values of the icon is about 0x80 the
> > alpha channel of the destination starts becomming less than 0xff (ie i am
> > guessing about 0xc0 by visual inspection).
> >
> > well - as we can imagine, this is NOT the desired effect. when you blend
> > something on top a completely solid image, you don't want it starting to
> > become transparent! :)
>
> the behaviour of the blending operation depends on the BlendFunctions
> you choose for source and destination surface. It seems that the
> default behaviour is not what you want, but you are free to use
> IDirectFB::SetBlendFunction to modify it. If I understand you
> correctly, you are seeking for a saturating blend. IIRC, that would be
> DSBF_SRCALPHA on the source and DSBF_INVSRCALPHA on the destination
> surface.
actually its INVSRCALPHA on the source and SRCALPHA on the destination...
BUT this is what dfb was already doing by default:
flags = DSBLIT_BLEND_COLORALPHA | DSBLIT_BLEND_ALPHACHANNEL;
re->backbuf->SetBlittingFlags(re->backbuf, flags);
re->backbuf->StretchBlit(re->backbuf, img, &inrect, &outrect);
this is doign the operation.. and is *ALMOST* right.. BUT
the alpha values of the destination behave like this:
just before blend destination alpha pixel is 255.
dstA
255|**** *****
| *** ***
192| ** **
| *
128|
|
64|
|
0|
+--------------------
0 64 128 192 255
srcA
as you can see as the source alpha approaches about 128 (half) the destination
alpha starts going down from 255 - it should NOT go down, ever once it has
reached 255. it can only increase. this seems to be a side-effect of the
algorithm being used and i'm seeing if i can get some clarification on the
algorithm instead of trawling through code for it. :)
--
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
The Rasterman (Carsten Haitzler) [EMAIL PROTECTED]
[EMAIL PROTECTED]
Mobile Phone: +61 (0)413 451 899 Home Phone: 02 9698 8615
--
Info: To unsubscribe send a mail to [EMAIL PROTECTED] with
"unsubscribe directfb-dev" as subject.