Class: StrokeRenderer
(abstract) Rendering.StrokeRenderer(canvas, optionsopt)
Stroke painter
Constructor
(abstract) new StrokeRenderer(canvas, optionsopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
canvas | Rendering.InkCanvas | View layer | |
options | Size|Rendering.WebGL.InkLayerOptions | <optional> | When not available underlying layer is auto created with default size (device screen size). |
Properties:
Name | Type | Description |
---|---|---|
brush | Rendering.Brush | 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
Methods
abort()
Restarts StrokeRenderer instance lifecycle for next usage
(abstract) blendStroke(layeropt, dirtyAreaopt, blendModeopt)
Blends completed stroke with another layer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
layer | Rendering.OffscreenLayer | <optional> | this.canvas | target layer for stroke blending |
dirtyArea | Common.Rect | <optional> | this.strokeBounds | blending area |
blendMode | Rendering.BlendMode | <optional> | this.blendMode | blending mode |
(abstract) blendUpdatedArea(layeropt)
Blends affected area with another layer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
layer | Rendering.OffscreenLayer | <optional> | this.canvas | target layer for stroke blending, where blendMode is previously configured |
configure(settings)
Configures rendering. First call is used for initialilzation.
Parameters:
Name | Type | Description |
---|---|---|
settings | Rendering.ComposeStyle | Renderer configuration settings |
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 |
(abstract) drawPreliminary(path)
Render preliminary curve
Parameters:
Name | Type | Description |
---|---|---|
path | PathBuilding.InkPath2D | prediction input |
(abstract) drawSegment()
(abstract) drawStroke()
requestComposeLayer() → Rendering.OffscreenLayer
When data is composed, raster data could be acquired. This action resets stroke renderer internal state.
Returns:
Composition layer
Type
(abstract) reset()
Reset current state
resize()
Resize underlying layers
setTransform(matrix)
Configures ink transformation over stroke layer and it's preliminary when available
Parameters:
Name | Type | Description |
---|---|---|
matrix | Common.Matrix |
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 |
Returns:
stroke
Type