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

[pygame] BUG: Color order reversed on Windows



Hi pygame devs-

I'm running Pygame 1.9.1release on top of SDL 1.2.13 on Windows 8.1. ÂWhen I set a pixel on a Surface object (with set_at()), and then read the modified pixel back out (with get_at()), the red and blue channels have been exchanged. ÂA minimal demonstration script is attached.

For what it's worth, displaying Surfaces works correctly: if I load an image file to a Surface and then display it, it looks correct. ÂHowever, if I modify the surface (using Surface.set_at()), the modified pixels also display with their red and blue channels exchanged.

Thanks,
Ben Withbroe


import pygame

pygame.init()

print "Pygame version", pygame.version.ver
print "SDL version", pygame.get_sdl_version()

filename = 'background2.jpg'
surface = pygame.image.load(filename)
r = 35
g = 120
b = 180
surface.set_at((400, 15), pygame.Color(r, g, b))
result = surface.get_at((400, 15))

print "Intended color:", r, g, b
print "Instead got:   ", result.r, result.g, result.b

Attachment: background2.jpg
Description: JPEG image