docs/tutorial/pygame.rst
raw| 1 | Integration with Pygame |
| 2 | ======================= |
| 3 | |
| 4 | https://www.pygame.org |
| 5 | |
| 6 | Pygame & ImageSurface |
| 7 | --------------------- |
| 8 | |
| 9 | Creating a pygame.image from an ImageSurface: |
| 10 | |
| 11 | .. code:: python |
| 12 | |
| 13 | import pygame |
| 14 | import cairo |
| 15 | |
| 16 | width, height = 255, 255 |
| 17 | surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) |
| 18 | buf = surface.get_data() |
| 19 | image = pygame.image.frombuffer(buf, (width, height), "ARGB") |