Background image does not render in yaegi
Describe the bug
s.Background = img does not result in the image being rendered.
How to reproduce
See https://www.cogentcore.org/core/colors#image
Example code
Relevant output
Platform
macOS
that same code works fine when compiled directly, in my debug project. on mac and web. So it is something with the yaegi environment..
//go:embed image.png
var myImage embed.FS
func main() {
b := core.NewBody()
fr := core.NewFrame(b)
img, _, err := imagex.OpenFS(myImage, "image.png")
errors.Log(err)
fr.Styler(func(s *styles.Style) {
s.Background = img
s.Min.Set(units.Em(10))
})
b.RunMainWindow()
}
it might be that yaegicore is out of date but I can't rebuild right now due to go version automatically changing to 1.24.5 on me.
reminder to self: look in the go.work file for the version number there -- goscript was inflating mine..
no progress after rebuilding yaegi -- clearly it has the image good and proper -- tried this in the docs:
fr := core.NewFrame(b)
img, _, err := imagex.OpenFS(myImage, "image.png")
errors.Log(err)
fmt.Printf("%T\n", img)
rimg := imagex.AsRGBA(img)
fmt.Printf("%T %v %v\n", rimg, rimg.Bounds(), rimg.At(50,50))
fr.Styler(func(s *styles.Style) {
s.Background = rimg
s.Min.Set(units.Em(10))
})
output:
*image.NRGBA
*image.RGBA (0,0)-(128,128) {251 189 14 255}
Interesting that we keep getting these NRGBA guys everywhere. but converting to an RGA obviously doesn't help.