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

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



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 it out too.

-Lee-



On Thu, Apr 22, 2010 at 12:46 PM, stas zytkiewicz <stas.zytkiewicz@xxxxxxxxx> wrote:
On Thu, Apr 22, 2010 at 6:56 PM, Lee Buckingham
<lee.buckingham@xxxxxxxxx> 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 modes (color
> key or single value alpha like you've got).
That's my guess to and as I'm no alpha stuff expert I turned to this list.

> So i'd first try just eliminating the transparency on the background, if in
> fact there's nothing behind it anyway.
I want to create a semi transparent GUI button with a solid image or text
so transparency of the background is the whole purpose :-)