下面的代码正在保存此image
import pygame
pygame.init()
font = pygame.font.SysFont('arialroundedbold.ttf', 60)
text = font.render("hello world", True, (0, 0, 0), (255, 255, 255))
pygame.image.save(text, "hello_world.png")
如何在文本“hello world”周围以特定的粗体(比如说3点)添加红色轮廓并保存
Tags:
如果要在字母周围画一个轮廓,请参见Have an outline of text in Pygame
如果要在文本框周围绘制轮廓,请定义轮廓的宽度和颜色:
创建一个比文本表面宽且高的^{} 是外线厚度的两倍:
用轮廓的颜色填充新的表面:
将文本表面在新< EM >表面:
最简单的例子:
相关问题 更多 >
编程相关推荐