Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SoftwareRenderer

The software renderer allows rendering layouts entirely on the CPU. This is surprisingly fast and can be considered the default renderer.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

ptr

ptr: number

Methods

dispose

  • dispose(): void
  • Disposes the object, allowing it to clean up all of its memory. You need to call this for every object that you don't use anymore and hasn't already been disposed.

    Returns void

render

  • render(layoutState: LayoutStateRef, data: number, width: number, height: number, stride: number, forceRedraw: boolean): void
  • Renders the layout state provided into the image buffer provided. The image has to be an array of RGBA8 encoded pixels (red, green, blue, alpha with each channel being an u8). Some frameworks may over allocate an image's dimensions. So an image with dimensions 100x50 may be over allocated as 128x64. In that case you provide the real dimensions of 100x50 as the width and height, but a stride of 128 pixels as that correlates with the real width of the underlying buffer. By default the renderer will try not to redraw parts of the image that haven't changed. You can force a redraw in case the image provided or its contents have changed.

    Parameters

    • layoutState: LayoutStateRef
    • data: number
    • width: number
    • height: number
    • stride: number
    • forceRedraw: boolean

    Returns void

with

  • Allows for scoped usage of the object. The object is guaranteed to get disposed once this function returns. You are free to dispose the object early yourself anywhere within the scope. The scope's return value gets carried to the outside of this function.

    Type parameters

    • T

    Parameters

    Returns T

Static new

  • Creates a new software renderer.

    Returns SoftwareRenderer

Generated using TypeDoc