matrix.py 文件源码

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

项目:matrix 作者: bitcraft 项目源码 文件源码
def generate_images(font):
    # generate a scanline image to create scanline effect
    scanline = pygame.Surface((glyph_width, glyph_height), pygame.SRCALPHA)
    for y in range(0, glyph_height, 2):
        pygame.draw.line(scanline, (0, 0, 0, 128), (0, y), (glyph_width, y))

    # render all characters a head of time
    for char in charset:
        chars = list()
        cache.append(chars)
        for value in computed_values:
            color = calc_color(value)
            temp = font.render(char, 1, color)
            temp = pygame.transform.smoothscale(temp, (glyph_width, glyph_height))
            temp.blit(scanline, (0, 0))
            image = pygame.Surface(temp.get_size())
            image.blit(temp, (0, 0))
            chars.append(image)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号