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)
评论列表
文章目录