Optionalname: string = "TextureCompressor"The worker name to be initialized
Optionalconfig: { controlHash?: boolean; debug?: boolean } = {}Worker initialization options
OptionalcontrolHash?: booleanShould use control hash?
Optionaldebug?: booleanShould the worker run in debug mode?
The name of this worker.
StaticWORKER_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.
Optionaloptions: { debug?: boolean; hash?: string } = {}Optionaldebug?: booleanThe debug option.
Optionalhash?: stringThe precomputed hash.
Copy a buffer.
Buffer used to create the image data.
Optionaloptions: { debug?: boolean; hash?: string; out?: ArrayBuffer } = {}Optionaldebug?: booleanThe debug option.
Optionalhash?: stringThe precomputed hash.
Optionalout?: 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.
Optionalargs: any[] = []An array of parameters with which to call the requested function
Optionaltransfer: 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.
Optionaloptions: { debug?: boolean; hash?: string; out?: ArrayBuffer } = {}Optionaldebug?: booleanThe debug option.
Optionalhash?: stringThe precomputed hash.
Optionalout?: 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.
Optionaloptions: { debug?: boolean; hash?: string; out?: ArrayBuffer } = {}Optionaldebug?: booleanThe debug option.
Optionalhash?: stringThe precomputed hash.
Optionalout?: 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.