Image

An image ui element to upload & display images on the glasses screen

Each image is defined by an image slot which you can upload PNG/JPG images

  • Max size 16KB compressed.

  • Max pixels: 640x400

  • PNG images must be encoded with sliding window size of 2^15bytes or less (see PNG zlib encoding).

  • JPEG compression: baseline only (progressive compression is not supported)

  • Both grayscale, transparency and color supported as long as they fit into memory limit

  • All slots except Slot0 are persistent, meaning uploaded images for those slots are kept saved on the glasses between reboots

NOTE: The behaviour of adding 2 (or more) different images with the same slot to the same screen is undefined

Supported transformations: Translate

See also

Constructors

Link copied to clipboard
constructor()
constructor(id: String)
constructor(image: ImgSrc)

Constructor, defining an image for the Image

constructor(id: String, image: ImgSrc)

Constructor, defining an image and id for the Image

Functions

Link copied to clipboard
protected open override fun drawBorder(canvas: CanvasBuffer, color: Int, widthPix: Int, cornerRadiusPix: Float)

Override this function to enable custom border drawing when showBorder is true

Link copied to clipboard

Get the ImgSrc

Link copied to clipboard
open override fun getUIResource(): ImgSrc?

Returns the resource of the UI element if exists

Link copied to clipboard
open override fun isDirty(): Boolean

Return true if the ui element was changed from the last draw

Link copied to clipboard
protected open override fun onDraw(canvas: CanvasBuffer)

The draw method is called to actually draw the ui element visual representation to the CanvasBuffer

Link copied to clipboard
open override fun rotate(angleDegrees: Float): UIElement
open override fun rotate(angleDegrees: Float, centerX: Float, centerY: Float, pivot: Pivot): UIElement

not supported for image

Link copied to clipboard
open override fun scale(sx: Float, sy: Float): UIElement
open override fun scale(sx: Float, sy: Float, px: Float, py: Float, pivot: Pivot): UIElement

not supported for image

Link copied to clipboard
fun setResource(image: ImgSrc): Image

Set the image information

Link copied to clipboard
open override fun toString(): String

To String