Skip to main content

Class: StrokeRenderer2D

Rendering.2D.StrokeRenderer2D(canvas, sizeopt)

Stroke painter

Constructor

new StrokeRenderer2D(canvas, sizeopt)

Parameters:
NameTypeAttributesDefaultDescription
canvasRendering.2D.InkCanvas2Dview layer
sizeSize<optional>device screen size
Properties:
NameTypeDescription
brushRendering.2D.Brush2DRendering brush
colorCommon.ColorRendering color
updatedAreaCommon.RectCurrent modified segments area
preliminaryAreaCommon.RectLast preliminary update area
strokeBoundsCommon.RectCurrent stroke area
affectedAreaCommon.RectRuntime graphics updates area for drawn segments + preliminary area

Since:

  • version 1.0

Extends

Methods

abort()

Restarts StrokeRenderer instance lifecycle for next usage

Overrides:

blendStroke(layeropt, dirtyAreaopt, blendModeopt)

Blends completed stroke with another layer

Parameters:
NameTypeAttributesDefaultDescription
layerRendering.2D.OffscreenLayer2D<optional>this.canvasTarget layer for stroke blending
dirtyAreaCommon.Rect<optional>this.strokeBoundsBlending area
blendModeRendering.BlendMode<optional>this.blendModeBlending mode

Overrides:

blendStrokes(strokes, layer, blendOptions, strokeRendererGLopt) → Common.Rect

Blends batch of strokes with another layer

Parameters:
NameTypeAttributesDescription
strokesArray.<Stroke>Strokes to draw
layerRendering.2D.OffscreenLayer2DTarget layer for stroke blending
blendOptionsRendering.BlendOptionsBlending configuration
strokeRendererGLRendering.WebGL.StrokeRendererGL<optional>Rendering of strokes created with BrushGL requires specific processing
Returns:

Affected area

Type

Common.Rect

blendUpdatedArea(layeropt)

Blends affected area with another layer

Parameters:
NameTypeAttributesDefaultDescription
layerRendering.2D.OffscreenLayer2D<optional>this.canvastarget layer for stroke blending, where blendMode is previously configured

Overrides:

configure(settings)

Configures rendering. First call is used for initialilzation.

Parameters:
NameTypeDescription
settingsRendering.ComposeStyleRenderer configuration settings

Overrides:

draw(path, endStrokeopt)

Render data input

Parameters:
NameTypeAttributesDefaultDescription
pathPathBuilding.InkPath|Strokeinput
endStrokeboolean<optional>falseapplicable only when path is Path, when true caps end of stroke and completes stroke rendering

Overrides:

drawPreliminary(path)

Render preliminary curve

Parameters:
NameTypeDescription
pathPathBuilding.InkPath2DPrediction input

Overrides:

(abstract) drawSegment()

Overrides:

(abstract) drawStroke()

Overrides:

requestComposeLayer() → Rendering.OffscreenLayer

When data is composed, raster data could be acquired. This action resets stroke renderer internal state.

Overrides:

Returns:

Composition layer

Type

Rendering.OffscreenLayer

reset(runtime)

Reset current state

Parameters:
NameTypeDescription
runtimebooleanIs rendering of runtime segments of strokes is expected

Overrides:

resize()

Resize underlying layers

Overrides:

setTransform(matrix)

Configures ink transformation over stroke layer and it's preliminary when available

Parameters:
NameTypeDescription
matrixCommon.Matrix

Overrides:

toStroke(builder, strokeIDopt) → Stroke

Converts current drawed path to stroke

Parameters:
NameTypeAttributesDefaultDescription
builderPathBuilding.InkBuilderbuilder used for path building
strokeIDstring.<GUID><optional>auto generated GUIDStroke identifier

Overrides:

Returns:

stroke

Type

Stroke

Home