Add pixel text editor and built-in messages

This commit is contained in:
ZacharyZhang-NY committed 2026-10-11 16:15:27 -04:00
1 parent d33bf0cbbb
commit a92829f353
11 files changed
+1069 -11

No files matched your search

+7
View File
@@ -20,6 +20,7 @@ type Canvas struct {
// painter is what Canvas needs of *ui.Painter.
type painter interface {
Fill(r ui.Rect, c ui.Color, radius float32)
Clip(r ui.Rect, radius float32, fn func())
After(d time.Duration)
Now() time.Time
}
@@ -45,6 +46,12 @@ func (g Canvas) Rect(x, y, w, h int, s Slot) {
g.p.Fill(ui.Rect{X: float32(g.gx+x) * d, Y: float32(g.gy+y) * d, W: float32(w) * d, H: float32(h) * d}, g.k.C(s), 0)
}
// Clip limits fn's drawing to a dot rectangle.
func (g Canvas) Clip(x, y, w, h int, fn func()) {
d := g.k.dot
g.p.Clip(ui.Rect{X: float32(g.gx+x) * d, Y: float32(g.gy+y) * d, W: float32(w) * d, H: float32(h) * d}, 0, fn)
}
func (g Canvas) Dot(x, y int, s Slot) { g.Rect(x, y, 1, 1, s) }
func (g Canvas) HLine(x, y, w int, s Slot) { g.Rect(x, y, w, 1, s) }
func (g Canvas) VLine(x, y, h int, s Slot) { g.Rect(x, y, 1, h, s) }