[pygame] Blitting image with alpha channel on a transparent background

2010-04-22 Thread stas zytkiewicz
Hello, I hope that someone can point me in the right direction. I have a semi transparent background surface created with set_alpha(100). On this surface I want to blit an png image which has a alpha channel. The problem is that when I blit the png image surface to the background surface the png

Re: [pygame] Blitting image with alpha channel on a transparent background

2010-04-22 Thread Lee Buckingham
If there's no images being displayed behind the background image, then there isn't a need for it to have an alpha value at all, since you'd never see anything through it anyway. As far as the alpha goes, my guess is that you're getting hung up because you've mixed two different alpha modes.

Re: [pygame] Blitting image with alpha channel on a transparent background

2010-04-22 Thread stas zytkiewicz
On Thu, Apr 22, 2010 at 6:56 PM, Lee Buckingham lee.bucking...@gmail.com wrote: As far as the alpha goes, my guess is that you're getting hung up because you've mixed two different alpha modes.  There's some caveats about using per-pixel alpha (like the .png file probably has) and the other

Re: [pygame] Blitting image with alpha channel on a transparent background

2010-04-22 Thread Lee Buckingham
Instead of using set_alpha(), try using a fill, like: backgroundsurface.fill((0,0,0,100)) that should make the background use per-pixel alpha too, since there's a fourth number in the color (for alpha) so blitting another per-pixel alpha image shouldn't cause problems. Hmm... maybe I'll try

Re: [pygame] Blitting image with alpha channel on a transparent background

2010-04-22 Thread Lee Buckingham
yeah, that worked for me, here's my (messy) example code: import pygame from pygame.locals import * import os pygame.init() screen = pygame.display.set_mode((100,100)) screen.fill([0, 0, 0]) # blank the screen. #random image fartherback = pygame.image.load(os.path.join(Images,

Re: [pygame] Blitting image with alpha channel on a transparent background

2010-04-22 Thread Greg Ewing
Lee Buckingham wrote: Instead of using set_alpha(), try using a fill, like: backgroundsurface.fill((0,0,0,100)) Note that you will also have to create the background surface with the SRCALPHA flag, so that it will have a per-pixel alpha channel. If you don't use that flag, then the surface

[pygame] Pygame, PyOpenGl, and py2exe, OH MY!

2010-04-22 Thread Keith Nemitz
I spent the day in py2exe hell. After grinding through six separate problems, now I'm stuck. Has anyone got this combo to work? I'm using Python 2.6 and Pygame 1.9.x and pyOpenGl 3.0.x and the latest py2exe. When I run the resulting exe, I get the following runtime error: Traceback (most

Re: [pygame] Pygame, PyOpenGl, and py2exe, OH MY!

2010-04-22 Thread Casey Duncan
What you are lacking is actually part of Python itself (or the stdlib): Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type help, copyright, credits or license for more information. import ctypes ctypes.pythonapi.PyString_AsString _FuncPtr

Re: [pygame] Blitting image with alpha channel on a transparent background

2010-04-22 Thread stas zytkiewicz
On Fri, Apr 23, 2010 at 2:59 AM, Greg Ewing greg.ew...@canterbury.ac.nz wrote: Lee Buckingham wrote: Instead of using set_alpha(), try using a fill, like:  backgroundsurface.fill((0,0,0,100)) Note that you will also have to create the background surface with the SRCALPHA flag, so that it