NewImageFromTex creates and returns an image panel from the specified texture2D
(tex *texture.Texture2D)
| 38 | |
| 39 | // NewImageFromTex creates and returns an image panel from the specified texture2D |
| 40 | func NewImageFromTex(tex *texture.Texture2D) *Image { |
| 41 | |
| 42 | i := new(Image) |
| 43 | i.Panel.Initialize(i, 0, 0) |
| 44 | i.tex = tex |
| 45 | i.Panel.SetContentSize(float32(i.tex.Width()), float32(i.tex.Height())) |
| 46 | i.Material().AddTexture(i.tex) |
| 47 | return i |
| 48 | } |
| 49 | |
| 50 | // SetTexture changes the image texture to the specified texture2D. |
| 51 | // It returns a pointer to the previous texture. |
no test coverage detected