render GetImage and replace Options prefix to Args

This commit is contained in:
2023-07-06 01:20:23 +02:00
parent 731548ef86
commit 701205ac82
17 changed files with 61 additions and 52 deletions

View File

@@ -0,0 +1,28 @@
package entity
import (
"bytes"
"image"
"io/ioutil"
"log"
)
type Render struct {
Image string
Width int
Height int
Visible bool
}
func (ro *Render) GetImage() image.Image {
file, err := ioutil.ReadFile(ro.Image)
if err != nil {
log.Fatal(err)
}
img, _, err := image.Decode(bytes.NewReader(file))
if err != nil {
log.Fatal(err)
}
return img
}