[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, Brian Fisher wrote:

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

I guess we agree on that the current behaviour and docs are bad for this
case. How would I expect it to work?

BLEND_* behave like the current implementation but take the alpha into
account as well, if it exists for both surfaces. If it does only exist
for one, it will be ignored.
Thus e.g. BLEND_ADD would create the following results:

Both surfaces have alpha:
  (10, 20, 30, 40) + (20, 30, 40, 50) = (30, 50, 70, 90)

Only one has alpha:
  (10, 20, 30) + (20, 30, 40, 50) = (30, 50, 70 [, 50])

In the latter case the alpha value will stay the same, if the
destination has alpha, otherwise it will be silently ignored.

If no blending flags are passed and both surfaces have alpha, the current
alpha blending implementation will be used. Otherwise the blit will
behave as usual.

Is such a behaviour okay for anyone?

Regards
Marcus

Attachment: pgpVR9FMgQ1wI.pgp
Description: PGP signature