This repository has been archived on 2024-06-02. 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 00:52:14 -06:00
package x
import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/tomo/canvas"
type canvasBox struct {
*box
2023-09-08 14:39:58 -06:00
userDrawer canvas.Drawer
2023-07-02 00:52:14 -06:00
}
func (backend *Backend) NewCanvasBox () tomo.CanvasBox {
this := &canvasBox { }
this.box = backend.newBox(this)
2023-09-08 14:39:58 -06:00
this.drawer = this
return this
2023-07-02 00:52:14 -06:00
}
func (this *canvasBox) Box () tomo.Box {
return this
}
func (this *canvasBox) SetDrawer (drawer canvas.Drawer) {
2023-09-08 14:39:58 -06:00
this.userDrawer = drawer
2023-07-02 00:52:14 -06:00
this.invalidateDraw()
}
func (this *canvasBox) Invalidate () {
this.invalidateDraw()
}
2023-09-08 14:39:58 -06:00
func (this *canvasBox) Draw (can canvas.Canvas) {
this.box.Draw(can)
this.userDrawer.Draw (
2024-05-26 13:18:27 -06:00
can.SubCanvas(this.padding.Apply(this.innerClippingBounds)))
2023-09-08 14:39:58 -06:00
}