This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
2023-02-09 23:34:53 +00:00
|
|
|
package basicElements
|
|
|
|
|
|
|
|
import "image"
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/core"
|
|
|
|
|
|
|
|
type Image struct {
|
|
|
|
*core.Core
|
|
|
|
core core.CoreControl
|
|
|
|
buffer artist.Pattern
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewImage (image image.Image) (element *Image) {
|
|
|
|
element = &Image { buffer: artist.NewTexture(image) }
|
|
|
|
element.Core, element.core = core.NewCore(element.draw)
|
|
|
|
bounds := image.Bounds()
|
|
|
|
element.core.SetMinimumSize(bounds.Dx(), bounds.Dy())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (element *Image) draw () {
|
2023-02-13 06:49:33 +00:00
|
|
|
artist.FillRectangle(element.core, element.buffer, element.Bounds())
|
2023-02-09 23:34:53 +00:00
|
|
|
}
|