Optional
name: string = "TextureCompressor"The worker name to be initialized
Optional
config: { controlHash?: boolean; debug?: boolean } = {}Worker initialization options
Optional
controlHash?: booleanShould use control hash?
Optional
debug?: booleanShould the worker run in debug mode?
The name of this worker.
Static
WORKER_A path reference to the JavaScript file which provides companion worker-side functionality.
A Promise which resolves once the Worker is ready to accept tasks
Process the non-blocking image compression to a base64 string.
Buffer used to create the image data.
Buffered image width.
Buffered image height.
Optional
options: { debug?: boolean; hash?: string } = {}Optional
debug?: booleanThe debug option.
Optional
hash?: stringThe precomputed hash.
Copy a buffer.
Buffer used to create the image data.
Optional
options: { debug?: boolean; hash?: string; out?: ArrayBuffer } = {}Optional
debug?: booleanThe debug option.
Optional
hash?: stringThe precomputed hash.
Optional
out?: ArrayBufferThe output buffer to copy the pixels to. May be detached.
Execute a task on a specific Worker.
The named function to execute on the worker. This function must first have been loaded.
Optional
args: any[] = []An array of parameters with which to call the requested function
Optional
transfer: any[] = []An array of transferable objects which are transferred to the worker thread. See https://developer.mozilla.org/en-US/docs/Glossary/Transferable_objects
A Promise which resolves with the returned result of the function once complete.
Expand a buffer in RED format to a buffer in RGBA format.
Buffer used to create the image data.
Buffered image width.
Buffered image height.
Optional
options: { debug?: boolean; hash?: string; out?: ArrayBuffer } = {}Optional
debug?: booleanThe debug option.
Optional
hash?: stringThe precomputed hash.
Optional
out?: ArrayBufferThe output buffer to write the expanded pixels to. May be detached.
Load a function onto a given Worker. The function must be a pure function with no external dependencies or requirements on global scope.
The name of the function to load
A reference to the function that should be loaded
A Promise which resolves once the Worker has loaded the function.
Reduce a buffer in RGBA format to a buffer in RED format.
Buffer used to create the image data.
Buffered image width.
Buffered image height.
Optional
options: { debug?: boolean; hash?: string; out?: ArrayBuffer } = {}Optional
debug?: booleanThe debug option.
Optional
hash?: stringThe precomputed hash.
Optional
out?: ArrayBufferThe output buffer to write the reduced pixels to. May be detached.
Wrapper for a web worker meant to convert a pixel buffer to the specified image format and quality and return a base64 image.