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 }
origin := backend.originOfCell(x, y + 1)
destinationRectangle, mask, maskPoint, _, ok := backend.font.face.Glyph (
fixed.Point26_6 {
X: fixed.I(origin.X),
Y: fixed.I(origin.Y - backend.metrics.descent),
},
destinationRectangle, mask, _, _, ok := backend.font.face.Glyph (
fixed.Point26_6 { },
character)
if !ok {
println("warning")
strokeRectangle (
&image.Uniform {
C: backend.config.Color(stone.ColorForeground),
@ -119,16 +115,31 @@ func (backend *Backend) drawRune (
backend.boundsOfCell(x, y))
}
draw.DrawMask (
backend.canvas,
destinationRectangle,
&image.Uniform {
C: backend.config.Color(runeColor),
},
image.Point { },
mask,
maskPoint,
draw.Over)
origin.Y += destinationRectangle.Min.Y - backend.metrics.descent
backend.sprayRuneMask(mask, origin, backend.colors[runeColor])
}
func (backend *Backend) sprayRuneMask (
mask image.Image,
at image.Point,
fill xgraphics.BGRA,
) {
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 (