Implement alpha premultiplication (#507)

* Implement alpha premultiplication

* Add benchmark to resize

* Only display "Premultiply alpha" if it's one of the rust resize types.

* Add comment about division by zero
This commit is contained in:
Surma
2019-03-08 11:18:59 +00:00
committed by Jake Archibald
parent d29cf2ffa7
commit 45221c0b03
12 changed files with 127 additions and 35 deletions

View File

@@ -45,7 +45,7 @@ export async function resize(data: ImageData, opts: WorkerResizeOptions): Promis
const result = wasm_bindgen.resize(
new Uint8Array(input.data.buffer), input.width, input.height, opts.width, opts.height,
resizeMethods.indexOf(opts.method),
resizeMethods.indexOf(opts.method), opts.premultiply,
);
return new ImageData(new Uint8ClampedArray(result.buffer), opts.width, opts.height);