I made my own draw method with blackjack and hookers
This commit is contained in:
parent
594d1d07be
commit
3cb0ac64fc
@ -92,15 +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, maskPoint, _, ok := backend.font.face.Glyph (
|
destinationRectangle, mask, _, _, ok := backend.font.face.Glyph (
|
||||||
fixed.Point26_6 {
|
fixed.Point26_6 { },
|
||||||
X: fixed.I(origin.X),
|
|
||||||
Y: fixed.I(origin.Y - backend.metrics.descent),
|
|
||||||
},
|
|
||||||
character)
|
character)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
println("warning")
|
|
||||||
strokeRectangle (
|
strokeRectangle (
|
||||||
&image.Uniform {
|
&image.Uniform {
|
||||||
C: backend.config.Color(stone.ColorForeground),
|
C: backend.config.Color(stone.ColorForeground),
|
||||||
@ -119,16 +115,31 @@ func (backend *Backend) drawRune (
|
|||||||
backend.boundsOfCell(x, y))
|
backend.boundsOfCell(x, y))
|
||||||
}
|
}
|
||||||
|
|
||||||
draw.DrawMask (
|
origin.Y += destinationRectangle.Min.Y - backend.metrics.descent
|
||||||
backend.canvas,
|
backend.sprayRuneMask(mask, origin, backend.colors[runeColor])
|
||||||
destinationRectangle,
|
}
|
||||||
&image.Uniform {
|
|
||||||
C: backend.config.Color(runeColor),
|
func (backend *Backend) sprayRuneMask (
|
||||||
},
|
mask image.Image,
|
||||||
image.Point { },
|
at image.Point,
|
||||||
mask,
|
fill xgraphics.BGRA,
|
||||||
maskPoint,
|
) {
|
||||||
draw.Over)
|
bounds := mask.Bounds().Max
|
||||||
|
for y := 0; y < bounds.Y; y ++ {
|
||||||
|
for x := 0; x < bounds.X; x ++ {
|
||||||
|
_, _, _, alpha := mask.At(x, y).RGBA()
|
||||||
|
backend.canvas.SetBGRA (
|
||||||
|
x + at.X,
|
||||||
|
y + at.Y,
|
||||||
|
xgraphics.BlendBGRA (
|
||||||
|
backend.colors[stone.ColorBackground],
|
||||||
|
xgraphics.BGRA {
|
||||||
|
R: fill.R,
|
||||||
|
G: fill.G,
|
||||||
|
B: fill.B,
|
||||||
|
A: uint8(alpha >> 8),
|
||||||
|
}))
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fillRectangle (
|
func fillRectangle (
|
||||||
|
@ -133,7 +133,7 @@ func factory (
|
|||||||
Connect(backend.connection, backend.window.Id)
|
Connect(backend.connection, backend.window.Id)
|
||||||
|
|
||||||
// uncomment these to draw debug bounds
|
// uncomment these to draw debug bounds
|
||||||
// backend.drawCellBounds = true
|
// backend.drawCellBounds = true
|
||||||
// backend.drawBufferBounds = true
|
// backend.drawBufferBounds = true
|
||||||
|
|
||||||
output = backend
|
output = backend
|
||||||
|
Loading…
Reference in New Issue
Block a user