
This delegates loading of Wasm modules to Webpack itself, making wrapper code simpler. Emscripten-generated modules are still using custom loading glue as they're not compatible with Webpack.
21 lines
466 B
TypeScript
21 lines
466 B
TypeScript
import { resize } from '../../../codecs/hqx/pkg';
|
|
import { HqxOptions } from './processor-meta';
|
|
|
|
export async function hqx(
|
|
data: ImageData,
|
|
opts: HqxOptions,
|
|
): Promise<ImageData> {
|
|
const input = data;
|
|
const result = resize(
|
|
new Uint32Array(input.data.buffer),
|
|
input.width,
|
|
input.height,
|
|
opts.factor,
|
|
);
|
|
return new ImageData(
|
|
new Uint8ClampedArray(result.buffer),
|
|
data.width * opts.factor,
|
|
data.height * opts.factor,
|
|
);
|
|
}
|