pygame.transform

pygame.transform

对surface进行变换的pygame模块

Surface的变换是指移动或者缩放像素的操作。所有的这类函数都有一个Surface参数作为操作对象,并返回一个新的Surface作为操作的结果。

Some of the transforms are considered destructive. These means every time they are performed they lose pixel data. Common examples of this are resizing and rotating. For this reason, it is better to retransform the original surface than to keep transforming an image multiple times. (For example, suppose you are animating a bouncing spring which expands and contracts. If you applied the size changes incrementally to the previous images, you would lose detail. Instead, always begin with the original image and scale to the desired size.)

1. pygame.transform.flip

垂直和水平翻转

pygame.transform.flip(Surface, xbool, ybool): return Surface

2. pygame.transform.scale

缩放到新的大小

pygame.transform.scale(Surface, (width, height), DestSurface = None): return Surface

3. pygame.transform.rotate

旋转图像

pygame.transform.rotate(Surface, angle): return Surface

4. pygame.transform.rotozoom

经过滤波的缩放和旋转

pygame.transform.rotozoom(Surface, angle, scale): return Surface

5. pygame.transform.scale2x

特殊的图像2倍放大

pygame.transform.scale2x(Surface, DestSurface = None): Surface

6. pygame.transform.chop

图像剪切

pygame.transform.chop(Surface, rect): return Surface

The end

pygame.transform (2008-02-23 15:34:17由localhost编辑)