Add CanvasKit web engine spike + W0 findings (recipes-web)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import CanvasKitInit from 'canvaskit-wasm';
|
||||
const CK = await CanvasKitInit();
|
||||
console.log('ImageFormat', JSON.stringify(CK.ImageFormat));
|
||||
const surf = CK.MakeSurface(64, 64);
|
||||
const c = surf.getCanvas(); c.clear(CK.Color(255,0,0,255));
|
||||
const img = surf.makeImageSnapshot();
|
||||
for (const k of Object.keys(CK.ImageFormat)) {
|
||||
try { const b = img.encodeToBytes(CK.ImageFormat[k], 90); console.log(k, b ? b.length : null); } catch(e){ console.log(k, 'ERR', String(e).slice(0,80)); }
|
||||
}
|
||||
console.log('columns/readPixels', typeof img.readPixels, typeof img.encodeToBytes);
|
||||
Reference in New Issue
Block a user