Replaced orange with a dim/grey color

This commit is contained in:
Sasha Koshka 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,

View File

@ -8,8 +8,8 @@ type Color uint8
const (
ColorBackground Color = 0x0
ColorForeground Color = 0x1
ColorRed Color = 0x2
ColorOrange Color = 0x3
ColorDim Color = 0x2
ColorRed Color = 0x3
ColorYellow Color = 0x4
ColorGreen Color = 0x5
ColorBlue Color = 0x6

View File

@ -55,10 +55,10 @@ func (config *Config) load () {
color.RGBA { R: 0, G: 0, B: 0, A: 0 },
// foreground
color.RGBA { R: 0xFF, G: 0xFF, B: 0xFF, A: 0xFF },
// dim
color.RGBA { R: 0x80, G: 0x80, B: 0x80, A: 0xFF },
// red
color.RGBA { R: 0xFF, G: 0x00, B: 0x00, A: 0xFF },
// orange
color.RGBA { R: 0xFF, G: 0x80, B: 0x00, A: 0xFF },
// yellow
color.RGBA { R: 0xFF, G: 0xFF, B: 0x00, A: 0xFF },
// green
@ -154,10 +154,10 @@ func (config *Config) loadFile (path string) {
config.colors[ColorBackground] = valueColor
case "colorForeground":
config.colors[ColorForeground] = valueColor
case "colorDim":
config.colors[ColorDim] = valueColor
case "colorRed":
config.colors[ColorRed] = valueColor
case "colorOrange":
config.colors[ColorOrange] = valueColor
case "colorYellow":
config.colors[ColorYellow] = valueColor
case "colorGreen":