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

Re: [pygame] Fill doesn't seem to work as expected.



Thanks Ron, your use of the fill routine was correct and should have had the intended result, but did not, due to a bug.

The bug was in the CREATE_PIXEL macro. it was using the Aloss incorrectly, so it was taking the alpha value (255, even though it meant nothing in your case) and putting it in a random place in the color (in your instance, it was putting it in the green slot), adding unintended color into the pixel after doing the desired blend op.

fix committed rev. 1643


On Fri, Aug 29, 2008 at 1:51 PM, Ron Dippold <sizer@xxxxxxxxxx> wrote:
This is pygame 1.8.1 on WinXP, DX9.

I'm trying to dim the entire window for a pause screen. It seems like the logical way to do this would be to

  # screen = pygame.display.set_mode( (800,600), 0 )   at start of program
  screen.get_surface().fill( (100,100,100), None, BLEND_MULT )

but this results in everything being turned hideously green/cyan (and not dimmer at all). It doesn't seem to matter whether I use BLEND_RGB_MULT, BLEND_RGBA_MULT, or even ADD/SUB instead of MULT, or specify the rect instead of None.

What does work is to do:
       dim = pygame.Surface( screen.get_size() ).convert()
       dim.fill( ( 100, 100, 100 ) )
       screen.blit( dim, (0,0), None, BLEND_MULT )
which does exactly what I'd expect.

Am I missing something on the .fill method? I can use the workaround, so this is just curiosity.

Ron