(surface, image, blend=False)
| 91 | |
| 92 | |
| 93 | def draw_image(surface, image, blend=False): |
| 94 | array = np.frombuffer(image.raw_data, dtype=np.dtype("uint8")) |
| 95 | array = np.reshape(array, (image.height, image.width, 4)) |
| 96 | array = array[:, :, :3] |
| 97 | array = array[:, :, ::-1] |
| 98 | image_surface = pygame.surfarray.make_surface(array.swapaxes(0, 1)) |
| 99 | if blend: |
| 100 | image_surface.set_alpha(100) |
| 101 | surface.blit(image_surface, (0, 0)) |
| 102 | |
| 103 | |
| 104 | def get_font(): |