Rendering and caches
Module: byteink-compose. Conventions. Signatures and defaults follow the current source.
InkRenderer
InkRenderer
Shared finished/live drawing contract for path and mesh renderers. renderVersion invalidates retained view rasters when settings or textures change; the default is 0.
public interface InkRenderer
Source
InkRenderer.renderVersion
public val renderVersion: Long
Renderer revision used by viewport raster keys; mesh animation-time changes and clearCache increment it.
Source
InkRenderer.canDraw
public fun canDraw(stroke: Stroke): Boolean
| Parameter |
Type |
Default |
Meaning |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
Source
InkRenderer.canDraw
public fun canDraw(stroke: InProgressStroke): Boolean
| Parameter |
Type |
Default |
Meaning |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
Source
InkRenderer.render
public fun render( canvas: Canvas, stroke: Stroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect? = null, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
null |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkRenderer.render
public fun render( canvas: Canvas, stroke: InProgressStroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect? = null, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
null |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkRenderer.clearCache
Source
DrawScope.drawInk
public fun DrawScope.drawInk( renderer: InkRenderer, stroke: Stroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
DrawScope.drawInk
public fun DrawScope.drawInk( renderer: InkRenderer, stroke: InProgressStroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkMeshRenderer
InkMeshRenderer
Full pinned Ink mesh/shader rendering: vertex HSL/opacity, prediction fade, derivative AA, textures and atlas animation. ANY/ACCUMULATE use meshes; DISCARD uses a uniform outline with tiling textures. Single drawing thread; close is terminal and releases shaders/effects. Missing textures try the next compatible paint before failing without partial coat drawing.
public class InkMeshRenderer( public val textureStore: InkTextureStore? = null, public val cacheCapacity: Int = 2048, public val cacheByteBudget: Long = 64L * 1024 * 1024, public val textureCacheCapacity: Int = 64, ) : InkRenderer, AutoCloseable
| Parameter |
Type |
Default |
Meaning |
textureStore |
InkTextureStore? |
null |
Optional preloaded client-texture-ID lookup; images are borrowed and missing images make that paint unavailable. |
cacheCapacity |
Int |
2048 |
Nonnegative retained-entry limit; zero disables retention. |
cacheByteBudget |
Long |
64L * 1024 * 1024 |
Nonnegative retained finished-path or mesh-geometry byte ceiling, as specified by the renderer; excludes live geometry and provider images. |
textureCacheCapacity |
Int |
64 |
Positive maximum number of retained texture shader entries; provider-owned images are outside this limit. |
Source
InkMeshRenderer.animationTimeMillis
public var animationTimeMillis: Long
Writable nonnegative elapsed millisecond clock for texture atlases; changing it invalidates Compose drawing and view rasters. Live shape effects also need updateShape.
Source
InkMeshRenderer.renderVersion
override var renderVersion: Long
Renderer revision used by viewport raster keys; mesh animation-time changes and clearCache increment it. Private setter.
Source
InkMeshRenderer.meshBuildCount
public var meshBuildCount: Long
Cumulative coat mesh preparations, retained across clears. Private setter.
Source
InkMeshRenderer.cachedShapeCount
public val cachedShapeCount: Int
Number of retained finished mesh shapes; excludes weakly owned live geometry.
Source
InkMeshRenderer.cachedTextureCount
public val cachedTextureCount: Int
Number of retained texture shaders, bounded by textureCacheCapacity.
Source
InkMeshRenderer.cachedGeometryBytes
public var cachedGeometryBytes: Long
Retained finished mesh/prepared-vertex/path bytes, bounded by cacheByteBudget; excludes live geometry, JVM headers, GPU uploads and provider images. Private setter.
Source
InkMeshRenderer.canDraw
override fun canDraw(stroke: Stroke): Boolean
| Parameter |
Type |
Default |
Meaning |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
Source
InkMeshRenderer.canDraw
override fun canDraw(stroke: InProgressStroke): Boolean
| Parameter |
Type |
Default |
Meaning |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
Source
InkMeshRenderer.draw
public fun draw( canvas: Canvas, stroke: Stroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect? = null, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
null |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkMeshRenderer.draw
public fun draw( canvas: Canvas, stroke: InProgressStroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect? = null, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
null |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkMeshRenderer.render
override fun render(canvas: Canvas, stroke: Stroke, strokeToCanvas: AffineTransform, viewport: Rect?, colorArgb: Int?): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
Required |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
Required |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkMeshRenderer.render
override fun render(canvas: Canvas, stroke: InProgressStroke, strokeToCanvas: AffineTransform, viewport: Rect?, colorArgb: Int?): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
Required |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
Required |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkMeshRenderer.clearCache
override fun clearCache()
Source
InkMeshRenderer.close
Source
rememberInkMeshRenderer
Remembers the renderer by textureStore identity and closes it on disposal. Omit the store for texture-free brushes.
Composable: call within a Compose composition.
public fun rememberInkMeshRenderer(textureStore: InkTextureStore? = null): InkMeshRenderer
| Parameter |
Type |
Default |
Meaning |
textureStore |
InkTextureStore? |
null |
Optional preloaded client-texture-ID lookup; images are borrowed and missing images make that paint unavailable. |
Source
InkTextureStore
InkTextureStore
Supplies preloaded Skia Images by client texture ID. Renderer borrows images and never closes them; cached shaders retain native references. Call renderer.clearCache() after changing an image under the same ID.
public fun interface InkTextureStore
Source
InkTextureStore.get
public operator fun get(clientTextureId: String): Image?
| Parameter |
Type |
Default |
Meaning |
clientTextureId |
String |
Required |
BrushPaint client texture ID; return its decoded Skia Image, or null if unavailable. |
Source
InkPathRenderer
InkPathRenderer
InkPathRenderer() uses 2048 finished entries and 64 MiB. InkPathRenderer(cacheCapacity) keeps the same byte ceiling. Supports texture-free ANY/DISCARD; clearCache releases paths.
public class InkPathRenderer(public val cacheCapacity: Int, public val cacheByteBudget: Long) : InkRenderer
| Parameter |
Type |
Default |
Meaning |
cacheCapacity |
Int |
Required |
Nonnegative retained-entry limit; zero disables retention. |
cacheByteBudget |
Long |
Required |
Nonnegative retained finished-path or mesh-geometry byte ceiling, as specified by the renderer; excludes live geometry and provider images. |
Source
InkPathRenderer.constructor
Source
InkPathRenderer.constructor
public constructor(cacheCapacity: Int = 2048)
| Parameter |
Type |
Default |
Meaning |
cacheCapacity |
Int |
2048 |
Nonnegative retained-entry limit; zero disables retention. |
Source
InkPathRenderer.DEFAULT_CACHE_BYTE_BUDGET
public const val DEFAULT_CACHE_BYTE_BUDGET: Long = 64L * 1024 * 1024
Source
InkPathRenderer.pathBuildCount
public var pathBuildCount: Long
Cumulative finished/live path builds, retained across clearCache calls. Private setter.
Source
InkPathRenderer.cachedShapeCount
public val cachedShapeCount: Int
Number of retained finished shapes; excludes live paths.
Source
InkPathRenderer.cachedPathBytes
public var cachedPathBytes: Long
Estimated retained finished-path geometry bytes; bounded by cacheByteBudget. Private setter.
Source
InkPathRenderer.pathEvictionCount
public var pathEvictionCount: Long
Cumulative finished-shape retirements caused by capacity/byte limits. Private setter.
Source
InkPathRenderer.canDraw
override fun canDraw(stroke: Stroke): Boolean
| Parameter |
Type |
Default |
Meaning |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
Source
InkPathRenderer.canDraw
override fun canDraw(stroke: InProgressStroke): Boolean
| Parameter |
Type |
Default |
Meaning |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
Source
InkPathRenderer.render
override fun render(canvas: Canvas, stroke: Stroke, strokeToCanvas: AffineTransform, viewport: Rect?, colorArgb: Int?): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
Required |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
Required |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkPathRenderer.render
override fun render(canvas: Canvas, stroke: InProgressStroke, strokeToCanvas: AffineTransform, viewport: Rect?, colorArgb: Int?): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
Required |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
Required |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkPathRenderer.draw
public fun draw( canvas: Canvas, stroke: Stroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect? = null, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
null |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkPathRenderer.draw
public fun draw( canvas: Canvas, stroke: InProgressStroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect? = null, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
viewport |
Rect? |
null |
Visible rectangle in local canvas pixels; supply the actually visible area. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkPathRenderer.clearCache
override fun clearCache()
Source
DrawScope.drawInk
public fun DrawScope.drawInk( renderer: InkPathRenderer, stroke: Stroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
DrawScope.drawInk
public fun DrawScope.drawInk( renderer: InkPathRenderer, stroke: InProgressStroke, strokeToCanvas: AffineTransform = AffineTransform.IDENTITY, colorArgb: Int? = null, ): Boolean
| Parameter |
Type |
Default |
Meaning |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-local-canvas transform, composed with the canvas's existing transform. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkScene
InkSceneStroke
One occurrence; the same native stroke may occur several times with distinct transforms/colors.
public data class InkSceneStroke( public val stroke: Stroke, public val strokeToScene: AffineTransform = AffineTransform.IDENTITY, public val colorArgb: Int? = null, )
| Parameter |
Type |
Default |
Meaning |
stroke |
Stroke |
Required |
Native finished or live stroke, as specified by the type. |
strokeToScene |
AffineTransform |
AffineTransform.IDENTITY |
Finite stroke-to-scene transform; InkScene snapshots mutable values. |
colorArgb |
Int? |
null |
32-bit ARGB including alpha; nullable drawing overrides use the brush color when null. |
Source
InkScene
Snapshots transforms and indexes bounds. visibleStrokes gives conservative candidates; draw returns the actual drawn count.
public class InkScene(strokes: List<InkSceneStroke>)
| Parameter |
Type |
Default |
Meaning |
strokes |
List<InkSceneStroke> |
Required |
Stroke entries or stored rows, as specified by the type; preserve their order. |
Source
InkScene.strokes
public val strokes: List<InkSceneStroke>
Source
InkScene.visibleStrokes
public fun visibleStrokes( viewport: Rect, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, ): List<InkSceneStroke>
| Parameter |
Type |
Default |
Meaning |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
Source
InkScene.draw
public fun draw( canvas: Canvas, renderer: InkPathRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect, ): Int
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
Source
InkScene.draw
public fun draw( canvas: Canvas, renderer: InkRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect, ): Int
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
Source
InkScene.draw
public fun draw( canvas: Canvas, renderer: InkPathRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect, excludedStrokes: Set<InkSceneStroke>, ): Int
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
excludedStrokes |
Set<InkSceneStroke> |
Required |
Occurrence instances from scene.strokes; matching uses identity, not value equality. |
Source
InkScene.draw
public fun draw( canvas: Canvas, renderer: InkRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, viewport: Rect, excludedStrokes: Set<InkSceneStroke>, ): Int
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
excludedStrokes |
Set<InkSceneStroke> |
Required |
Occurrence instances from scene.strokes; matching uses identity, not value equality. |
Source
DrawScope.drawInkScene
public fun DrawScope.drawInkScene( scene: InkScene, renderer: InkPathRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, ): Int
| Parameter |
Type |
Default |
Meaning |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
Source
DrawScope.drawInkScene
public fun DrawScope.drawInkScene( scene: InkScene, renderer: InkPathRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, excludedStrokes: Set<InkSceneStroke>, ): Int
| Parameter |
Type |
Default |
Meaning |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
excludedStrokes |
Set<InkSceneStroke> |
Required |
Occurrence instances from scene.strokes; matching uses identity, not value equality. |
Source
DrawScope.drawInkScene
public fun DrawScope.drawInkScene( scene: InkScene, renderer: InkRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, excludedStrokes: Set<InkSceneStroke> = emptySet(), ): Int
| Parameter |
Type |
Default |
Meaning |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
excludedStrokes |
Set<InkSceneStroke> |
emptySet() |
Occurrence instances from scene.strokes; matching uses identity, not value equality. |
Source
InkSceneRasterCache
InkSceneRasterCache
InkSceneRasterCache() retains one exact view within 64 MiB. Reuse identical scene/view keys; new views rasterize in full. close is terminal.
public class InkSceneRasterCache( public val cacheCapacity: Int, public val pixelBudgetBytes: Long, ) : AutoCloseable
| Parameter |
Type |
Default |
Meaning |
cacheCapacity |
Int |
Required |
Nonnegative retained-entry limit; zero disables retention. |
pixelBudgetBytes |
Long |
Required |
Nonnegative retained N32 raster-byte ceiling; excludes paths, scenes and wrappers. |
Source
InkSceneRasterCache.constructor
Source
InkSceneRasterCache.DEFAULT_PIXEL_BUDGET_BYTES
public const val DEFAULT_PIXEL_BUDGET_BYTES: Long = 64L * 1024 * 1024
Source
InkSceneRasterCache.rasterBuildCount
public var rasterBuildCount: Long
Cumulative viewport raster builds, retained across clears. Private setter.
Source
InkSceneRasterCache.retainedPixelBytes
public var retainedPixelBytes: Long
Retained N32 raster bytes, bounded by pixelBudgetBytes; zero after clear/close. Private setter.
Source
InkSceneRasterCache.cachedViewCount
public val cachedViewCount: Int
Number of retained exact viewport images, bounded by cacheCapacity.
Source
InkSceneRasterCache.rasterEvictionCount
public var rasterEvictionCount: Long
Cumulative LRU image retirements caused by capacity/byte limits. Private setter.
Source
InkSceneRasterCache.draw
public fun draw( canvas: Canvas, scene: InkScene, renderer: InkPathRenderer, width: Int, height: Int, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, ): Int
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
width |
Int |
Required |
Raster/image width in pixels; cache viewport dimensions must be nonnegative. |
height |
Int |
Required |
Raster/image height in pixels; cache viewport dimensions must be nonnegative. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
Source
InkSceneRasterCache.draw
public fun draw( canvas: Canvas, scene: InkScene, renderer: InkRenderer, width: Int, height: Int, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, ): Int
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
width |
Int |
Required |
Raster/image width in pixels; cache viewport dimensions must be nonnegative. |
height |
Int |
Required |
Raster/image height in pixels; cache viewport dimensions must be nonnegative. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
Source
InkSceneRasterCache.draw
public fun draw( canvas: Canvas, scene: InkScene, renderer: InkPathRenderer, viewport: Rect, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, rasterScale: Float = 1f, excludedStrokes: Set<InkSceneStroke> = emptySet(), ): Int
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
rasterScale |
Float |
1f |
Finite positive physical pixels per local pixel, for uniform axis-aligned ancestor zoom. |
excludedStrokes |
Set<InkSceneStroke> |
emptySet() |
Occurrence instances from scene.strokes; matching uses identity, not value equality. |
Source
InkSceneRasterCache.draw
public fun draw( canvas: Canvas, scene: InkScene, renderer: InkRenderer, viewport: Rect, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, rasterScale: Float = 1f, excludedStrokes: Set<InkSceneStroke> = emptySet(), ): Int
| Parameter |
Type |
Default |
Meaning |
canvas |
Canvas |
Required |
Compose Canvas on the drawing thread; use asComposeCanvas() for a Skia canvas. |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
rasterScale |
Float |
1f |
Finite positive physical pixels per local pixel, for uniform axis-aligned ancestor zoom. |
excludedStrokes |
Set<InkSceneStroke> |
emptySet() |
Occurrence instances from scene.strokes; matching uses identity, not value equality. |
Source
InkSceneRasterCache.clearCache
Source
InkSceneRasterCache.close
override public fun close()
Source
rememberInkSceneRasterCache
Composable: call within a Compose composition.
public fun rememberInkSceneRasterCache(): InkSceneRasterCache
Source
rememberInkSceneRasterCache
Composable: call within a Compose composition.
public fun rememberInkSceneRasterCache(cacheCapacity: Int, pixelBudgetBytes: Long): InkSceneRasterCache
| Parameter |
Type |
Default |
Meaning |
cacheCapacity |
Int |
Required |
Nonnegative retained-entry limit; zero disables retention. |
pixelBudgetBytes |
Long |
Required |
Nonnegative retained N32 raster-byte ceiling; excludes paths, scenes and wrappers. |
Source
DrawScope.drawCachedInkScene
public fun DrawScope.drawCachedInkScene( cache: InkSceneRasterCache, scene: InkScene, renderer: InkPathRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, ): Int
| Parameter |
Type |
Default |
Meaning |
cache |
InkSceneRasterCache |
Required |
Drawing-thread raster cache; close when its owner is disposed. |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
Source
DrawScope.drawCachedInkScene
public fun DrawScope.drawCachedInkScene( cache: InkSceneRasterCache, scene: InkScene, renderer: InkPathRenderer, viewport: Rect, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, rasterScale: Float = 1f, excludedStrokes: Set<InkSceneStroke> = emptySet(), ): Int
| Parameter |
Type |
Default |
Meaning |
cache |
InkSceneRasterCache |
Required |
Drawing-thread raster cache; close when its owner is disposed. |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkPathRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
rasterScale |
Float |
1f |
Finite positive physical pixels per local pixel, for uniform axis-aligned ancestor zoom. |
excludedStrokes |
Set<InkSceneStroke> |
emptySet() |
Occurrence instances from scene.strokes; matching uses identity, not value equality. |
Source
DrawScope.drawCachedInkScene
public fun DrawScope.drawCachedInkScene( cache: InkSceneRasterCache, scene: InkScene, renderer: InkRenderer, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, ): Int
| Parameter |
Type |
Default |
Meaning |
cache |
InkSceneRasterCache |
Required |
Drawing-thread raster cache; close when its owner is disposed. |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
Source
DrawScope.drawCachedInkScene
public fun DrawScope.drawCachedInkScene( cache: InkSceneRasterCache, scene: InkScene, renderer: InkRenderer, viewport: Rect, sceneToCanvas: AffineTransform = AffineTransform.IDENTITY, rasterScale: Float = 1f, excludedStrokes: Set<InkSceneStroke> = emptySet(), ): Int
| Parameter |
Type |
Default |
Meaning |
cache |
InkSceneRasterCache |
Required |
Drawing-thread raster cache; close when its owner is disposed. |
scene |
InkScene |
Required |
Immutable finished-ink snapshot; reuse the same instance until entries change. |
renderer |
InkRenderer |
Required |
Reusable drawing-thread renderer; clear path caches or close owned mesh renderers on disposal. |
viewport |
Rect |
Required |
Visible rectangle in local canvas pixels; supply the actually visible area. |
sceneToCanvas |
AffineTransform |
AffineTransform.IDENTITY |
Finite invertible scene-to-local-canvas transform; include device density here. |
rasterScale |
Float |
1f |
Finite positive physical pixels per local pixel, for uniform axis-aligned ancestor zoom. |
excludedStrokes |
Set<InkSceneStroke> |
emptySet() |
Occurrence instances from scene.strokes; matching uses identity, not value equality. |
Source