Replaced orange with a dim/grey color

This commit is contained in:
2022-11-18 19:46:50 -05:00
parent f55f98651f
commit 9a8bb85afc
3 changed files with 43 additions and 9 deletions

View File

@@ -118,9 +118,17 @@ func (backend *Backend) drawRune (
backend.boundsOfCell(x, y))
}
backend.sprayRuneMask (
mask, destinationRectangle,
maskPoint, backend.colors[runeColor])
// cue a series of pointless optimizations
alphaMask, isAlpha := mask.(*image.Alpha)
if isAlpha {
backend.sprayRuneMaskAlpha (
alphaMask, destinationRectangle,
maskPoint, backend.colors[runeColor])
} else {
backend.sprayRuneMask (
mask, destinationRectangle,
maskPoint, backend.colors[runeColor])
}
}
func (backend *Backend) sprayRuneMask (
@@ -150,6 +158,32 @@ func (backend *Backend) sprayRuneMask (
}}
}
func (backend *Backend) sprayRuneMaskAlpha (
mask *image.Alpha,
bounds image.Rectangle,
maskPoint image.Point,
fill xgraphics.BGRA,
) {
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.AlphaAt(x + maskPoint.X, y + maskPoint.Y).A
backend.canvas.SetBGRA (
x + bounds.Min.X,
y + bounds.Min.Y - backend.metrics.descent,
xgraphics.BlendBGRA (
backend.colors[stone.ColorBackground],
xgraphics.BGRA {
R: fill.R,
G: fill.G,
B: fill.B,
A: alpha,
}))
}}
}
func fillRectangle (
source image.Image,
destination draw.Image,