MCPcopy Create free account
hub / github.com/cogentcore/core / Image

Struct Image

core/image.go:24–41  ·  view source on GitHub ↗

Image is a widget that renders an [image.Image]. See [styles.Style.ObjectFit] to control the image rendering within the allocated size. The default minimum requested size is the pixel size in [units.Dp] units (1/160th of an inch).

Source from the content-addressed store, hash-verified

22// the allocated size. The default minimum requested size is the pixel
23// size in [units.Dp] units (1/160th of an inch).
24type Image struct {
25 WidgetBase
26
27 // Image is the [image.Image].
28 Image image.Image `xml:"-" json:"-"`
29
30 // prevImage is the cached last [Image.Image].
31 prevImage image.Image
32
33 // prevRenderImage is the cached last rendered image with any transformations applied.
34 prevRenderImage image.Image
35
36 // prevObjectFit is the cached [styles.Style.ObjectFit] of the last rendered image.
37 prevObjectFit styles.ObjectFits
38
39 // prevSize is the cached allocated size for the last rendered image.
40 prevSize math32.Vector2
41}
42
43func (im *Image) WidgetValue() any { return &im.Image }
44

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected