pygame aaline颜色在Mac上显示不正确

时间:2018-06-22 22:18:41

标签: macos colors pygame

我正在尝试使用pygame.draw.aaline在pygame中绘制抗锯齿线。

这是我的代码:

# shows color bug with aaline

import pygame
from pygame.locals import *


pygame.init()
screen = pygame.display.set_mode((100, 100))
pygame.display.set_caption("aaline color wrong bug")
screen.fill((0, 0, 0))  # black background

L1_COLOR = (255, 255, 255)  # white
L2_COLOR = (  0,   0, 255)  # blue

for y in range(10):  # draw 10 lines next to each other
    pygame.draw.aaline(screen, L1_COLOR, (25, 30 + y), (75, 30 + y), True)
    pygame.draw.aaline(screen, L2_COLOR, (25, 60 + y), (75, 60 + y), True)

# Problem:  white shows as yellow, and blue shows as black


pygame.display.update()

done = False
while not done:
    for e in pygame.event.get():
        if e.type == pygame.QUIT:
            done = True
        if e.type == KEYDOWN:
            if e.key in (K_ESCAPE, K_SYSREQ):
                done = True

我绘制10条白线以创建一条粗线,并绘制一条蓝线。但是运行时,白线为黄色,蓝线在黑色背景上为黑色。

此问题在Linux上不会发生,但在Mac上会发生。在运行10.13.5的Mac上使用Python 3.6当前pygame

有人知道发生了什么事吗?

0 个答案:

没有答案