我有几种字体,我想使用它们基本上是字母的轮廓,但内部是透明的。我将如何仅用颜色填充这些字体的内部区域?我怀疑它会使用特殊的 blitting RGBA_BLEND 模式,但我不熟悉它们的功能。
这是我正在使用的字体示例:https : //www.dafont.com/fipps.font?back=bitmap
现在,我只是将字体渲染到表面上,为此我编写了一个辅助函数。理想情况下,我能够将其集成到我的功能中。
def renderText(surface, text, font, color, position):
x, y = position[0], position[1]
width, height = font.size(text)
position = x-width//2, y-height//2
render = font.render(text, 1, color)
surface.blit(render, position)
Run Code Online (Sandbox Code Playgroud)
非常感谢您能给我的任何帮助!