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.

as i mailed before, this doesn't work

i am blending bgsurface onto window_surface2. window_surface2 has a destination
alpha channel, and bgsurface has one too.

             window_surface2->SetBlittingFlags(window_surface2,
                                               DSBLIT_BLEND_ALPHACHANNEL);
             window_surface2->SetSrcBlendFunction(window_surface2,
                                                  DSBF_SRCALPHASAT);
             bgsurface->SetSrcBlendFunction(bgsurface, DSBF_SRCALPHA);
             window_surface2->StretchBlit(window_surface2, bgsurface,
                                          &inrect, &outrect);
             window_surface2->Flip(window_surface2, NULL, 0 );


as i have now (after much twiddling) found that I want was DSBF_SRCALPHASAT set
as src blend on the destination, BUT even this doesn't do the job right.

ok. here it is from first principles:

b = alpha blend operation
X = pixel source 1
Y = pixel source 2 & intermediate target
Z = destination pixel

i want the following "effect":

[1].
Y b Z, X b Z
(blend Y onto Z, then in a 2nd pass blend X onto Z)

but the problem is in order to have a "window" with contents floating above
other dfb windows and have this window have an alpha channel that looks like the
above operation happened we have to do:

[2].
X b Y, Y b Z

as you can see in [2], Y is modified in the process, and Y's alpha channel (and
RGB pixel data) gets modified as we go, so that once the [2] here is done the
outcome on the screen (Z) is the same as [1]. the problem is no matter how i try
playing with SRCALPHA, INVSRCALPHA and SRCALPHASAT nothing does the operation as
above.

(think of it in terms of gimp. we have 3 layers. a background image and 2
transparent layers on top. if i "merge" the 2 top layers the result on the
screen is identical to if i had them separate. this "merge" operation is what i
want. i can give you the actual pixel math for it, and have written it into evas
and imlib2 already. what i want to know is how to achieve this under directfb,
because none of the default modes or suggested methods work and produce correct
results - correct being the "merge" operation)

???

-- 
--------------- 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.

Reply via email to