Sander Schobers
0f03760e66
Refactored Size (on Renderer) to return geom.Point instead of geom.PointF32. Refactored Width and Height (on Texture) to return int instead of float32. Refactored texture dimensions to be represented by ints instead of float32s.
37 lines
557 B
Go
37 lines
557 B
Go
package allg5ui
|
|
|
|
import (
|
|
"image"
|
|
|
|
"opslag.de/schobers/allg5"
|
|
"opslag.de/schobers/zntg/ui"
|
|
)
|
|
|
|
var _ ui.Texture = &texture{}
|
|
var _ ui.ImageSource = &texture{}
|
|
|
|
type texture struct {
|
|
bmp *allg5.Bitmap
|
|
source ui.ImageSource
|
|
}
|
|
|
|
func (t *texture) Destroy() error {
|
|
t.bmp.Destroy()
|
|
return nil
|
|
}
|
|
|
|
func (t *texture) Height() int {
|
|
return t.bmp.Height()
|
|
}
|
|
|
|
func (t *texture) CreateImage() (image.Image, error) {
|
|
if t.source == nil {
|
|
return t.bmp.Image(), nil
|
|
}
|
|
return t.source.CreateImage()
|
|
}
|
|
|
|
func (t *texture) Width() int {
|
|
return t.bmp.Width()
|
|
}
|