def image_at(self, rect, colorkey=None, x_mirror=False, y_mirror=False, rotation=0):
'''
Load image at rect
'''
rect = pygame.Rect(rect)
image = pygame.Surface(rect.size).convert()
image.blit(self.sheet, (0, 0), rect)
if x_mirror or y_mirror:
image = pygame.transform.flip(image, x_mirror, y_mirror)
if rotation > 0:
image = pygame.transform.rotate(image, rotation)
# Determine the color key after transforms. Fix for weird graphics issue
# in pygame_sdl2 refs #62
if colorkey is not None:
if colorkey is -1:
colorkey = image.get_at((0, 0))
image.set_colorkey(colorkey, pygame.RLEACCEL)
return image
评论列表
文章目录