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

View File

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