pygame:我如何遮蔽/ blit图像的非矩形部分?

时间:2012-06-15 23:26:08

标签: pygame blit

所以我知道如何遮挡图像。我知道如何blit图像的矩形部分。但是,比如三角形呢?还是一个梯形? (例如http://i.imgur.com/Gtwhs.png

1 个答案:

答案 0 :(得分:0)

在我问这个问题后一分钟,我至少想出了如何遮阴。这不总是这样吗?

无论如何,它基本上归结为:

surface.blit(image, pos, area)
pygame.draw.polygon(surface, (0,0,0,128), pointlist, 0)

其中128是您想要的任何alpha值,pointlist是您想要的部分周围的顶点列表。

相关问题