Pygameで画像処理1
画像処理でもなんでもない気がしますが…。
回転処理などを。
import pygame _gSrc = None # Image Ratation def drawRote(buf, x, y, angle): srcSize = tBuf.get_size() tmpBuf = pygame.transform.rotate(tBuf, angle) dstSize = tmpBuf.get_size() x -= (srcSize[0] / 2) y -= (srcSize[1] / 2) p = ((srcSize[0] - dstSize[0]) / 2 + x, (srcSize[1] - dstSize[1]) / 2 + y) _gScr.blit(tmpBuf, p, tmpBuf.get_rect()) pygame.init() pygame.display.set_mode((150, 150), 0, 32) pygame.display.set_caption("画像回転") _gScr = pygame.display.get_surface() tBuf = pygame.image.load("kenmo.jpg").convert() i = 0 while True: i += 1 drawRote(tBuf, 75, 75, i) pygame.display.update() pygame.time.wait(10)