[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Unexpect blit behavior when using BLEND_ADD



On Thu, Apr 17, 2008 at 10:41 AM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
The documentation is vague on this. It just says that BLEND_ flags are optional. Nothing is mentioned about them being ignored.

Even if the docs explicitly said "the special flags are ignored for surfaces with alpha" I would still argue that it is useless and confusing behavior to ignore these flags in the case of being used with a surface with alpha, and the behavior (and docs) should be changed. If they use the flags they are asking for a behavior which is incompatible with the behavior without them, in terms of functionality. It's not like "HW_SURFACE" or other flags where you can ignore the flag and get the same behavior (with worse performance), the blend modes are really asking for something quite different than conventional multiplicative blending
 

For alpha surfaces a blend may be useful for doing shadow effects. Such effects require extracting and altering the alpha plane. Want to make a shadow for antialiased text. Extract the alpha and apply to an all black surface. Right now surfarray must be used to do this in a practical way. Otherwise it would have to be done per-pixel with get_at/set_at.

I'm curious - how exactly would you expect to be able to extract the alpha channel from a font char and apply it to a black surface using the blit flags? BLEND_MAX? Is there a technique that would also work for a surface with arbitrary color values?