Moved artist (now art) into another repo

This commit is contained in:
2023-05-03 20:17:48 -04:00
parent 54ea1c283f
commit 501eb34922
36 changed files with 191 additions and 186 deletions

View File

@@ -2,20 +2,20 @@ package elements
import "image"
import "tomo"
import "tomo/artist"
import "tomo/artist/patterns"
import "art"
import "art/patterns"
// TODO: this element is lame need to make it better
// Image is an element capable of displaying an image.
type Image struct {
entity tomo.Entity
buffer artist.Canvas
buffer art.Canvas
}
// NewImage creates a new image element.
func NewImage (image image.Image) (element *Image) {
element = &Image { buffer: artist.FromImage(image) }
element = &Image { buffer: art.FromImage(image) }
element.entity = tomo.GetBackend().NewEntity(element)
bounds := element.buffer.Bounds()
element.entity.SetMinimumSize(bounds.Dx(), bounds.Dy())
@@ -28,7 +28,7 @@ func (element *Image) Entity () tomo.Entity {
}
// Draw causes the element to draw to the specified destination canvas.
func (element *Image) Draw (destination artist.Canvas) {
func (element *Image) Draw (destination art.Canvas) {
if element.entity == nil { return }
(patterns.Texture { Canvas: element.buffer }).
Draw(destination, element.entity.Bounds())