aboutsummaryrefslogtreecommitdiff
path: root/bdf
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-06-09 23:16:50 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-06-09 23:18:06 +0200
commit9734cdd16e1b7572464dfaed3bd03a70db46a3d3 (patch)
tree470162274d9ef41184440ac40268b55c4550b118 /bdf
parent8215b59834d8a02cb43d34c55d9604dda7749cfd (diff)
downloadsklad-9734cdd16e1b7572464dfaed3bd03a70db46a3d3.tar.gz
sklad-9734cdd16e1b7572464dfaed3bd03a70db46a3d3.tar.xz
sklad-9734cdd16e1b7572464dfaed3bd03a70db46a3d3.zip
bdf: make it possible to set the drawing colour
Intended for red and black tapes.
Diffstat (limited to 'bdf')
-rw-r--r--bdf/bdf.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/bdf/bdf.go b/bdf/bdf.go
index 5ff8f30..2d94b6c 100644
--- a/bdf/bdf.go
+++ b/bdf/bdf.go
@@ -66,11 +66,13 @@ func (f *Font) FindGlyph(r rune) (glyph, bool) {
// DrawString draws the specified text string onto dst horizontally along
// the baseline starting at dp, using black color.
-func (f *Font) DrawString(dst draw.Image, dp image.Point, s string) {
+func (f *Font) DrawString(dst draw.Image, dp image.Point,
+ color color.Color, s string) {
+ src := image.NewUniform(color)
for _, r := range s {
g, _ := f.FindGlyph(r)
draw.DrawMask(dst, g.bounds.Add(dp),
- image.Black, image.ZP, &g, g.bounds.Min, draw.Over)
+ src, image.ZP, &g, g.bounds.Min, draw.Over)
dp.X += g.advance
}
}