CanvasBuffer

This class acts as a virtual drawing canvas to be drawn and send to the glasses.

Each Screen and its UIElement stack uses the canvas as their drawing surface.

The SDK, when required, will send the canvas drawing commands the glasses

Functions

Link copied to clipboard
open fun clear()

Clear the canvas from all the drawing commands

Link copied to clipboard
fun clearRect(x: Float, y: Float, width: Float, height: Float): Boolean

Clear command, to clear the given square from the display buffer

Link copied to clipboard

Sets Clipping area to the given bb

fun clip(uiElement: UIElement): Boolean

Sets Clipping area to the UIElement bounding box

open fun clip(topLeftX: Float, topLeftY: Float, bottomRightX: Float, bottomRightY: Float): Boolean

Sets Clipping area to x,y ->x+width,y+height

Link copied to clipboard
fun copyToScreen(x: Float, y: Float, width: Float, height: Float): Boolean

Copy command, to copy the given square to the display buffer

Link copied to clipboard
fun drawArc(uiElement: UIElement, x: Float, y: Float, radius: Float, degreesFrom: Float, degreesTo: Float): Boolean

Draw arc command, to draw an arc on the glasses display

Link copied to clipboard
fun drawEllipse(uiElement: UIElement, centerX: Float, centerY: Float, rx: Float, ry: Float, style: FillStyle, angle: Float): Boolean

Draw ellipse command, to draw an ellipse on the glasses display

Link copied to clipboard
fun drawImage(uiElement: UIElement, image: ImgSrc, x: Float, y: Float): Boolean

Instruct the SDK to draw on the glasses a preloaded image

Link copied to clipboard
fun drawLine(uiElement: UIElement, x1: Float, y1: Float, x2: Float, y2: Float): Boolean

Draw line command, to draw a line on the glasses display

Link copied to clipboard
fun drawPath(uiElement: UIElement, xyPoints: FloatArray, size: Int, stride: Int = 2): Boolean

Draw path command, to draw a path on the glasses display

Link copied to clipboard
fun drawPolygon(uiElement: UIElement, xyPoints: FloatArray, size: Int, style: FillStyle, convex: Boolean, offset: Int = 0, stride: Int = 2): Boolean

Draw a polygon command, to draw a polygon on the glasses display

Link copied to clipboard
fun drawPolygonEx(uiElement: UIElement, xyPoints: FloatArray, size: Int, xShiftPix: Float, yShiftPix: Float, style: FillStyle, convex: Boolean, offset: Int = 0, stride: Int = 2): Boolean

Draw a polygon command, to draw a polygon on the glasses display

Link copied to clipboard
fun drawRect(uiElement: UIElement, x: Float, y: Float, width: Float, height: Float, radius: Float = 0.0f, style: FillStyle = FillStyle.fill): Boolean

Draw rect command, to draw a rectangle on the glasses display

Link copied to clipboard
fun drawText(uiElement: UIElement, font: Font, x: Float, y: Float, textBytes: ByteArray, alignment: Align = Align.left): Boolean
fun drawText(uiElement: UIElement, font: Font, x: Float, y: Float, text: String, alignment: Align = Align.left): Boolean

Instruct the SDK to draw on the glasses a text.

Link copied to clipboard
fun getColor(): Int

Returns the current canvas pen color

Link copied to clipboard

Returns the current canvas pen size

Link copied to clipboard
protected fun roundCoord(v: Float): Int
Link copied to clipboard
fun setColor(rgba: Int): Boolean

set the pen color of the canvas

Link copied to clipboard
fun setLineStyle(lineStyle: LineStyle): Boolean

set the line style of the canvas

Link copied to clipboard

set the pen shape of the canvas

Link copied to clipboard
fun setPenThickness(thicknessPixels: Int): Boolean

set the pen thickness of the canvas