Class: StrokeRenderer2D
Rendering.2D.StrokeRenderer2D(canvas, sizeopt)
Stroke painter
Constructor
new StrokeRenderer2D(canvas, sizeopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
canvas | Rendering.2D.InkCanvas2D | view layer | ||
size | Size | <optional> | device screen size |
Properties:
Name | Type | Description |
---|---|---|
brush | Rendering.2D.Brush2D | Rendering brush |
color | Common.Color | Rendering color |
updatedArea | Common.Rect | Current modified segments area |
preliminaryArea | Common.Rect | Last preliminary update area |
strokeBounds | Common.Rect | Current stroke area |
affectedArea | Common.Rect | Runtime 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:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
layer | Rendering.2D.OffscreenLayer2D | <optional> | this.canvas | Target layer for stroke blending |
dirtyArea | Common.Rect | <optional> | this.strokeBounds | Blending area |
blendMode | Rendering.BlendMode | <optional> | this.blendMode | Blending mode |
Overrides:
blendStrokes(strokes, layer, blendOptions, strokeRendererGLopt) → Common.Rect
Blends batch of strokes with another layer
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
strokes | Array.<Stroke> | Strokes to draw | |
layer | Rendering.2D.OffscreenLayer2D | Target layer for stroke blending | |
blendOptions | Rendering.BlendOptions | Blending configuration | |
strokeRendererGL | Rendering.WebGL.StrokeRendererGL | <optional> | Rendering of strokes created with BrushGL requires specific processing |
Returns:
Affected area
Type
blendUpdatedArea(layeropt)
Blends affected area with another layer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
layer | Rendering.2D.OffscreenLayer2D | <optional> | this.canvas | target layer for stroke blending, where blendMode is previously configured |
Overrides:
configure(settings)
Configures rendering. First call is used for initialilzation.
Parameters:
Name | Type | Description |
---|---|---|
settings | Rendering.ComposeStyle | Renderer configuration settings |
Overrides:
draw(path, endStrokeopt)
Render data input
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path | PathBuilding.InkPath|Stroke | input | ||
endStroke | boolean | <optional> | false | applicable only when path is Path, when true caps end of stroke and completes stroke rendering |
Overrides:
drawPreliminary(path)
Render preliminary curve
Parameters:
Name | Type | Description |
---|---|---|
path | PathBuilding.InkPath2D | Prediction 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
reset(runtime)
Reset current state
Parameters:
Name | Type | Description |
---|---|---|
runtime | boolean | Is 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:
Name | Type | Description |
---|---|---|
matrix | Common.Matrix |
Overrides:
toStroke(builder, strokeIDopt) → Stroke
Converts current drawed path to stroke
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
builder | PathBuilding.InkBuilder | builder used for path building | ||
strokeID | string.<GUID> | <optional> | auto generated GUID | Stroke identifier |
Overrides:
Returns:
stroke
Type