image

Display images. Currently, the following formats are allowed:

  • jpg
  • png

Example

Basic usage

Please make sure the image address exists before use. Use the dep built-in function to point to the image address. This function can use an absolute address. In the following example, crate://self/ represents the project root directory.

1<image src="dep('crate://self/resources/genui.png')"></image>

Attributes

NameDescriptionType
visibleVisible or notbool
grab_key_focusCapture keyboard focusbool
opacityOpacityF32
cursorMouse pointer styleMouseCursor
scaleScale ratioF64
fitImage fit methodImageFit
srcImage resource pathLiveDependency
min_widthMinimum widthi64
min_heightMinimum heighti64
rotationRotation angleF32
abs_posAbsolute positionDVec2
marginMarginMargin
widthwidthSize
heightheightSize
scrollscroll offsetDVec2
clip_xclip X axis or notbool
clip_yclip Y axis or notbool
paddingpaddingPadding
alignalignmentAlign
flowflow modeFlow
spacingspacingF64
event_keyevent keybool

event callback

namedescriptionparameters
hover_inmouse hover eventGImageHoverParam
hover_outMouse over eventGImageHoverParam
clickedClick eventGImageClickedParam