Rendering Outlined Text in Ebitengine
lmika.org·5h
✏️Inkscape
Preview
Report Post

For anyone else using the Ebitengine that wants to render text as an outline, I’ve had had some success using the shapes package. The approach that worked for me was to render the text to a separate image, then call ApplyOutline using the screen as the target.

Here’s some very unoptimised code demonstrating this:

func (f *State) Draw(screen *ebiten.Image) {
// The image holding the rendered text
img := ebiten.NewImage(screen.Bounds().Dx(), screen.Bounds().Dy())

// The filled in text colour. Here it's set to red. As far as I can tell,
// this has no effect on the rendered outline.
col := ebiten.ColorScale{}
col.Scale(1, 0, 0, 1)

pos := ebiten....

Similar Posts

Loading similar posts...