def format_surface_render(self, surface):
resized_surface = pygame.transform.smoothscale(pygame.PixelArray(surface).make_surface(), (52, 68)) # (W, H)
formatted_array = np.zeros((68, 52), dtype="uint8")
for i in range(68):
for j in range(52):
red, green, blue, alpha = resized_surface.get_at((j, i)) # (x, y)
formatted_array[i, j] = int((red + green + blue) / 3)
return formatted_array
falldown.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录