Quoting Ville Syrjälä: > On Mon, Nov 21, 2005 at 03:30:01AM +0100, [EMAIL PROTECTED] wrote: > > > > I've confirmed that the Object surfaces contain alpha layers. The > > problem I have encountered now is while Blitting these surfaces to the > > window surface, pixels with values between completely transparent and > > completely opaque affect the window surface's alpha layer. I have read > > the mailing list archives and found Rasterman running into the same > > problem, however he never received a response, that I could find > > anyway. > > > > http://www.directfb.org/index.php/mailinglists/directfb-dev/2002/11-2002/msg00129.html > > > > I have thought about Lock()ing the surface and manually blending all > > other surfaces, but I'd rather not if I am simply missing a > > BlendingFunction or something along those lines. > > Any help on this issue would be greatly appreciated. > > What you probably want is > surface->SetSrcBlendFunction( surface, DSBF_ONE ); > surface->SetDstBlendFunction( surface, DSBF_INVSRCALPHA ); > surface->SetBlittingFlags( surface, DSBLIT_SRC_PREMULTIPLY ); > > The source alpha will still affect the destination alpha by making it > slightly more opaque.
Yes, that's the true Porter/Duff SrcOver. You'll still want DSBLIT_BLEND_ALPHACHANNEL additionally though. If you have an already premultiplied source, you don't need the PREMULTIPLY flag which will most probably give you acceleration. This flag is quite new and is not yet supported by any driver AFAIK. For Matrox it might be supported using the second texture stage. Otherwise, at least in case of DSBF_ONE for the source, we could use SRC_ALPHA for the color channels and ONE for the alpha channel. It should also be supported by Radeon and GeForce hardware. Would be nice to add it to the drivers. The font rendering uses PREMULTIPLY automatically now, if the source font surface is not premultiplied. If the font-format option is set to ARGB it will load the font premultiplied. So you'll get hardware accelerated true Porter/Duff SrcOver font rendering with ARGB font format. The window stacking code also has some handling for premultiplied windows now. But it's only interesting, if you have a display layer with an alpha channel that is of importance, e.g. OSD, and if you have overlapping half transparent windows. In this case true SrcOver is better. -- Best regards, Denis Oliver Kropp .------------------------------------------. | DirectFB - Hardware accelerated graphics | | http://www.directfb.org/ | "------------------------------------------" _______________________________________________ directfb-dev mailing list [email protected] http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
