I forgor to commit all this stuff

This commit is contained in:
2023-07-04 00:04:00 -04:00
parent 5e7c666d92
commit 208c50a66b
5 changed files with 305 additions and 35 deletions

View File

@@ -3,6 +3,7 @@ package xcanvas
import "image"
import "image/color"
import "github.com/jezek/xgbutil"
import "github.com/jezek/xgb/xproto"
import "git.tebibyte.media/tomo/ggfx"
import "github.com/jezek/xgbutil/xgraphics"
import "git.tebibyte.media/tomo/tomo/canvas"
@@ -36,10 +37,16 @@ func (this Canvas) Pen () canvas.Pen {
}
// Clip returns a sub-canvas of this canvas.
func (this Canvas) Clip (bounds image.Rectangle) Canvas {
func (this Canvas) Clip (bounds image.Rectangle) canvas.Canvas {
return Canvas { this.Image.SubImage(bounds).(*xgraphics.Image) }
}
// Push pushes this canvas to the screen.
func (this Canvas) Push (window xproto.Window) {
this.XDraw()
this.XExpPaint(window, this.Bounds().Min.X, this.Bounds().Min.Y)
}
// TODO: we need to implement:
// - cap
// - joint