@pixagram/renderart 0.4.1 → 0.4.5

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/README.md CHANGED
@@ -4,15 +4,9 @@ High-performance pixel art rendering engines with GPU (WebGL2) and CPU (WASM) su
4
4
 
5
5
  ## Features
6
6
 
7
- - **CRT Effect** (2-32x) - Classic CRT display simulation with barrel distortion, scanlines, and shadow mask
8
- - **HEX Upscaling** (2-32x) - Transform pixel art into hexagonal grid representations
9
- - **XBRZ Scaling** (2-6x) - Edge-preserving pixel art scaling algorithm
10
-
11
- All engines support:
12
- - ⚡ **GPU acceleration** via WebGL2 (CRT, HEX)
13
- - 🦀 **CPU fallback** via Rust/WASM (all engines)
14
- - 🎨 **Customizable presets** and fine-grained options
15
- - 🔄 **Auto-initialization** - WASM loads automatically on first use
7
+ - **CRT Effect** - Classic CRT display simulation
8
+ - **HEX Upscaling** - Hexagonal grid transformation
9
+ - **XBRZ Scaling** - Edge-preserving pixel art scaling
16
10
 
17
11
  ## Installation
18
12
 
@@ -20,57 +14,33 @@ All engines support:
20
14
  npm install @pixagram/renderart
21
15
  ```
22
16
 
23
- ## ⚠️ Building from Source (Required)
24
-
25
- The package includes placeholder WASM. You **must** build the actual WASM module:
26
-
27
- ```bash
28
- # Prerequisites: Rust + wasm-pack
29
- # Install wasm-pack: https://rustwasm.github.io/wasm-pack/installer/
30
-
31
- cd node_modules/@pixagram/renderart
32
- npm run build:wasm
33
- ```
34
-
35
- Or build everything:
36
- ```bash
37
- npm run build
38
- ```
39
-
40
17
  ## Quick Start
41
18
 
19
+ ### GPU Only (Simplest)
20
+
42
21
  ```typescript
43
22
  import { RenderArt } from '@pixagram/renderart';
44
23
 
45
- // Create renderer (auto-initializes WASM)
46
- const renderer = await RenderArt.create();
47
-
48
- // Get your image data
49
- const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
50
-
51
- // Apply CRT effect
52
- const crtResult = await renderer.crt.render(imageData, { scale: 3 });
53
-
54
- // Apply HEX effect
55
- const hexResult = await renderer.hex.render(imageData, { scale: 16 });
56
-
57
- // Apply XBRZ scaling
58
- const xbrzResult = await renderer.xbrz.render(imageData, { scale: 4 });
59
-
60
- // Use the result
61
- ctx.putImageData(new ImageData(crtResult.data, crtResult.width, crtResult.height), 0, 0);
24
+ const renderer = RenderArt.createGpuOnly();
25
+ const result = renderer.crt.renderSync(imageData, { scale: 3 });
62
26
  ```
63
27
 
64
- ### GPU-Only Mode (Sync, No WASM)
28
+ ### With WASM/CPU Support
65
29
 
66
30
  ```typescript
67
- import { RenderArt } from '@pixagram/renderart';
31
+ // 1. Import WASM module
32
+ import init, * as wasm from '@pixagram/renderart/wasm';
68
33
 
69
- // Create GPU-only renderer (no WASM loading)
70
- const renderer = RenderArt.createGpuOnly();
34
+ // 2. Import renderart
35
+ import { initWasm, RenderArt } from '@pixagram/renderart';
71
36
 
72
- // Synchronous rendering
73
- const result = renderer.crt.renderSync(imageData, { scale: 3 });
37
+ // 3. Initialize WASM
38
+ await init();
39
+ initWasm(wasm);
40
+
41
+ // 4. Use renderers
42
+ const renderer = RenderArt.create();
43
+ const result = renderer.crt.render(imageData, { scale: 3 });
74
44
  ```
75
45
 
76
46
  ### Direct Renderer Usage
@@ -78,144 +48,68 @@ const result = renderer.crt.renderSync(imageData, { scale: 3 });
78
48
  ```typescript
79
49
  import { CrtGpuRenderer } from '@pixagram/renderart';
80
50
 
81
- // Use GPU renderer directly (no WASM needed)
82
51
  const crt = CrtGpuRenderer.create();
83
52
  const result = crt.render(imageData, { scale: 3 });
84
53
  crt.dispose();
85
54
  ```
86
55
 
87
- ## Webpack Configuration
88
-
89
- For webpack 5, add to your webpack.config.js:
90
-
91
- ```javascript
92
- module.exports = {
93
- experiments: {
94
- asyncWebAssembly: true,
95
- },
96
- module: {
97
- rules: [
98
- {
99
- test: /\.wasm$/,
100
- type: 'webassembly/async',
101
- },
102
- ],
103
- },
104
- };
105
- ```
106
-
107
- ## API Reference
108
-
109
- ### RenderArt (Unified API)
110
-
111
- ```typescript
112
- // With CPU fallback (auto-loads WASM)
113
- const renderer = await RenderArt.create();
114
-
115
- // GPU-only mode
116
- const renderer = RenderArt.createGpuOnly();
117
-
118
- // Access capabilities
119
- console.log(renderer.capabilities);
120
- // { gpu: true, cpu: true, maxTextureSize: 16384, recommendedBackend: 'gpu' }
121
-
122
- // Cleanup
123
- renderer.dispose();
124
- ```
56
+ ## API
125
57
 
126
- ### CRT Engine
58
+ ### CRT Options
127
59
 
128
60
  ```typescript
129
- // Async with auto backend selection
130
- const result = await renderer.crt.render(imageData, {
131
- scale: 3, // 2-32 (default: 3)
61
+ {
62
+ scale: 3, // 2-32
132
63
  warpX: 0.015, // Horizontal curvature
133
- warpY: 0.02, // Vertical curvature
134
- scanHardness: -4.0, // Scanline sharpness
135
- scanOpacity: 0.5, // Scanline intensity
136
- maskOpacity: 0.3, // Shadow mask intensity
64
+ warpY: 0.02, // Vertical curvature
65
+ scanHardness: -4.0,
66
+ scanOpacity: 0.5,
67
+ maskOpacity: 0.3,
137
68
  enableWarp: true,
138
69
  enableScanlines: true,
139
70
  enableMask: true,
140
- backend: 'auto', // 'gpu', 'cpu', or 'auto'
141
- });
142
-
143
- // With preset
144
- const result = await renderer.crt.render(imageData, 'authentic');
145
- // Presets: 'default', 'authentic', 'subtle', 'flat'
146
-
147
- // Sync GPU-only
148
- const result = renderer.crt.renderSync(imageData, { scale: 3 });
71
+ }
149
72
  ```
150
73
 
151
- ### HEX Engine
74
+ ### HEX Options
152
75
 
153
76
  ```typescript
154
- const result = await renderer.hex.render(imageData, {
155
- scale: 16, // 2-32 (default: 16)
156
- orientation: 'flat-top', // 'flat-top' or 'pointy-top'
157
- drawBorders: true,
77
+ {
78
+ scale: 16, // 2-32
79
+ orientation: 'flat-top', // or 'pointy-top'
80
+ drawBorders: false,
158
81
  borderColor: '#282828',
159
82
  borderThickness: 1,
160
- backgroundColor: 'transparent',
161
- });
162
-
163
- // Presets: 'default', 'bordered', 'pointy'
164
- const result = await renderer.hex.render(imageData, 'bordered');
165
-
166
- // Get output dimensions
167
- const dims = renderer.hex.getDimensions(64, 64, { scale: 16 });
83
+ }
168
84
  ```
169
85
 
170
- ### XBRZ Engine (CPU Only)
86
+ ### XBRZ Options (CPU only)
171
87
 
172
88
  ```typescript
173
- const result = await renderer.xbrz.render(imageData, {
174
- scale: 4, // 2-6 (default: 2)
89
+ {
90
+ scale: 4, // 2-6
175
91
  luminanceWeight: 1.0,
176
92
  equalColorTolerance: 30,
177
- dominantDirectionThreshold: 4.4,
178
- steepDirectionThreshold: 2.2,
179
- });
180
-
181
- // Presets: 'default', 'sharp', 'smooth'
182
- const result = await renderer.xbrz.render(imageData, 'sharp');
93
+ }
183
94
  ```
184
95
 
185
- ## Backend Support
186
-
187
- | Engine | GPU (WebGL2) | CPU (WASM) |
188
- |--------|--------------|------------|
189
- | CRT | ✅ Primary | ✅ Fallback |
190
- | HEX | ✅ Primary | ✅ Fallback |
191
- | XBRZ | ❌ N/A | ✅ Only |
192
-
193
- ## Browser Support
96
+ ## Webpack Configuration
194
97
 
195
- - Chrome 79+
196
- - Firefox 75+
197
- - Safari 15+
198
- - Edge 79+
98
+ ```javascript
99
+ module.exports = {
100
+ experiments: {
101
+ asyncWebAssembly: true,
102
+ },
103
+ };
104
+ ```
199
105
 
200
- ## Development
106
+ ## Building from Source
201
107
 
202
108
  ```bash
203
- # Clone and install
204
- git clone https://github.com/pixagram/renderart.git
205
- cd renderart
206
- npm install
207
-
208
- # Build WASM (requires Rust + wasm-pack)
209
- npm run build:wasm
210
-
211
- # Build TypeScript
212
- npm run build:ts
213
-
214
- # Full build
215
- npm run build
216
-
217
- # Run tests
218
- npm test
109
+ # Prerequisites: Rust + wasm-pack
110
+ npm run build:wasm # Build WASM
111
+ npm run build:ts # Build TypeScript
112
+ npm run build # Build all
219
113
  ```
220
114
 
221
115
  ## License
package/dist/index.d.mts CHANGED
@@ -190,68 +190,51 @@ declare const HEX_PRESETS: Record<string, Partial<HexOptions>>;
190
190
  /**
191
191
  * WASM Module Loader
192
192
  *
193
- * Handles loading and initialization of the Rust WASM module.
194
- * Auto-initializes on first use.
193
+ * Simple manual initialization pattern.
194
+ * User must call initWasm() with the WASM module before using CPU renderers.
195
195
  */
196
196
 
197
197
  /**
198
- * Initialize WASM module (auto-called on first use)
199
- * Can be called manually to pre-load WASM.
198
+ * Initialize WASM module.
200
199
  *
201
- * @param wasmUrl - Optional URL to the .wasm file.
200
+ * @example
201
+ * ```typescript
202
+ * import init, * as wasmModule from '@pixagram/renderart/dist/renderart_wasm_bg.js';
203
+ * import { initWasm } from '@pixagram/renderart';
204
+ *
205
+ * await init();
206
+ * initWasm(wasmModule);
207
+ * ```
202
208
  */
203
- declare function initWasm(wasmUrl?: string): Promise<void>;
209
+ declare function initWasm(wasmModule: any): void;
204
210
  /** Check if WASM is loaded */
205
211
  declare function isWasmLoaded(): boolean;
206
- /** Check if WASM loading failed */
207
- declare function hasWasmError(): boolean;
208
- /** Get WASM loading error if any */
209
- declare function getWasmError(): Error | null;
210
- /** CRT CPU Renderer using WASM (auto-initializes) */
212
+ /** CRT CPU Renderer using WASM */
211
213
  declare class CrtCpuRenderer {
212
- private initialized;
213
- /** Create and initialize renderer */
214
- static create(): Promise<CrtCpuRenderer>;
215
- /** Initialize (loads WASM if needed) */
216
- init(): Promise<void>;
214
+ /** Create renderer (WASM must be initialized first) */
215
+ static create(): CrtCpuRenderer;
217
216
  /** Check if renderer is ready */
218
217
  isReady(): boolean;
219
218
  /** Render CRT effect */
220
219
  render(input: ImageInput | ImageData, options?: CrtOptions): ImageOutput;
221
- /** Dispose resources */
222
220
  dispose(): void;
223
221
  }
224
- /** HEX CPU Renderer using WASM (auto-initializes) */
222
+ /** HEX CPU Renderer using WASM */
225
223
  declare class HexCpuRenderer {
226
- private initialized;
227
- /** Create and initialize renderer */
228
- static create(): Promise<HexCpuRenderer>;
229
- /** Initialize (loads WASM if needed) */
230
- init(): Promise<void>;
231
- /** Check if renderer is ready */
224
+ static create(): HexCpuRenderer;
232
225
  isReady(): boolean;
233
- /** Render hexagonal effect */
234
226
  render(input: ImageInput | ImageData, options?: HexOptions): ImageOutput;
235
- /** Get output dimensions */
236
227
  getDimensions(srcWidth: number, srcHeight: number, scale: number, orientation?: HexOrientation): {
237
228
  width: number;
238
229
  height: number;
239
230
  };
240
- /** Dispose resources */
241
231
  dispose(): void;
242
232
  }
243
- /** XBRZ CPU Renderer using WASM (auto-initializes) */
233
+ /** XBRZ CPU Renderer using WASM */
244
234
  declare class XbrzCpuRenderer {
245
- private initialized;
246
- /** Create and initialize renderer */
247
- static create(): Promise<XbrzCpuRenderer>;
248
- /** Initialize (loads WASM if needed) */
249
- init(): Promise<void>;
250
- /** Check if renderer is ready */
235
+ static create(): XbrzCpuRenderer;
251
236
  isReady(): boolean;
252
- /** Render xBRZ scaling */
253
237
  render(input: ImageInput | ImageData, options?: XbrzOptions): ImageOutput;
254
- /** Dispose resources */
255
238
  dispose(): void;
256
239
  }
257
240
  /** XBRZ presets */
@@ -260,7 +243,7 @@ declare const XBRZ_PRESETS: Record<string, Partial<XbrzOptions>>;
260
243
  /**
261
244
  * RenderArt - Unified Pixel Art Rendering Engine
262
245
  *
263
- * GPU renderers work standalone. CPU renderers auto-initialize WASM.
246
+ * GPU renderers work standalone. CPU renderers require WASM initialization.
264
247
  */
265
248
 
266
249
  /** CRT rendering engine */
@@ -271,10 +254,9 @@ declare class CrtEngine {
271
254
  constructor(gpuAvailable: boolean);
272
255
  private ensureGpu;
273
256
  private ensureCpu;
274
- /** Render with automatic backend selection */
275
- render(input: ImageInput | ImageData, options?: CrtOptions): Promise<ImageOutput>;
276
- render(input: ImageInput | ImageData, preset: CrtPreset, overrides?: Partial<CrtOptions>): Promise<ImageOutput>;
277
- /** Render synchronously (GPU only) */
257
+ /** Render with options or preset */
258
+ render(input: ImageInput | ImageData, optionsOrPreset?: CrtOptions | CrtPreset): ImageOutput;
259
+ /** Synchronous GPU-only render */
278
260
  renderSync(input: ImageInput | ImageData, options?: CrtOptions): ImageOutput;
279
261
  dispose(): void;
280
262
  }
@@ -286,8 +268,7 @@ declare class HexEngine {
286
268
  constructor(gpuAvailable: boolean);
287
269
  private ensureGpu;
288
270
  private ensureCpu;
289
- render(input: ImageInput | ImageData, options?: HexOptions): Promise<ImageOutput>;
290
- render(input: ImageInput | ImageData, preset: HexPreset, overrides?: Partial<HexOptions>): Promise<ImageOutput>;
271
+ render(input: ImageInput | ImageData, optionsOrPreset?: HexOptions | HexPreset): ImageOutput;
291
272
  renderSync(input: ImageInput | ImageData, options?: HexOptions): ImageOutput;
292
273
  getDimensions(srcWidth: number, srcHeight: number, options?: HexOptions): {
293
274
  width: number;
@@ -295,33 +276,30 @@ declare class HexEngine {
295
276
  };
296
277
  dispose(): void;
297
278
  }
298
- /** XBRZ rendering engine (CPU only) */
279
+ /** XBRZ rendering engine (CPU/WASM only) */
299
280
  declare class XbrzEngine {
300
281
  private cpuRenderer;
301
282
  private ensureCpu;
302
- render(input: ImageInput | ImageData, options?: XbrzOptions): Promise<ImageOutput>;
303
- render(input: ImageInput | ImageData, preset: XbrzPreset, overrides?: Partial<XbrzOptions>): Promise<ImageOutput>;
304
- getDimensions(srcWidth: number, srcHeight: number, scale?: number): {
305
- width: number;
306
- height: number;
307
- };
283
+ render(input: ImageInput | ImageData, optionsOrPreset?: XbrzOptions | XbrzPreset): ImageOutput;
308
284
  dispose(): void;
309
285
  }
310
- /** RenderArt - Unified Pixel Art Rendering Engine */
286
+ /** Main RenderArt instance */
311
287
  declare class RenderArt {
312
288
  readonly crt: CrtEngine;
313
289
  readonly hex: HexEngine;
314
290
  readonly xbrz: XbrzEngine;
315
- private _capabilities;
291
+ readonly capabilities: RendererCapabilities;
316
292
  private constructor();
317
- /** Create RenderArt instance */
293
+ /**
294
+ * Create RenderArt instance.
295
+ * For CPU/WASM support, call initWasm() first.
296
+ */
318
297
  static create(): RenderArt;
319
- /** Create GPU-only instance */
298
+ /**
299
+ * Create GPU-only RenderArt instance (no WASM needed).
300
+ */
320
301
  static createGpuOnly(): RenderArt;
321
- /** Pre-initialize WASM for faster first CPU render */
322
- preloadWasm(wasmUrl?: string): Promise<void>;
323
- get capabilities(): RendererCapabilities;
324
302
  dispose(): void;
325
303
  }
326
304
 
327
- export { type Backend, CRT_PRESETS, CrtCpuRenderer, CrtEngine, CrtGpuRenderer, type CrtOptions, type CrtPreset, HEX_PRESETS, HexCpuRenderer, HexEngine, HexGpuRenderer, type HexOptions, type HexOrientation, type HexPreset, type ImageInput, type ImageOutput, type PixelData, RenderArt, type RenderStats, type Renderer, type RendererCapabilities, XBRZ_PRESETS, XbrzCpuRenderer, XbrzEngine, type XbrzOptions, type XbrzPreset, getWasmError, hasWasmError, hexGetDimensions, initWasm, isWasmLoaded };
305
+ export { type Backend, CRT_PRESETS, CrtCpuRenderer, CrtEngine, CrtGpuRenderer, type CrtOptions, type CrtPreset, HEX_PRESETS, HexCpuRenderer, HexEngine, HexGpuRenderer, type HexOptions, type HexOrientation, type HexPreset, type ImageInput, type ImageOutput, type PixelData, RenderArt, type RenderStats, type Renderer, type RendererCapabilities, XBRZ_PRESETS, XbrzCpuRenderer, XbrzEngine, type XbrzOptions, type XbrzPreset, hexGetDimensions, initWasm, isWasmLoaded };
package/dist/index.d.ts CHANGED
@@ -190,68 +190,51 @@ declare const HEX_PRESETS: Record<string, Partial<HexOptions>>;
190
190
  /**
191
191
  * WASM Module Loader
192
192
  *
193
- * Handles loading and initialization of the Rust WASM module.
194
- * Auto-initializes on first use.
193
+ * Simple manual initialization pattern.
194
+ * User must call initWasm() with the WASM module before using CPU renderers.
195
195
  */
196
196
 
197
197
  /**
198
- * Initialize WASM module (auto-called on first use)
199
- * Can be called manually to pre-load WASM.
198
+ * Initialize WASM module.
200
199
  *
201
- * @param wasmUrl - Optional URL to the .wasm file.
200
+ * @example
201
+ * ```typescript
202
+ * import init, * as wasmModule from '@pixagram/renderart/dist/renderart_wasm_bg.js';
203
+ * import { initWasm } from '@pixagram/renderart';
204
+ *
205
+ * await init();
206
+ * initWasm(wasmModule);
207
+ * ```
202
208
  */
203
- declare function initWasm(wasmUrl?: string): Promise<void>;
209
+ declare function initWasm(wasmModule: any): void;
204
210
  /** Check if WASM is loaded */
205
211
  declare function isWasmLoaded(): boolean;
206
- /** Check if WASM loading failed */
207
- declare function hasWasmError(): boolean;
208
- /** Get WASM loading error if any */
209
- declare function getWasmError(): Error | null;
210
- /** CRT CPU Renderer using WASM (auto-initializes) */
212
+ /** CRT CPU Renderer using WASM */
211
213
  declare class CrtCpuRenderer {
212
- private initialized;
213
- /** Create and initialize renderer */
214
- static create(): Promise<CrtCpuRenderer>;
215
- /** Initialize (loads WASM if needed) */
216
- init(): Promise<void>;
214
+ /** Create renderer (WASM must be initialized first) */
215
+ static create(): CrtCpuRenderer;
217
216
  /** Check if renderer is ready */
218
217
  isReady(): boolean;
219
218
  /** Render CRT effect */
220
219
  render(input: ImageInput | ImageData, options?: CrtOptions): ImageOutput;
221
- /** Dispose resources */
222
220
  dispose(): void;
223
221
  }
224
- /** HEX CPU Renderer using WASM (auto-initializes) */
222
+ /** HEX CPU Renderer using WASM */
225
223
  declare class HexCpuRenderer {
226
- private initialized;
227
- /** Create and initialize renderer */
228
- static create(): Promise<HexCpuRenderer>;
229
- /** Initialize (loads WASM if needed) */
230
- init(): Promise<void>;
231
- /** Check if renderer is ready */
224
+ static create(): HexCpuRenderer;
232
225
  isReady(): boolean;
233
- /** Render hexagonal effect */
234
226
  render(input: ImageInput | ImageData, options?: HexOptions): ImageOutput;
235
- /** Get output dimensions */
236
227
  getDimensions(srcWidth: number, srcHeight: number, scale: number, orientation?: HexOrientation): {
237
228
  width: number;
238
229
  height: number;
239
230
  };
240
- /** Dispose resources */
241
231
  dispose(): void;
242
232
  }
243
- /** XBRZ CPU Renderer using WASM (auto-initializes) */
233
+ /** XBRZ CPU Renderer using WASM */
244
234
  declare class XbrzCpuRenderer {
245
- private initialized;
246
- /** Create and initialize renderer */
247
- static create(): Promise<XbrzCpuRenderer>;
248
- /** Initialize (loads WASM if needed) */
249
- init(): Promise<void>;
250
- /** Check if renderer is ready */
235
+ static create(): XbrzCpuRenderer;
251
236
  isReady(): boolean;
252
- /** Render xBRZ scaling */
253
237
  render(input: ImageInput | ImageData, options?: XbrzOptions): ImageOutput;
254
- /** Dispose resources */
255
238
  dispose(): void;
256
239
  }
257
240
  /** XBRZ presets */
@@ -260,7 +243,7 @@ declare const XBRZ_PRESETS: Record<string, Partial<XbrzOptions>>;
260
243
  /**
261
244
  * RenderArt - Unified Pixel Art Rendering Engine
262
245
  *
263
- * GPU renderers work standalone. CPU renderers auto-initialize WASM.
246
+ * GPU renderers work standalone. CPU renderers require WASM initialization.
264
247
  */
265
248
 
266
249
  /** CRT rendering engine */
@@ -271,10 +254,9 @@ declare class CrtEngine {
271
254
  constructor(gpuAvailable: boolean);
272
255
  private ensureGpu;
273
256
  private ensureCpu;
274
- /** Render with automatic backend selection */
275
- render(input: ImageInput | ImageData, options?: CrtOptions): Promise<ImageOutput>;
276
- render(input: ImageInput | ImageData, preset: CrtPreset, overrides?: Partial<CrtOptions>): Promise<ImageOutput>;
277
- /** Render synchronously (GPU only) */
257
+ /** Render with options or preset */
258
+ render(input: ImageInput | ImageData, optionsOrPreset?: CrtOptions | CrtPreset): ImageOutput;
259
+ /** Synchronous GPU-only render */
278
260
  renderSync(input: ImageInput | ImageData, options?: CrtOptions): ImageOutput;
279
261
  dispose(): void;
280
262
  }
@@ -286,8 +268,7 @@ declare class HexEngine {
286
268
  constructor(gpuAvailable: boolean);
287
269
  private ensureGpu;
288
270
  private ensureCpu;
289
- render(input: ImageInput | ImageData, options?: HexOptions): Promise<ImageOutput>;
290
- render(input: ImageInput | ImageData, preset: HexPreset, overrides?: Partial<HexOptions>): Promise<ImageOutput>;
271
+ render(input: ImageInput | ImageData, optionsOrPreset?: HexOptions | HexPreset): ImageOutput;
291
272
  renderSync(input: ImageInput | ImageData, options?: HexOptions): ImageOutput;
292
273
  getDimensions(srcWidth: number, srcHeight: number, options?: HexOptions): {
293
274
  width: number;
@@ -295,33 +276,30 @@ declare class HexEngine {
295
276
  };
296
277
  dispose(): void;
297
278
  }
298
- /** XBRZ rendering engine (CPU only) */
279
+ /** XBRZ rendering engine (CPU/WASM only) */
299
280
  declare class XbrzEngine {
300
281
  private cpuRenderer;
301
282
  private ensureCpu;
302
- render(input: ImageInput | ImageData, options?: XbrzOptions): Promise<ImageOutput>;
303
- render(input: ImageInput | ImageData, preset: XbrzPreset, overrides?: Partial<XbrzOptions>): Promise<ImageOutput>;
304
- getDimensions(srcWidth: number, srcHeight: number, scale?: number): {
305
- width: number;
306
- height: number;
307
- };
283
+ render(input: ImageInput | ImageData, optionsOrPreset?: XbrzOptions | XbrzPreset): ImageOutput;
308
284
  dispose(): void;
309
285
  }
310
- /** RenderArt - Unified Pixel Art Rendering Engine */
286
+ /** Main RenderArt instance */
311
287
  declare class RenderArt {
312
288
  readonly crt: CrtEngine;
313
289
  readonly hex: HexEngine;
314
290
  readonly xbrz: XbrzEngine;
315
- private _capabilities;
291
+ readonly capabilities: RendererCapabilities;
316
292
  private constructor();
317
- /** Create RenderArt instance */
293
+ /**
294
+ * Create RenderArt instance.
295
+ * For CPU/WASM support, call initWasm() first.
296
+ */
318
297
  static create(): RenderArt;
319
- /** Create GPU-only instance */
298
+ /**
299
+ * Create GPU-only RenderArt instance (no WASM needed).
300
+ */
320
301
  static createGpuOnly(): RenderArt;
321
- /** Pre-initialize WASM for faster first CPU render */
322
- preloadWasm(wasmUrl?: string): Promise<void>;
323
- get capabilities(): RendererCapabilities;
324
302
  dispose(): void;
325
303
  }
326
304
 
327
- export { type Backend, CRT_PRESETS, CrtCpuRenderer, CrtEngine, CrtGpuRenderer, type CrtOptions, type CrtPreset, HEX_PRESETS, HexCpuRenderer, HexEngine, HexGpuRenderer, type HexOptions, type HexOrientation, type HexPreset, type ImageInput, type ImageOutput, type PixelData, RenderArt, type RenderStats, type Renderer, type RendererCapabilities, XBRZ_PRESETS, XbrzCpuRenderer, XbrzEngine, type XbrzOptions, type XbrzPreset, getWasmError, hasWasmError, hexGetDimensions, initWasm, isWasmLoaded };
305
+ export { type Backend, CRT_PRESETS, CrtCpuRenderer, CrtEngine, CrtGpuRenderer, type CrtOptions, type CrtPreset, HEX_PRESETS, HexCpuRenderer, HexEngine, HexGpuRenderer, type HexOptions, type HexOrientation, type HexPreset, type ImageInput, type ImageOutput, type PixelData, RenderArt, type RenderStats, type Renderer, type RendererCapabilities, XBRZ_PRESETS, XbrzCpuRenderer, XbrzEngine, type XbrzOptions, type XbrzPreset, hexGetDimensions, initWasm, isWasmLoaded };