[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] BLEND_RGBA_MULT bug on Macintosh?
> Try convert_alpha on alpha_corner.jpg as well.
Yes! That does work around the problem. Thank you!
---
James Paige
On Wed, Dec 10, 2008 at 07:54:27PM -0800, Lenard Lindstrom wrote:
> Hi James,
>
> I don't have this problem with my antiquated PC. It is an endian issue,
> sort of. The rgba mult code is faulty. For a 4 byte source and
> destination surface the blit assumes both have identical masks. Not
> true. For my Intel machine I get this:
>
> Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
> (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pygame
> >>> s = pygame.image.load('alpha_corner.png')
> >>> s.get_masks()
> (255, 65280, 16711680, -16777216)
> >>> t = pygame.Surface((10,10), pygame.SRCALPHA, 32)
> >>> t.get_masks()
> (16711680, 65280, 255, -16777216)
> (6, 0)
> >>> pygame.display.set_mode()
> <Surface(1024x768x24 SW)>
> >>> k = pygame.image.load('kitten.jpg').convert_alpha()
> >>> k.get_masks()
> (16711680, 65280, 255, -16777216)
> >>> pygame.LIL_ENDIAN
> 1234
> >>> pygame.get_sdl_byteorder()
> 1234L
> >>> k2=pygame.image.load('kitten.jpg')
> >>> k2.get_masks()
> (255, 65280, 16711680, 0)
>
> So if the pygame.image.load or pygame.Surface.convert_alpha() reversed
> its byte order to match the machine while the other didn't one would get
> opaque yellow for transparent_white * opaque_white. But the revered rgb
> component order for a loaded image and a stock 4 byte surface is still a
> problem for BLEND_RGBA_MULT on little-endian machines.
>
> Try convert_alpha on alpha_corner.jpg as well.
>
> Lenard
>
> James Paige wrote:
> >Hey, has anybody else had problems with blitting alpha transparent
> >surfaces using BLEND_RGBA_MULT on Mac OS X? I have some code that works
> >perfectly on Linux and Windows XP, but when I try it on my Mac, I get
> >yellow areas where I should be getting transparent areas.
> >
> >I have posted a more detailed description along with a test case at
> >http://pygame.motherhamster.org/bugzilla/show_bug.cgi?id=26
> >
> >I would greatly appreciate it if anyone else using a Mac could test and
> >see if they get the same results
> >
> >---
> >James Paige
> >
>
>
> --
> Lenard Lindstrom
> <len-l@xxxxxxxxx>
>
>