我想用pygame工作1/3的屏幕,但是怎么样?

时间:2013-08-07 20:44:56

标签: pygame

我正在使用pygame。我有一个背景图片(大小= 600,600),我想给图片模糊效果,但不是全图。我想给模糊效果只有1/3图片(尺寸= 600,200)。我希望2/3的图片不模糊。我怎样才能做到这一点?不是:我知道模糊效果,我只想学习分屏?

1 个答案:

答案 0 :(得分:0)

假设您希望模糊底部三分之一。您将不得不做类似以下的事情:

#background is the background picture
blurred=pygame.Surface((600, 200))
temprect=background.get_rect()
temprect.top=400
blurred.blit(background, temprect)
#blur "blurred" here
temprect=blurred.get_rect()
temprect.top=400
background.blit(blurred, temprect)

这应该有效,但如果没有,请告诉我。