I made my own draw method with blackjack and hookers

This commit is contained in:
Sasha Koshka 2022-11-17 21:19:23 -05:00
parent 594d1d07be
commit 3cb0ac64fc
2 changed files with 31 additions and 20 deletions

View File

@ -92,15 +92,11 @@ func (backend *Backend) drawRune (
if character < 32 { return } if character < 32 { return }
origin := backend.originOfCell(x, y + 1) origin := backend.originOfCell(x, y + 1)
destinationRectangle, mask, maskPoint, _, ok := backend.font.face.Glyph ( destinationRectangle, mask, _, _, ok := backend.font.face.Glyph (
fixed.Point26_6 { fixed.Point26_6 { },
X: fixed.I(origin.X),
Y: fixed.I(origin.Y - backend.metrics.descent),
},
character) character)
if !ok { if !ok {
println("warning")
strokeRectangle ( strokeRectangle (
&image.Uniform { &image.Uniform {
C: backend.config.Color(stone.ColorForeground), C: backend.config.Color(stone.ColorForeground),
@ -119,16 +115,31 @@ func (backend *Backend) drawRune (
backend.boundsOfCell(x, y)) backend.boundsOfCell(x, y))
} }
draw.DrawMask ( origin.Y += destinationRectangle.Min.Y - backend.metrics.descent
backend.canvas, backend.sprayRuneMask(mask, origin, backend.colors[runeColor])
destinationRectangle, }
&image.Uniform {
C: backend.config.Color(runeColor), func (backend *Backend) sprayRuneMask (
}, mask image.Image,
image.Point { }, at image.Point,
mask, fill xgraphics.BGRA,
maskPoint, ) {
draw.Over) bounds := mask.Bounds().Max
for y := 0; y < bounds.Y; y ++ {
for x := 0; x < bounds.X; x ++ {
_, _, _, alpha := mask.At(x, y).RGBA()
backend.canvas.SetBGRA (
x + at.X,
y + at.Y,
xgraphics.BlendBGRA (
backend.colors[stone.ColorBackground],
xgraphics.BGRA {
R: fill.R,
G: fill.G,
B: fill.B,
A: uint8(alpha >> 8),
}))
}}
} }
func fillRectangle ( func fillRectangle (