MetalRenderer


Ink renderer for iOS, using Metal.

Summary

Public constructors

MetalRenderer(
    device: MTLDeviceProtocol,
    colorPixelFormat: ULong,
    stencilPixelFormat: ULong,
    sampleCount: Int?,
    textureImageStore: TextureImageStore?
)
N

Public functions

Unit
draw(
    renderEncoder: MTLRenderCommandEncoderProtocol,
    inProgressStroke: InProgressStroke,
    textureWidth: Double,
    textureHeight: Double,
    strokeToScreenTransform: AffineTransform
)

Draws an in-progress stroke using the given render encoder.

N
Unit
draw(
    renderEncoder: MTLRenderCommandEncoderProtocol,
    stroke: Stroke,
    textureWidth: Double,
    textureHeight: Double,
    strokeToScreenTransform: AffineTransform
)

Draws a completed stroke using the given render encoder.

N

Public constructors

MetalRenderer

MetalRenderer(
    device: MTLDeviceProtocol,
    colorPixelFormat: ULong,
    stencilPixelFormat: ULong,
    sampleCount: Int? = null,
    textureImageStore: TextureImageStore? = null
)
Parameters
device: MTLDeviceProtocol

MTLDevice to use for rendering.

colorPixelFormat: ULong

Format of the color texture being rendered.

stencilPixelFormat: ULong

Format of the stencil texture being rendered. If a stencil texture is not being used, this should be MTLPixelFormatInvalid.

sampleCount: Int? = null

The number of samples per pixel for MSAA. If unset or null, shader-based antialiasing will be used instead.

textureImageStore: TextureImageStore? = null

An optional callback for retrieving texture images by ID.

Public functions

draw

fun draw(
    renderEncoder: MTLRenderCommandEncoderProtocol,
    inProgressStroke: InProgressStroke,
    textureWidth: Double,
    textureHeight: Double,
    strokeToScreenTransform: AffineTransform
): Unit

Draws an in-progress stroke using the given render encoder.

Parameters
renderEncoder: MTLRenderCommandEncoderProtocol

MTLRenderCommandEncoder to draw with.

inProgressStroke: InProgressStroke

The in-progress stroke to draw.

textureWidth: Double

Width of the texture renderEncoder is drawing to, used to compute the projection transform.

textureHeight: Double

Height of the texture renderEncoder is drawing to, used to compute the projection transform.

strokeToScreenTransform: AffineTransform

Affine transform from stroke coordinates to view coordinates.

draw

fun draw(
    renderEncoder: MTLRenderCommandEncoderProtocol,
    stroke: Stroke,
    textureWidth: Double,
    textureHeight: Double,
    strokeToScreenTransform: AffineTransform
): Unit

Draws a completed stroke using the given render encoder.

Parameters
renderEncoder: MTLRenderCommandEncoderProtocol

MTLRenderCommandEncoder to draw with.

stroke: Stroke

The stroke to draw.

textureWidth: Double

Width of the texture renderEncoder is drawing to, used to compute the projection transform.

textureHeight: Double

Height of the texture renderEncoder is drawing to, used to compute the projection transform.

strokeToScreenTransform: AffineTransform

Affine transform from stroke coordinates to view coordinates.