MCPcopy
hub / github.com/g3n/engine / NewImageFromTex

Function NewImageFromTex

gui/image.go:40–48  ·  view source on GitHub ↗

NewImageFromTex creates and returns an image panel from the specified texture2D

(tex *texture.Texture2D)

Source from the content-addressed store, hash-verified

38
39// NewImageFromTex creates and returns an image panel from the specified texture2D
40func 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.

Callers 3

NewImageButtonFunction · 0.85
NewImageFunction · 0.85
NewImageFromRGBAFunction · 0.85

Calls 6

SetContentSizeMethod · 0.80
AddTextureMethod · 0.80
WidthMethod · 0.65
HeightMethod · 0.65
InitializeMethod · 0.45
MaterialMethod · 0.45

Tested by

no test coverage detected