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/texture.go

30 lines
597 B
Go

package x
import "image"
import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/x/canvas"
type texture struct {
*xcanvas.Texture
}
func (backend Backend) NewTexture (source image.Image) tomo.Texture {
return texture {
Texture: xcanvas.NewTextureFrom(source),
}
}
func (this texture) Clip (bounds image.Rectangle) tomo.Texture {
return texture {
Texture: this.Texture.Clip(bounds),
}
}
func assertTexture (unknown tomo.Texture) *texture {
if tx, ok := unknown.(*texture); ok {
return tx
} else {
panic("foregin texture implementation, i did not make this!")
}
}