It needed more blackjack and hookers to work correctly

This commit is contained in:
Sasha Koshka 2022-11-17 23:16:47 -05:00
parent 3cb0ac64fc
commit f55f98651f
1 changed files with 21 additions and 13 deletions

View File

@ -92,8 +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, _, _, ok := backend.font.face.Glyph ( destinationRectangle, mask, maskPoint, _, ok := backend.font.face.Glyph (
fixed.Point26_6 { }, fixed.Point26_6 {
X: fixed.I(origin.X),
Y: fixed.I(origin.Y),
},
character) character)
if !ok { if !ok {
@ -115,22 +118,27 @@ func (backend *Backend) drawRune (
backend.boundsOfCell(x, y)) backend.boundsOfCell(x, y))
} }
origin.Y += destinationRectangle.Min.Y - backend.metrics.descent backend.sprayRuneMask (
backend.sprayRuneMask(mask, origin, backend.colors[runeColor]) mask, destinationRectangle,
maskPoint, backend.colors[runeColor])
} }
func (backend *Backend) sprayRuneMask ( func (backend *Backend) sprayRuneMask (
mask image.Image, mask image.Image,
at image.Point, bounds image.Rectangle,
fill xgraphics.BGRA, maskPoint image.Point,
fill xgraphics.BGRA,
) { ) {
bounds := mask.Bounds().Max maxX := bounds.Max.X - bounds.Min.X
for y := 0; y < bounds.Y; y ++ { maxY := bounds.Max.Y - bounds.Min.Y
for x := 0; x < bounds.X; x ++ {
_, _, _, alpha := mask.At(x, y).RGBA() for y := 0; y < maxY; y ++ {
for x := 0; x < maxX; x ++ {
_, _, _,
alpha := mask.At(x + maskPoint.X, y + maskPoint.Y).RGBA()
backend.canvas.SetBGRA ( backend.canvas.SetBGRA (
x + at.X, x + bounds.Min.X,
y + at.Y, y + bounds.Min.Y - backend.metrics.descent,
xgraphics.BlendBGRA ( xgraphics.BlendBGRA (
backend.colors[stone.ColorBackground], backend.colors[stone.ColorBackground],
xgraphics.BGRA { xgraphics.BGRA {