Class: InkPathProducer
InkPathProducer()
Provides parallel path building of strokes over all available CPU cores## Constructor
new InkPathProducer()
Extends
- Threads.ThreadPool
Methods
(async) broadcast()
Bulk execution of action to all workers
Overrides:
- Threads.ThreadPool#broadcast
(async) build(strokes, settings)
Parameters:
Name | Type | Description |
---|---|---|
strokes | Array.<Stroke> | |
settings | PathBuilding.InkBuilderSettings | Compliant settings are: lastPipelineStage, keepAllData, errorThreshold, keepSplineParameters |
(abstract) buildRequestMessage() → {any}
Build message for particular action. Implementation is not required. broadcast relies on this method.
Overrides:
- Threads.ThreadPool#buildRequestMessage
Returns:
message Worker request
Type
any
close()
Terminate all underlying workers
Overrides:
- Threads.ThreadPool#close
(async) importBrushes(brushes)
Parameters:
Name | Type | Description |
---|---|---|
brushes | Array.<Rendering.Brush> |
(async) open(srcopt)
Generate n workers based on CPU cores. Invokes worker INIT action.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src | URI | <optional> | Worker location.Defaults to /node_modules/digital-ink/workers/${name}Param is required in DedicatedWorkerGlobalScope.It is also required when underlying env is not connected with node_modules structure. |
Overrides:
- Threads.ThreadPool#open
(abstract) recieve(message)
Worker response handler
Parameters:
Name | Type | Description |
---|---|---|
message | any | Worker response |
Overrides:
- Threads.ThreadPool#recieve
reject()
Action reject
Overrides:
- Threads.ThreadPool#reject
resolve(value)
Action resolve
Parameters:
Name | Type | Description |
---|---|---|
value | any | Produced value |
Overrides:
- Threads.ThreadPool#resolve
send(index, message)
Send a message to particular worker
Parameters:
Name | Type | Description |
---|---|---|
index | int | Target worker. Property 'worker' in recieved message tells where response is coming from. |
message | any | Worker request |
Overrides:
- Threads.ThreadPool#send
(abstract) updateProgress(value, expected, stroke)
Reports build progress
Parameters:
Name | Type | Description |
---|---|---|
value | float | Percent of built strokes |
expected | int | Count of strokes that are not processed yet |
stroke | Stroke | Processed stroke |