Mercurial > pygame
diff examples/pixelarray.py @ 2244:2fbf3c27fdaa
Incidental PixelArray updates
| author | Lenard Lindstrom <len-l@telus.net> |
|---|---|
| date | Mon, 06 Jun 2011 19:31:38 +0000 |
| parents | c0d170c1e636 |
| children |
line wrap: on
line diff
--- a/examples/pixelarray.py Mon Jun 06 11:09:06 2011 +0000 +++ b/examples/pixelarray.py Mon Jun 06 19:31:38 2011 +0000 @@ -78,6 +78,15 @@ del ar show (surface) + # Rotate 90 degrees clockwise. + w, h = surface.get_size () + surface2 = pygame.Surface ((h, w), surface.get_flags (), surface) + ar = pygame.PixelArray (surface) + ar2 = pygame.PixelArray (surface2) + ar2[...] = ar.transpose ()[::-1,:] + del ar, ar2 + show (surface2) + # Scale it by throwing each second pixel away. surface = pygame.image.load (os.path.join (data_dir, 'arraydemo.bmp')) ar = pygame.PixelArray (surface)
