Skip to content

luxe API (2025.1.2)


luxe: ui/image module


UIImage

import "luxe: ui/image" for UIImage

UIImage is a type of Control made to display images.

  var image = UIImage.create(ui)
  UIImage.set_image(image, Assets.image("path/to/image"))
  //setup positioning etc with `Control.___`
  • create(ui_entity: Entity)
  • set_image(control: UIImage, image: Image)
  • set_image(control: UIImage, image: Image, flags: UIImageFlags)
  • get_image(control: UIImage)
  • set_material(control: UIImage, material: Material)
  • set_uv(control: UIImage, left: Num, top: Num, right: Num, bottom: Num)
  • set_color(control: UIImage, color: Color)
  • get_color(control: UIImage)
  • set_angle(control: UIImage, degrees: Num)
  • set_fit(control: UIImage, fit: UIImageFit)
  • get_fit(control: UIImage)

UIImage.create(ui_entity: Entity) returns UIImage

Create a new UIImage control.

UIImage.set_image(control: UIImage, image: Image) returns None

Set image of UIImage control (uses UIImageFlags.none with linear interpolation). Setting an image will reset any set custom material and use an internal material created from the luxe: material_basis/ui_solid basis instead.

UIImage.set_image(control: UIImage, image: Image, flags: UIImageFlags) returns None

Set displayed image of UIImage control. The flags determine what sampler is used to read the image. Setting an image will reset any set custom material and use an internal material created from the luxe: material_basis/ui_solid basis instead.

  var image = UIImage.create(ui)
  UIImage.set_image(image, Assets.image("path/to/image"), UIImageFlags.pixelated)

UIImage.get_image(control: UIImage) returns Image

Get currently displayed image of UIImage.

UIImage.set_material(control: UIImage, material: Material) returns None

Set the material used to render the UIImage. Setting a custom material will reset the controls image, so you need to author that via the inputs on your material.

UIImage.set_uv(control: UIImage, left: Num, top: Num, right: Num, bottom: Num) returns None

Set the uv bounds, default is (0, 0, 1, 1). Drawing only top left of the image would be (0.5, 0.5, 1, 1).

UIImage.set_color(control: UIImage, color: Color) returns None

Set the tint color of the UIImage. Communicated to the shader via vertex colors.

UIImage.get_color(control: UIImage) returns Color

Get the current tint color of the UIImage.

UIImage.set_angle(control: UIImage, degrees: Num) returns None

Set the angle of the UIImage control. Note that this will not affect child controls.

UIImage.set_fit(control: UIImage, fit: UIImageFit) returns None

Set the fit mode

UIImage.get_fit(control: UIImage) returns UIImageFit

Get the fit mode