MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / draw_image

Function draw_image

PythonAPI/examples/synchronous_mode.py:93–101  ·  view source on GitHub ↗
(surface, image, blend=False)

Source from the content-addressed store, hash-verified

91
92
93def 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
104def get_font():

Callers 1

mainFunction · 0.85

Calls 1

make_surfaceMethod · 0.80

Tested by

no test coverage detected