python pygame blit - 混合像素 - 添加黑色矩形

时间:2014-05-05 12:21:18

标签: python pygame blit pygame-surface

在使用国际象棋引擎时,我正在使用blit在棋盘上绘制棋子。 问题是它看起来很糟糕,创建一个黑色矩形并添加到 图标的碎片。它看起来像那样:

http://i58.tinypic.com/n1fbzc.jpg

但我希望它看起来像这样:

http://i62.tinypic.com/4zutfo.jpg

这里是代码,前两行是一件的例子, 其余的(“for”)用于绘制所有这些:

    white_queen = pygame.image.load(os.path.join("images","wQn.png")).convert()
    self.icons['wQ'] = pygame.transform.scale(white_queen, (self.square_size,self.square_size))

    for r in range(boardSize):
        for c in range(boardSize):
            print "r is " + str(r) + ", and c is " + str(c)
            (screenX,screenY) = self.ConvertToScreenCoords((r,c))
            piece_name = board[r][c]
            print "screen x is " + str(screenX) + ", and y is " + str(screenY)
            print "name is " + piece_name
            if piece_name != 'e':
                self.screen.blit(self.icons[piece_name],(screenX,screenY), special_flags = BLEND_RGBA_MULT)

    pygame.display.flip()

我想我在调用blit或调用另一个函数时缺少一些参数..

谢谢你的帮助。

0 个答案:

没有答案