在Pygame中旋转图像,同时保持平滑边缘

mr.*_*Shu 4 python pygame smooth image

我想旋转图像并保持边缘光滑。

看起来像这样

原始图像

旋转后

旋转图像

我正在使用的代码如下所示

def rot_center(self, image, angle):
   """rotate an image while keeping its center and size"""
   orig_rect = image.get_rect()
   rot_image = pygame.transform.rotate(image, angle)
   rot_rect = orig_rect.copy()
   rot_rect.center = rot_image.get_rect().center
   rot_image = rot_image.subsurface(rot_rect).copy()
   return rot_image
Run Code Online (Sandbox Code Playgroud)

我做错了什么吗?

nin*_*key 6

尝试使用pygame.transform.rotozoom,缩放比例为。1.它表示已过滤,我认为这意味着AA。