Skip to content

Commit

Permalink
Add wasm package for web-demo
Browse files Browse the repository at this point in the history
  • Loading branch information
twitu committed Apr 29, 2024
1 parent e4c6f0d commit a04cd66
Show file tree
Hide file tree
Showing 6 changed files with 419 additions and 0 deletions.
1 change: 1 addition & 0 deletions spritefire/pkg/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
14 changes: 14 additions & 0 deletions spritefire/pkg/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "spritefire",
"version": "0.1.0",
"files": [
"spritefire_bg.wasm",
"spritefire.js",
"spritefire.d.ts"
],
"module": "spritefire.js",
"types": "spritefire.d.ts",
"sideEffects": [
"./snippets/*"
]
}
72 changes: 72 additions & 0 deletions spritefire/pkg/spritefire.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* tslint:disable */
/* eslint-disable */
/**
*/
export function set_db(): void;
/**
* @param {Uint8Array} buf
* @param {number} pool_size
* @returns {string}
*/
export function process_img(buf: Uint8Array, pool_size: number): string;
/**
* @param {ImageData} img_data
* @param {number} pool_size
* @returns {string}
*/
export function process_img_data(img_data: ImageData, pool_size: number): string;
/**
* Chroma subsampling format
*/
export enum ChromaSampling {
/**
* Both vertically and horizontally subsampled.
*/
Cs420 = 0,
/**
* Horizontally subsampled.
*/
Cs422 = 1,
/**
* Not subsampled.
*/
Cs444 = 2,
/**
* Monochrome.
*/
Cs400 = 3,
}

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly set_db: () => void;
readonly process_img: (a: number, b: number, c: number, d: number) => void;
readonly process_img_data: (a: number, b: number, c: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
*
* @returns {InitOutput}
*/
export function initSync(module: SyncInitInput): InitOutput;

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
Loading

0 comments on commit a04cd66

Please sign in to comment.