@glissade/backend-skia 0.7.0-pre.0 → 0.8.0-pre.0

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Canvas, Image } from "@napi-rs/canvas";
2
- import { DisplayList, FontSpec, TextMeasurer, TextMetricsLite, TextMetricsLite as TextMetricsLite$1, VideoFrameSource } from "@glissade/scene";
2
+ import { BackendCaps, DisplayList, FontSpec, RenderBackend, TextMeasurer, TextMetricsLite, TextMetricsLite as TextMetricsLite$1, VideoFrameSource } from "@glissade/scene";
3
3
 
4
4
  //#region src/index.d.ts
5
5
 
@@ -15,16 +15,18 @@ type Drawable = Canvas | Image;
15
15
  declare function createMeasurer(opts?: {
16
16
  fonts?: Record<string, string>;
17
17
  }): TextMeasurer;
18
- declare class SkiaBackend {
18
+ declare class SkiaBackend implements RenderBackend {
19
19
  private readonly canvas;
20
20
  private readonly raster;
21
+ /** Headless CPU Skia: all document filters, no GPU shader pass (§3.4/§3.7). */
22
+ readonly caps: BackendCaps;
21
23
  constructor(width: number, height: number);
22
24
  setImageAsset(assetId: string, image: Drawable): void;
23
25
  setVideoAsset(assetId: string, source: VideoFrameSource): void;
24
26
  measureText(text: string, font: FontSpec): TextMetricsLite$1;
25
27
  render(list: DisplayList): void;
26
- /** Raw RGBA — the FFmpeg pipe path (§5.1d). Synchronous; no GPU readback. */
27
- readPixels(): Uint8ClampedArray;
28
+ /** Raw RGBA — the FFmpeg pipe path (§5.1d). Resolves synchronously (no GPU readback) but typed Promise to match the RenderBackend contract. */
29
+ readPixels(): Promise<Uint8ClampedArray>;
28
30
  /** Deterministic PNG bytes for golden frames and `gs render` output. */
29
31
  encodePng(): Buffer;
30
32
  dispose(): void;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { GlobalFonts, Path2D, createCanvas } from "@napi-rs/canvas";
2
- import { Raster2D, fontString } from "@glissade/scene";
2
+ import { ALL_FILTER_KINDS, Raster2D, fontString } from "@glissade/scene";
3
3
  //#region src/index.ts
4
4
  /**
5
5
  * @glissade/backend-skia — headless DisplayList rasterizer over @napi-rs/canvas
@@ -8,6 +8,8 @@ import { Raster2D, fontString } from "@glissade/scene";
8
8
  * structurally cannot drift. This file owns only the @napi-rs canvas flavor
9
9
  * plus headless concerns (PNG encode, sync readPixels, text measurement).
10
10
  */
11
+ /** Largest dimension @napi-rs/canvas will allocate (Skia's default surface cap). */
12
+ const MAX_TEXTURE = 16384;
11
13
  /**
12
14
  * Factory-time measurement (§3.6): component factories run before any scene
13
15
  * exists, so give the process a real measurer up front —
@@ -24,6 +26,12 @@ function createMeasurer(opts = {}) {
24
26
  var SkiaBackend = class {
25
27
  canvas;
26
28
  raster;
29
+ /** Headless CPU Skia: all document filters, no GPU shader pass (§3.4/§3.7). */
30
+ caps = {
31
+ filters: ALL_FILTER_KINDS,
32
+ shaders: false,
33
+ maxTextureSize: MAX_TEXTURE
34
+ };
27
35
  constructor(width, height) {
28
36
  this.canvas = createCanvas(width, height);
29
37
  this.raster = new Raster2D({
@@ -53,9 +61,10 @@ var SkiaBackend = class {
53
61
  render(list) {
54
62
  this.raster.render(this.canvas, list);
55
63
  }
56
- /** Raw RGBA — the FFmpeg pipe path (§5.1d). Synchronous; no GPU readback. */
64
+ /** Raw RGBA — the FFmpeg pipe path (§5.1d). Resolves synchronously (no GPU readback) but typed Promise to match the RenderBackend contract. */
57
65
  readPixels() {
58
- return this.canvas.getContext("2d").getImageData(0, 0, this.canvas.width, this.canvas.height).data;
66
+ const ctx = this.canvas.getContext("2d");
67
+ return Promise.resolve(ctx.getImageData(0, 0, this.canvas.width, this.canvas.height).data);
59
68
  }
60
69
  /** Deterministic PNG bytes for golden frames and `gs render` output. */
61
70
  encodePng() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/backend-skia",
3
- "version": "0.7.0-pre.0",
3
+ "version": "0.8.0-pre.0",
4
4
  "description": "glissade headless render backend: DisplayList -> @napi-rs/canvas (Skia). Node-only; the CI-grade deterministic path.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -16,8 +16,8 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "@napi-rs/canvas": "^0.1.65",
19
- "@glissade/core": "0.7.0-pre.0",
20
- "@glissade/scene": "0.7.0-pre.0"
19
+ "@glissade/core": "0.8.0-pre.0",
20
+ "@glissade/scene": "0.8.0-pre.0"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",