|
|
|
@ -27,43 +27,39 @@ func NewCore (parent tomo.Element) (core *Core, control CoreControl) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ColorModel fulfills the draw.Image interface.
|
|
|
|
func (core *Core) ColorModel () (model color.Model) {
|
|
|
|
func (core *Core) ColorModel () (model color.Model) {
|
|
|
|
return color.RGBAModel
|
|
|
|
return color.RGBAModel
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ColorModel fulfills the draw.Image interface.
|
|
|
|
func (core *Core) At (x, y int) (pixel color.Color) {
|
|
|
|
func (core *Core) At (x, y int) (pixel color.Color) {
|
|
|
|
return core.canvas.At(x, y)
|
|
|
|
return core.canvas.At(x, y)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ColorModel fulfills the draw.Image interface.
|
|
|
|
func (core *Core) Bounds () (bounds image.Rectangle) {
|
|
|
|
func (core *Core) Bounds () (bounds image.Rectangle) {
|
|
|
|
return core.canvas.Bounds()
|
|
|
|
return core.canvas.Bounds()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ColorModel fulfills the draw.Image interface.
|
|
|
|
func (core *Core) Set (x, y int, c color.Color) () {
|
|
|
|
func (core *Core) Set (x, y int, c color.Color) () {
|
|
|
|
core.canvas.Set(x, y, c)
|
|
|
|
core.canvas.Set(x, y, c)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Buffer fulfills the tomo.Canvas interface.
|
|
|
|
func (core *Core) Buffer () (data []color.RGBA, stride int) {
|
|
|
|
func (core *Core) Buffer () (data []color.RGBA, stride int) {
|
|
|
|
return core.canvas.Buffer()
|
|
|
|
return core.canvas.Buffer()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MinimumSize fulfils the tomo.Element interface. This should not need to be
|
|
|
|
|
|
|
|
// overridden.
|
|
|
|
func (core *Core) MinimumSize () (width, height int) {
|
|
|
|
func (core *Core) MinimumSize () (width, height int) {
|
|
|
|
return core.metrics.minimumWidth, core.metrics.minimumHeight
|
|
|
|
return core.metrics.minimumWidth, core.metrics.minimumHeight
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (core *Core) Resize (width, height int) {
|
|
|
|
// SetParentHooks fulfils the tomo.Element interface. This should not need to be
|
|
|
|
if width < core.metrics.minimumWidth {
|
|
|
|
// overridden.
|
|
|
|
width = core.metrics.minimumWidth
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if height < core.metrics.minimumHeight {
|
|
|
|
|
|
|
|
height = core.metrics.minimumHeight
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bounds := core.canvas.Bounds()
|
|
|
|
|
|
|
|
if width != bounds.Dx() || height != bounds.Dy() {
|
|
|
|
|
|
|
|
core.canvas = tomo.NewBasicCanvas(width, height)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (core *Core) SetParentHooks (hooks tomo.ParentHooks) {
|
|
|
|
func (core *Core) SetParentHooks (hooks tomo.ParentHooks) {
|
|
|
|
core.hooks = hooks
|
|
|
|
core.hooks = hooks
|
|
|
|
}
|
|
|
|
}
|
|
|