def apply_perspective_surf(self, surf):
self.invert_surface(surf)
data = pygame.image.tostring(surf, 'RGBA')
img = Image.fromstring('RGBA', surf.get_size(), data)
img = img.transform(img.size, self.affinestate.proj_type,
self.affinestate.sample_transformation(img.size),
Image.BICUBIC)
img = img.transform(img.size, self.perspectivestate.proj_type,
self.perspectivestate.sample_transformation(img.size),
Image.BICUBIC)
im = n.array(img)
# pyplot.imshow(im)
# pyplot.show()
surf = pygame.surfarray.make_surface(im[...,0:3].swapaxes(0,1))
self.invert_surface(surf)
return surf
评论列表
文章目录