SetTexture changes the image texture to the specified texture2D. It returns a pointer to the previous texture.
(tex *texture.Texture2D)
| 50 | // SetTexture changes the image texture to the specified texture2D. |
| 51 | // It returns a pointer to the previous texture. |
| 52 | func (i *Image) SetTexture(tex *texture.Texture2D) *texture.Texture2D { |
| 53 | |
| 54 | prevtex := i.tex |
| 55 | i.Material().RemoveTexture(prevtex) |
| 56 | i.tex = tex |
| 57 | i.Panel.SetContentSize(float32(i.tex.Width()), float32(i.tex.Height())) |
| 58 | i.Material().AddTexture(i.tex) |
| 59 | return prevtex |
| 60 | } |
| 61 | |
| 62 | // SetImage sets the image from the specified image file |
| 63 | func (i *Image) SetImage(imgfile string) error { |
no test coverage detected