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.
tomo-old/elements/basic/image.go

24 lines
587 B
Go
Raw Normal View History

2023-02-09 16:34:53 -07: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 () {
artist.FillRectangle(element, element.buffer, element.Bounds())
}