pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
applies_alpha()

applies_alpha() -

josmiley (josmiley)

Tags:

Description

not a project, just a trick
how to applies alpha channel from a surface to another ?
surface1 and surface2 must have the same size

from pygame import *
def applies_alpha(surface1,surface2):
#return a surface
#applies the alpha channel from surface1 to surface2
output = surface2.copy().convert_alpha()
surfarray.pixels_alpha(output)[:] = surfarray.array_alpha(surface1)[:]
return output

def applies_alpha_ip(surface1,surface2):
#applies the alpha channel in place from surface1 to surface2
  surfarray.pixels_alpha(surface2)[:] = surfarray.array_alpha(surface1)

Links

Home Page: http://www.pygame.org/

Screenshot


click to view original size

Releases

applies_alpha() -  - Sep 7, 2010

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

No user comments have been submitted.
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Apr 16, 2014


Apr 13, 2014

Apr 9, 2014

Mar 18, 2014


Mar 15, 2014


Mar 14, 2014

Mar 13, 2014

Mar 11, 2014

Mar 9, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)