mesh v2 at /v2/mesh
This commit is contained in:
parent
aee9fd6ed7
commit
6566c45f9a
85 changed files with 138198 additions and 1 deletions
31
src2/load/png.js
Normal file
31
src2/load/png.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
|
||||
import { PNG } from '../ext/pngjs.esm.js';
|
||||
|
||||
export const load = {
|
||||
PNG: {
|
||||
parse: function(data, opt = {}) {
|
||||
let img = new PNG();
|
||||
let progress = opt.progress || noop;
|
||||
let ondone = opt.done || noop;
|
||||
let onerror = opt.error || noop;
|
||||
let onmeta = opt.meta || noop;
|
||||
|
||||
img.on('metadata', function(meta) {
|
||||
onmeta(meta);
|
||||
});
|
||||
|
||||
img.on('parsed', function(data) {
|
||||
ondone(data);
|
||||
});
|
||||
|
||||
img.on('error', function(err) {
|
||||
onerror(err);
|
||||
});
|
||||
|
||||
img.parse(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function noop() {}
|
||||
Loading…
Reference in a new issue