KiteRasterScope

What KiteCanvas.rasterStep hands its step: a box of device pixels, and the canvas's own drawing into rasters of that box. A canvas that works at a lower resolution than the device, to stay within its memory budget, gives smaller rasters and says so through toPixels.

Properties

Link copied to clipboard
abstract val height: Int

The height of every raster of this step, in pixels.

Link copied to clipboard
abstract val toPixels: KiteMatrix

The map from the space of the step's region, the ctm given to KiteCanvas.rasterStep, to the pixels of its rasters: x runs right and y down, and (0, 0) is the top left corner of the top left pixel. A length of one unit in that space covers this many pixels, so a step that blurs or moves by a length in user units scales it through this map.

Link copied to clipboard
abstract val width: Int

The width of every raster of this step, in pixels.

Functions

Link copied to clipboard
abstract fun backdrop(): KiteRaster?

What lies under the box now, as the next paint would see it, or null when this canvas cannot read its target back, such as inside a layer of the platform that keeps its pixels to itself. A step that needs the backdrop returns false on null, and the caller then draws without the step.

Link copied to clipboard
abstract fun draw(raster: KiteRaster, alpha: Double = 1.0, blendMode: KiteBlendMode = KiteBlendMode.Normal)

Composites raster, which must have this step's size, onto the box as one paint in blendMode at alpha (ISO 32000-1, 11.3.6), inside the clips that were in force when the step began.

Link copied to clipboard
abstract fun render(initial: KiteRaster? = null, content: () -> Unit): KiteRaster

Paints content through the canvas into a new raster of the box. While content runs, every paint of the canvas goes to that raster instead of its target, and the content may clip, open groups and apply soft masks as usual. The raster starts as a copy of initial, which must have this step's size, or transparent when it is null. The clips in force when the step began do not apply here: draw applies them.