Redid color system
This commit is contained in:
@@ -30,14 +30,14 @@ func (backend *Backend) updateWindowAreas (areas ...image.Rectangle) {
|
||||
backend.canvas.XPaintRects(backend.window.Id, areas...)
|
||||
}
|
||||
|
||||
func (backend *Backend) drawRune (x, y int, character rune) {
|
||||
func (backend *Backend) drawRune (x, y int, character rune, runeColor stone.Color) {
|
||||
// TODO: cache these draws as non-transparent buffers with the
|
||||
// application background color as the background. that way, we won't
|
||||
// need to redraw the characters *or* composite them.
|
||||
|
||||
fillRectangle (
|
||||
&image.Uniform {
|
||||
C: backend.config.Color(stone.ColorApplication),
|
||||
C: backend.config.Color(stone.ColorBackground),
|
||||
},
|
||||
backend.canvas,
|
||||
backend.boundsOfCell(x, y))
|
||||
@@ -65,7 +65,7 @@ func (backend *Backend) drawRune (x, y int, character rune) {
|
||||
backend.canvas,
|
||||
destinationRectangle,
|
||||
&image.Uniform {
|
||||
C: backend.config.Color(stone.ColorForeground),
|
||||
C: backend.config.Color(runeColor),
|
||||
},
|
||||
image.Point { },
|
||||
mask,
|
||||
@@ -86,7 +86,7 @@ func (backend *Backend) drawCells (forceRedraw bool) (areas []image.Rectangle) {
|
||||
if forceRedraw && content < 32 { continue }
|
||||
|
||||
areas = append(areas, backend.boundsOfCell(x, y))
|
||||
backend.drawRune(x, y, content)
|
||||
backend.drawRune(x, y, content, cell.Color())
|
||||
}}
|
||||
|
||||
if backend.drawBufferBounds && forceRedraw {
|
||||
|
||||
@@ -30,7 +30,7 @@ type Backend struct {
|
||||
face font.Face
|
||||
}
|
||||
|
||||
colors [4]xgraphics.BGRA
|
||||
colors [8]xgraphics.BGRA
|
||||
|
||||
metrics struct {
|
||||
windowWidth int
|
||||
@@ -125,7 +125,7 @@ func (backend *Backend) reallocateCanvas () {
|
||||
backend.metrics.windowWidth,
|
||||
backend.metrics.windowHeight))
|
||||
backend.canvas.For (func (x, y int) xgraphics.BGRA {
|
||||
return backend.colors[stone.ColorApplication]
|
||||
return backend.colors[stone.ColorBackground]
|
||||
})
|
||||
|
||||
backend.canvas.XSurfaceSet(backend.window.Id)
|
||||
|
||||
Reference in New Issue
Block a user