Skip to main content

Class: Stroke

Stroke(brush, spline, inkPathopt, sensorDataopt)

Stroke model

Constructor

new Stroke(brush, spline, inkPathopt, sensorDataopt)

Parameters:
NameTypeAttributesDescription
brushRendering.Brush|URIBrush reference
splinePathBuilding.Spline|PathBuilding.PipelineDataUnderlying path geometry information. When PipelineData it should contains all related paths.
inkPathPathBuilding.InterpolatedSpline|PathBuilding.InkPath2D<optional>Ink renderable geometry
sensorDataInkInput.SensorData<optional>Pointer input (spline source)
Properties:
NameTypeAttributesDefaultDescription
idGUIDStroke identifier
uriURIStroke identifier as URI
brushRendering.2D.Brush2D|Rendering.WebGL.BrushGLStroke brush
randomSeedintParticles random seed, available when brush is BrushGL
renderModeURIDefines custom stroke specifics, encodes BlendMode for generic strokes
blendModeRendering.BlendModeDepends from renderMode, default render modes provides blendMode
colorCommon.ColorStroke color
styleRendering.InkStyleStroke stylesheet
sensorDataInkInput.SensorDataKeeps sensor data
sensorDataOffsetint<optional>0Index of points mapping between raw and processed paths (spline points offset)
sensorDataMappingUint32ArrayExplicit mapping between indices of Path and ink SensorChannelsContext data, used when input rate is very high and provides unwanted points
splinePathBuilding.SplineControl points
interpolatedSplinePathBuilding.InterpolatedSplineInterpolated points, available for BrushGL or when is requested from pipeline
shapesPathPathBuilding.InkPath2DBrush samples sequence, available for shapes rendering with Brush2D or when is requested from pipeline
convexPathPathBuilding.InkPath2DConvex hulls sequence, could be requested from pipeline or configured as last pipeline stage when build control points to be available
mergedPathPathBuilding.InkPath2DSimple (non-self-intersecting) polygon (with holes) - sequence of 1 polygon, default last pipeline stage result
inkPathBuilding.InterpolatedSpline|PathBuilding.InkPath2D|PathBuilding.PolygonRenderable geomtetry, depends from underlying brush and configured pipeline
boundsCommon.RectStroke bounds
compressionTypeStroke.CompressionType<optional>AUTOSerialization configuration
precisionSchemaSerialization.PrecisionDetection.PrecisionSchemaPrecision 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:
NameTypeAttributesDescription
settingsPathBuilding.InkBuilderSettings<optional>

clone(refPathopt, keepIDopt) → Stroke

Creates new stroke, based on current data

Parameters:
NameTypeAttributesDefaultDescription
refPathboolean<optional>trueBy default ink path reffers source stroke path, when false path is cloned when available
keepIDboolean<optional>falseBy default new stroke instance has own id, to keep the same id this arg should be true
Returns:

New stroke

Type

Stroke

getSensorPoint(index) → InkInput.SensorPoint

Allocates a sensor data for a particular point when sensor data is avialable for underlyin stroke

Parameters:
NameTypeDescription
indexintPath point index
Returns:

Underlying sensor point when sensorData is available

Type

InkInput.SensorPoint

(async) init(settingsopt)

Process underlying spline through the pipeline

Parameters:
NameTypeAttributesDescription
settingsPathBuilding.InkBuilderSettings<optional>

slice(fragment) → Stroke

Creates new stroke based on current

Parameters:
NameTypeDescription
fragmentPathBuilding.SplineFragmentPath part descriptor
Returns:

Stroke slice

Type

Stroke

split(fragments) → {Array.<Stroke>}

Split stroke

Parameters:
NameTypeDescription
fragmentsArray.<PathBuilding.SplineFragment>Manipulation intersection fragments
Returns:

sub-strokes

Type

Array.<Stroke>

transform(matrix)

Transform stroke

Parameters:
NameTypeDescription
matrixCommon.MatrixTransform matrix

transformSelf(matrix)

Self transform stroke

Parameters:
NameTypeDescription
matrixCommon.MatrixTransform matrix

(static) createInstance(brush, points, layout, pointPropsopt, randomSeed, tsopt, tfopt) → Stroke

Creates Stroke instance

Parameters:
NameTypeAttributesDefaultDescription
brushRendering.Brush|URIBrush descriptor
pointsFloat32ArrayControl path points
layoutArray.<PathBuilding.PathPoint.Property>Control path points layout
pointPropsPathBuilding.PathPointProperties<optional>Static values used when the layout does not include variable ones
randomSeedintParticles random seed
tsfloat<optional>0Defines first stroke segment
tffloat<optional>1Defines last stroke segment
Returns:

stroke instance

Type

Stroke

(abstract, static) onPipeline(stroke) → PathBuilding.InkBuilderSettings

Pipeline processing custom configuration. Implemntation is optional.

Parameters:
NameTypeDescription
strokeStrokePipeline input
Returns:

User defined InkBuilder settings

Type

PathBuilding.InkBuilderSettings

Type Definitions

CompressionType

Enumeration of stroke serialization options

Properties:
NameTypeDescription
AUTOobjectStroke 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
NONEobjectStroke spline points won't be modified
COMPUTEDobjectPrecision schema is already provided, stroke compression is available

Home