diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-06-09 23:16:50 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-06-09 23:18:06 +0200 |
commit | 9734cdd16e1b7572464dfaed3bd03a70db46a3d3 (patch) | |
tree | 470162274d9ef41184440ac40268b55c4550b118 /label | |
parent | 8215b59834d8a02cb43d34c55d9604dda7749cfd (diff) | |
download | sklad-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 'label')
-rw-r--r-- | label/label.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/label/label.go b/label/label.go index 63c600e..7e4b34f 100644 --- a/label/label.go +++ b/label/label.go @@ -2,6 +2,7 @@ package label import ( "image" + "image/color" "image/draw" "strings" @@ -19,7 +20,7 @@ func GenLabelForHeight(font *bdf.Font, textRect, _ := font.BoundString(text) textImg := image.NewRGBA(textRect) draw.Draw(textImg, textRect, image.White, image.ZP, draw.Src) - font.DrawString(textImg, image.ZP, text) + font.DrawString(textImg, image.ZP, color.Black, text) scaledTextImg := imgutil.Scale{Image: textImg, Scale: scale} scaledTextRect := scaledTextImg.Bounds() @@ -93,7 +94,7 @@ func GenLabelForWidth(font *bdf.Font, for i, line := range lines { textImg := image.NewRGBA(rects[i]) draw.Draw(textImg, rects[i], image.White, image.ZP, draw.Src) - font.DrawString(textImg, image.ZP, line) + font.DrawString(textImg, image.ZP, color.Black, line) scaledImg := imgutil.Scale{Image: textImg, Scale: scale} scaledRect := scaledImg.Bounds() |