surface_test.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Projects 作者: it2school 项目源码 文件源码
def todo_test_set_alpha(self):

        # __doc__ (as of 2008-08-02) for pygame.surface.Surface.set_alpha:

          # Surface.set_alpha(value, flags=0): return None
          # Surface.set_alpha(None): return None
          # set the alpha value for the full Surface image
          #
          # Set the current alpha value fo r the Surface. When blitting this
          # Surface onto a destination, the pixels will be drawn slightly
          # transparent. The alpha value is an integer from 0 to 255, 0 is fully
          # transparent and 255 is fully opaque. If None is passed for the alpha
          # value, then the Surface alpha will be disabled.
          #
          # This value is different than the per pixel Surface alpha. If the
          # Surface format contains per pixel alphas, then this alpha value will
          # be ignored. If the Surface contains per pixel alphas, setting the
          # alpha value to None will disable the per pixel transparency.
          #
          # The optional flags argument can be set to pygame.RLEACCEL to provide
          # better performance on non accelerated displays. An RLEACCEL Surface
          # will be slower to modify, but quicker to blit as a source.
          #

        s = pygame.Surface((1,1), SRCALHPA, 32)
        s.fill((1, 2, 3, 4))
        s.set_alpha(None)
        self.failUnlessEqual(s.get_at((0, 0)), (1, 2, 3, 255))
        self.fail()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号