Create Uint8ClampedArray from C++

This commit is contained in:
Ingvar Stepanyan
2020-05-14 16:52:47 +01:00
committed by Ingvar Stepanyan
parent c39383333f
commit 1f35c40d3f
3 changed files with 16 additions and 41 deletions

View File

@@ -15,9 +15,5 @@ export async function process(data: ImageData, opts: QuantizeOptions): Promise<I
:
module.quantize(data.data, data.width, data.height, opts.maxNumColors, opts.dither);
const imgData = new ImageData(new Uint8ClampedArray(result.buffer), result.width, result.height);
module.free_result(imgData.data.byteOffset);
return imgData;
return new ImageData(new Uint8ClampedArray(result), data.width, data.height);
}