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

Re: [pygame] Surface.blit() BLEND_ADD vs. BLEND_RGBA_ADD



Florian Berger wrote:

Would it be better to have a BLEND_ADD_PREMULT blit mode instead, i.e.
put the premultiplication in the blitting code?

Not sure that would be the best name for it, since it could
be taken as meaning that the image you give it is already
premultiplied.

Also, it would solve this particular person's problem, but
then someone is going to want BLEND_SUB_PREMULT, etc. etc.

Rather than attacking the problem piecemeal, the whole
business of specifying blending modes really needs to be
rethought. There ought to be a set of orthogonal options
that can be combined, one of them being whether to multiply
by alpha or not. Also there needs to be a way of handling
the alpha channel differently from the others.

A good place to look for inspiration would be the OpenGL
fixed-function blending options. They're very flexible and
allow for just about anything you might reasonably want to
do.

--
Greg