Resize working

This commit is contained in:
Jake Archibald
2020-09-21 15:18:33 +01:00
parent 21fc70cbdd
commit 2a6a83f56d
4 changed files with 4 additions and 6 deletions

View File

@@ -1,5 +1,3 @@
import * as __wbg_star0 from 'env';
let wasm; let wasm;
let cachegetUint8Memory0 = null; let cachegetUint8Memory0 = null;
@@ -113,7 +111,6 @@ async function init(input) {
input = import.meta.url.replace(/\.js$/, '_bg.wasm'); input = import.meta.url.replace(/\.js$/, '_bg.wasm');
} }
const imports = {}; const imports = {};
imports['env'] = __wbg_star0;
if ( if (
typeof input === 'string' || typeof input === 'string' ||

View File

@@ -2,7 +2,7 @@ FROM emscripten/emsdk:1.39.19 AS wasm-tools
WORKDIR /opt/wasm-tools WORKDIR /opt/wasm-tools
RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1 RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1
FROM rust:1.44-stretch AS rust FROM rust:1.46.0-slim-buster AS rust
RUN rustup target add wasm32-unknown-unknown RUN rustup target add wasm32-unknown-unknown
COPY --from=wasm-tools /emsdk/upstream/bin/wasm-opt /emsdk/upstream/bin/clang /usr/local/bin/ COPY --from=wasm-tools /emsdk/upstream/bin/wasm-opt /emsdk/upstream/bin/clang /usr/local/bin/
COPY --from=wasm-tools /emsdk/upstream/lib/ /usr/local/lib/ COPY --from=wasm-tools /emsdk/upstream/lib/ /usr/local/lib/

View File

@@ -31,8 +31,8 @@ async function demo() {
const data = ctx.getImageData(0, 0, img.width, img.height); const data = ctx.getImageData(0, 0, img.width, img.height);
const result = await api.resize(data, { const result = await api.resize(data, {
fitMethod: 'stretch', fitMethod: 'stretch',
height: 20, height: 200,
width: 20, width: 200,
linearRGB: false, linearRGB: false,
premultiply: true, premultiply: true,
method: 'lanczos3', method: 'lanczos3',
@@ -49,6 +49,7 @@ async function demo() {
canvas.height = result.height; canvas.height = result.height;
const ctx = canvas.getContext('2d')!; const ctx = canvas.getContext('2d')!;
ctx.putImageData(result, 0, 0); ctx.putImageData(result, 0, 0);
document.body.append(canvas);
} }
} }