This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
x/canvasbox.go

36 lines
698 B
Go
Raw Permalink Normal View History

2023-07-02 06:52:14 +00:00
package x
import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/tomo/canvas"
type canvasBox struct {
*box
2023-09-08 20:39:58 +00:00
userDrawer canvas.Drawer
2023-07-02 06:52:14 +00:00
}
func (backend *Backend) NewCanvasBox () tomo.CanvasBox {
this := &canvasBox { }
this.box = backend.newBox(this)
2023-09-08 20:39:58 +00:00
this.drawer = this
return this
2023-07-02 06:52:14 +00:00
}
func (this *canvasBox) Box () tomo.Box {
return this
}
func (this *canvasBox) SetDrawer (drawer canvas.Drawer) {
2023-09-08 20:39:58 +00:00
this.userDrawer = drawer
2023-07-02 06:52:14 +00:00
this.invalidateDraw()
}
func (this *canvasBox) Invalidate () {
this.invalidateDraw()
}
2023-09-08 20:39:58 +00:00
func (this *canvasBox) Draw (can canvas.Canvas) {
this.box.Draw(can)
this.userDrawer.Draw (
2024-05-26 19:18:27 +00:00
can.SubCanvas(this.padding.Apply(this.innerClippingBounds)))
2023-09-08 20:39:58 +00:00
}