@takumi-rs/wasm 0.66.5 → 0.66.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pkg/takumi_wasm.d.ts +30 -1
- package/pkg/takumi_wasm.js +17 -0
- package/pkg/takumi_wasm_bg.wasm +0 -0
package/package.json
CHANGED
package/pkg/takumi_wasm.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type RenderOptions = {
|
|
|
18
18
|
* The format of the image.
|
|
19
19
|
* @default "png"
|
|
20
20
|
*/
|
|
21
|
-
format?: "png" | "jpeg" | "webp",
|
|
21
|
+
format?: "png" | "jpeg" | "webp" | "raw",
|
|
22
22
|
/**
|
|
23
23
|
* The quality of JPEG format (0-100).
|
|
24
24
|
*/
|
|
@@ -82,20 +82,49 @@ export type AnimationFrameSource = {
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* The main renderer for Takumi image rendering engine.
|
|
87
|
+
*/
|
|
85
88
|
export class Renderer {
|
|
86
89
|
free(): void;
|
|
87
90
|
[Symbol.dispose](): void;
|
|
91
|
+
/**
|
|
92
|
+
* Clears the renderer's internal image store.
|
|
93
|
+
*/
|
|
88
94
|
clearImageStore(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Loads a font into the renderer.
|
|
97
|
+
*/
|
|
89
98
|
loadFont(font: Font): void;
|
|
90
99
|
/**
|
|
91
100
|
* @deprecated use `loadFont` instead.
|
|
92
101
|
*/
|
|
93
102
|
loadFontWithInfo(font: Font): void;
|
|
103
|
+
/**
|
|
104
|
+
* Measures a node tree and returns layout information.
|
|
105
|
+
*/
|
|
94
106
|
measure(node: AnyNode, options?: RenderOptions | null): MeasuredNode;
|
|
107
|
+
/**
|
|
108
|
+
* Creates a new Renderer instance.
|
|
109
|
+
*/
|
|
95
110
|
constructor();
|
|
111
|
+
/**
|
|
112
|
+
* Puts a persistent image into the renderer's internal store.
|
|
113
|
+
*/
|
|
96
114
|
putPersistentImage(data: ImageSource): void;
|
|
115
|
+
/**
|
|
116
|
+
* Renders a node tree into an image buffer.
|
|
117
|
+
*/
|
|
97
118
|
render(node: AnyNode, options?: RenderOptions | null): Uint8Array;
|
|
119
|
+
/**
|
|
120
|
+
* Renders an animation sequence into a buffer.
|
|
121
|
+
*/
|
|
98
122
|
renderAnimation(frames: AnimationFrameSource[], options: RenderAnimationOptions): Uint8Array;
|
|
123
|
+
/**
|
|
124
|
+
* Renders a node tree into a data URL.
|
|
125
|
+
*
|
|
126
|
+
* `raw` format is not supported for data URL.
|
|
127
|
+
*/
|
|
99
128
|
renderAsDataUrl(node: AnyNode, options: RenderOptions): string;
|
|
100
129
|
}
|
|
101
130
|
|
package/pkg/takumi_wasm.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/* @ts-self-types="./takumi_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The main renderer for Takumi image rendering engine.
|
|
5
|
+
*/
|
|
3
6
|
export class Renderer {
|
|
4
7
|
__destroy_into_raw() {
|
|
5
8
|
const ptr = this.__wbg_ptr;
|
|
@@ -11,10 +14,14 @@ export class Renderer {
|
|
|
11
14
|
const ptr = this.__destroy_into_raw();
|
|
12
15
|
wasm.__wbg_renderer_free(ptr, 0);
|
|
13
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Clears the renderer's internal image store.
|
|
19
|
+
*/
|
|
14
20
|
clearImageStore() {
|
|
15
21
|
wasm.renderer_clearImageStore(this.__wbg_ptr);
|
|
16
22
|
}
|
|
17
23
|
/**
|
|
24
|
+
* Loads a font into the renderer.
|
|
18
25
|
* @param {Font} font
|
|
19
26
|
*/
|
|
20
27
|
loadFont(font) {
|
|
@@ -48,6 +55,7 @@ export class Renderer {
|
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
58
|
+
* Measures a node tree and returns layout information.
|
|
51
59
|
* @param {AnyNode} node
|
|
52
60
|
* @param {RenderOptions | null} [options]
|
|
53
61
|
* @returns {MeasuredNode}
|
|
@@ -67,6 +75,9 @@ export class Renderer {
|
|
|
67
75
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
68
76
|
}
|
|
69
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new Renderer instance.
|
|
80
|
+
*/
|
|
70
81
|
constructor() {
|
|
71
82
|
const ret = wasm.renderer_new();
|
|
72
83
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -74,6 +85,7 @@ export class Renderer {
|
|
|
74
85
|
return this;
|
|
75
86
|
}
|
|
76
87
|
/**
|
|
88
|
+
* Puts a persistent image into the renderer's internal store.
|
|
77
89
|
* @param {ImageSource} data
|
|
78
90
|
*/
|
|
79
91
|
putPersistentImage(data) {
|
|
@@ -90,6 +102,7 @@ export class Renderer {
|
|
|
90
102
|
}
|
|
91
103
|
}
|
|
92
104
|
/**
|
|
105
|
+
* Renders a node tree into an image buffer.
|
|
93
106
|
* @param {AnyNode} node
|
|
94
107
|
* @param {RenderOptions | null} [options]
|
|
95
108
|
* @returns {Uint8Array}
|
|
@@ -113,6 +126,7 @@ export class Renderer {
|
|
|
113
126
|
}
|
|
114
127
|
}
|
|
115
128
|
/**
|
|
129
|
+
* Renders an animation sequence into a buffer.
|
|
116
130
|
* @param {AnimationFrameSource[]} frames
|
|
117
131
|
* @param {RenderAnimationOptions} options
|
|
118
132
|
* @returns {Uint8Array}
|
|
@@ -138,6 +152,9 @@ export class Renderer {
|
|
|
138
152
|
}
|
|
139
153
|
}
|
|
140
154
|
/**
|
|
155
|
+
* Renders a node tree into a data URL.
|
|
156
|
+
*
|
|
157
|
+
* `raw` format is not supported for data URL.
|
|
141
158
|
* @param {AnyNode} node
|
|
142
159
|
* @param {RenderOptions} options
|
|
143
160
|
* @returns {string}
|
package/pkg/takumi_wasm_bg.wasm
CHANGED
|
Binary file
|