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

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



On Thu, Dec 15, 2011 at 3:18 PM, Florian Berger <fberger@xxxxxxxxxxxxxxxxx> wrote:
Hi,

I am toying around with the above blitting flags. I am blitting a RGBA
sprite surrounded by transparent (i.e. alpha) pixels on a solid RGBA
surface (at least I suppose it is so, both are created from RGBA PNG
images).

In my test setup, there is no difference between BLEND_ADD and
BLEND_RGBA_ADD. I hoped that the latter would honor alpha transparency,
and not add color values of transparent pixels, but this seems not to
be the case. :-/

Has anyone played with this? What is the difference between these two
supposed to be?

Thanks!
       Florian
Hi,

I've never successfully gotten the blit flags to work *exactly* as I'd like.  If you want perfect control, use the blending modes inherent in a graphics API like OpenGL.

In PyGame, the most reliable way I've found to do this is to ensure that the surfaces actually do have alpha channels.  Simply call .convert_alpha() on each surface after you make your window.  This clears up most problems.

Ian