Class: Stroke
Stroke(brush, spline, inkPathopt, sensorDataopt)
Stroke model
Constructor
new Stroke(brush, spline, inkPathopt, sensorDataopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
brush | Rendering.Brush|URI | Brush reference | |
spline | PathBuilding.Spline|PathBuilding.PipelineData | Underlying path geometry information. When PipelineData it should contains all related paths. | |
inkPath | PathBuilding.InterpolatedSpline|PathBuilding.InkPath2D | <optional> | Ink renderable geometry |
sensorData | InkInput.SensorData | <optional> | Pointer input (spline source) |
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id | GUID | Stroke identifier | ||
uri | URI | Stroke identifier as URI | ||
brush | Rendering.2D.Brush2D|Rendering.WebGL.BrushGL | Stroke brush | ||
randomSeed | int | Particles random seed, available when brush is BrushGL | ||
renderMode | URI | Defines custom stroke specifics, encodes BlendMode for generic strokes | ||
blendMode | Rendering.BlendMode | Depends from renderMode, default render modes provides blendMode | ||
color | Common.Color | Stroke color | ||
style | Rendering.InkStyle | Stroke stylesheet | ||
sensorData | InkInput.SensorData | Keeps sensor data | ||
sensorDataOffset | int | <optional> | 0 | Index of points mapping between raw and processed paths (spline points offset) |
sensorDataMapping | Uint32Array | Explicit mapping between indices of Path and ink SensorChannelsContext data, used when input rate is very high and provides unwanted points | ||
spline | PathBuilding.Spline | Control points | ||
interpolatedSpline | PathBuilding.InterpolatedSpline | Interpolated points, available for BrushGL or when is requested from pipeline | ||
shapesPath | PathBuilding.InkPath2D | Brush samples sequence, available for shapes rendering with Brush2D or when is requested from pipeline | ||
convexPath | PathBuilding.InkPath2D | Convex hulls sequence, could be requested from pipeline or configured as last pipeline stage when build control points to be available | ||
mergedPath | PathBuilding.InkPath2D | Simple (non-self-intersecting) polygon (with holes) - sequence of 1 polygon, default last pipeline stage result | ||
ink | PathBuilding.InterpolatedSpline|PathBuilding.InkPath2D|PathBuilding.Polygon | Renderable geomtetry, depends from underlying brush and configured pipeline | ||
bounds | Common.Rect | Stroke bounds | ||
compressionType | Stroke.CompressionType | <optional> | AUTO | Serialization configuration |
precisionSchema | Serialization.PrecisionDetection.PrecisionSchema | Precision schema |
Since:
- version 1.0
Examples
app://rendering/stroke/Gradient Custom render mode URI
will://rasterization/3.0/blend-mode/DestinationOut Blend mode represented as render mode URI
Extends
Methods
buildPath(settingsopt)
Process underlying spline through the pipeline.Single thread implementation.Not recommended to use. Use init method if possible.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
settings | PathBuilding.InkBuilderSettings | <optional> |
clone(refPathopt, keepIDopt) → Stroke
Creates new stroke, based on current data
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
refPath | boolean | <optional> | true | By default ink path reffers source stroke path, when false path is cloned when available |
keepID | boolean | <optional> | false | By default new stroke instance has own id, to keep the same id this arg should be true |
Returns:
New stroke
Type
getSensorPoint(index) → InkInput.SensorPoint
Allocates a sensor data for a particular point when sensor data is avialable for underlyin stroke
Parameters:
Name | Type | Description |
---|---|---|
index | int | Path point index |
Returns:
Underlying sensor point when sensorData is available
Type
(async) init(settingsopt)
Process underlying spline through the pipeline
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
settings | PathBuilding.InkBuilderSettings | <optional> |
slice(fragment) → Stroke
Creates new stroke based on current
Parameters:
Name | Type | Description |
---|---|---|
fragment | PathBuilding.SplineFragment | Path part descriptor |
Returns:
Stroke slice
Type
split(fragments) → {Array.<Stroke>}
Split stroke
Parameters:
Name | Type | Description |
---|---|---|
fragments | Array.<PathBuilding.SplineFragment> | Manipulation intersection fragments |
Returns:
sub-strokes
Type
Array.<Stroke>
transform(matrix)
Transform stroke
Parameters:
Name | Type | Description |
---|---|---|
matrix | Common.Matrix | Transform matrix |
transformSelf(matrix)
Self transform stroke
Parameters:
Name | Type | Description |
---|---|---|
matrix | Common.Matrix | Transform matrix |
(static) createInstance(brush, points, layout, pointPropsopt, randomSeed, tsopt, tfopt) → Stroke
Creates Stroke instance
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
brush | Rendering.Brush|URI | Brush descriptor | ||
points | Float32Array | Control path points | ||
layout | Array.<PathBuilding.PathPoint.Property> | Control path points layout | ||
pointProps | PathBuilding.PathPointProperties | <optional> | Static values used when the layout does not include variable ones | |
randomSeed | int | Particles random seed | ||
ts | float | <optional> | 0 | Defines first stroke segment |
tf | float | <optional> | 1 | Defines last stroke segment |
Returns:
stroke instance
Type
(abstract, static) onPipeline(stroke) → PathBuilding.InkBuilderSettings
Pipeline processing custom configuration. Implemntation is optional.
Parameters:
Name | Type | Description |
---|---|---|
stroke | Stroke | Pipeline input |
Returns:
User defined InkBuilder settings
Type
PathBuilding.InkBuilderSettings
Type Definitions
CompressionType
Enumeration of stroke serialization options
Properties:
Name | Type | Description |
---|---|---|
AUTO | object | Stroke spline points will be compressed |
via manually provided precision schema via precision detector which computes optimal precision schema - to activate it, provide PrecisionCalculator implementation as InkCodec property precisionCalculator | ||
NONE | object | Stroke spline points won't be modified |
COMPUTED | object | Precision schema is already provided, stroke compression is available |