modern-canvas 0.24.6 → 0.24.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/dist/Engine.d.ts CHANGED
@@ -51,8 +51,42 @@ export declare class Engine extends SceneTree {
51
51
  nextTick(): Promise<void>;
52
52
  waitUntilLoad(): Promise<void>;
53
53
  waitAndRender(delta?: number): Promise<void>;
54
+ /**
55
+ * Like {@link waitAndRender} but without the final `_render`. Used by the
56
+ * export pipeline, where rendering at the full (possibly oversized) logical
57
+ * size would allocate a render target beyond the GPU limit; {@link toPixels}
58
+ * performs the actual (tiled) rendering instead.
59
+ */
60
+ waitUntilProcessed(delta?: number): Promise<void>;
61
+ /**
62
+ * Resize for an export pass. The requested size is remembered as the export
63
+ * output size, but the root viewport + canvas are capped at the GPU limit:
64
+ * the root's RenderTarget texture is reactive and re-uploads (texImage2D) on
65
+ * every size change, so setting it beyond MAX_TEXTURE_SIZE — even just to hold
66
+ * a "logical" size — throws `width or height out of range`. {@link toPixels}
67
+ * tiles within the cap and stitches the full image. Does not render.
68
+ */
69
+ resizeForExport(width: number, height: number): this;
54
70
  render(node?: Node, delta?: number): void;
55
71
  start(): Promise<void>;
72
+ /**
73
+ * Largest dimension (in device pixels) a single offscreen render pass can
74
+ * allocate. The root scene renders into a RenderTarget texture (plus a
75
+ * stencil renderbuffer when masks are used) sized to the canvas, so any
76
+ * export larger than these GPU limits throws
77
+ * `texImage2D: width or height out of range`. Oversized exports are tiled
78
+ * within this budget instead.
79
+ */
80
+ protected _maxExportPassSize(): number;
81
+ /** Tile budget in logical units (the GPU limit is in device pixels). */
82
+ protected _exportTileLimit(): number;
83
+ /** Resize the renderer + root viewport without triggering a render. */
84
+ protected _resizeSilently(width: number, height: number): void;
85
+ /** Full export size (set by {@link resizeForExport}); falls back to the root size. */
86
+ protected _exportWidth: number;
87
+ protected _exportHeight: number;
88
+ get exportWidth(): number;
89
+ get exportHeight(): number;
56
90
  needsChunkReadPixels(): boolean;
57
91
  toPixels(): Uint8ClampedArray<ArrayBuffer>;
58
92
  toImageData(): ImageData;
@@ -1,3 +1,21 @@
1
1
  export declare const PI: number;
2
2
  export declare const PI_2: number;
3
3
  export declare function isPow2(v: number): boolean;
4
+ export interface ExportTile {
5
+ /** Left offset of the tile in the full image (logical units). */
6
+ x: number;
7
+ /** Top offset of the tile in the full image (logical units). */
8
+ y: number;
9
+ /** Tile width (logical units); clamped at the right edge. */
10
+ width: number;
11
+ /** Tile height (logical units); clamped at the bottom edge. */
12
+ height: number;
13
+ }
14
+ /**
15
+ * Split a `width × height` image into a grid of tiles no larger than `limit`
16
+ * on either axis. Used to export images that exceed a single GPU render pass
17
+ * (texture / renderbuffer / viewport limits). Tiles are returned row-major and
18
+ * cover the whole image with no overlap; edge tiles are clamped to the
19
+ * remaining size. Returns an empty array for a degenerate (zero-area) image.
20
+ */
21
+ export declare function planExportTiles(width: number, height: number, limit: number): ExportTile[];