@flare-engine/render 0.4.7 → 0.4.10

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.mts CHANGED
@@ -498,7 +498,8 @@ interface SpriteDrawCommand {
498
498
  * Participates in the batch key. Flipped sprites are drawn via
499
499
  * `drawImageRect` with a canvas scale(-1, 1) transform — one draw call
500
500
  * per sprite (per-sprite draw call trade-off, documented).
501
- * Unsupported in combination with rotation (same constraint as stretch mode).
501
+ * `rotation` is honoured: the renderer rotates about the anchor point (as
502
+ * the atlas path does) and then mirrors about the sprite centre.
502
503
  */
503
504
  flipX: boolean;
504
505
  /**
@@ -642,6 +643,16 @@ interface PaintLike {
642
643
  */
643
644
  setBlendMode?(mode: number): void;
644
645
  }
646
+ /** Texture sampling mode for `FrameRenderer.setImageSampling`. */
647
+ type ImageSampling = 'nearest' | 'linear';
648
+ /**
649
+ * RN Skia's `FilterOptions` shape: `filter` is the FilterMode (0 = Nearest,
650
+ * 1 = Linear), `mipmap` the MipmapMode (0 = None, 1 = Nearest, 2 = Linear).
651
+ */
652
+ interface SamplingOptionsLike {
653
+ filter: number;
654
+ mipmap?: number;
655
+ }
645
656
  /** Minimal draw surface the frame-renderer calls into. */
646
657
  interface DrawSurfaceLike {
647
658
  save(): number;
@@ -651,8 +662,21 @@ interface DrawSurfaceLike {
651
662
  /** rotate(degrees, cx, cy) — DEGREES, forwarded verbatim (both Skia backends take degrees). */
652
663
  rotate(degrees: number, cx: number, cy: number): void;
653
664
  clear(color: Float32Array): void;
654
- drawAtlas(image: unknown, srcRects: RectLike[], dstXforms: RSXformLike[], paint: PaintLike): void;
665
+ /**
666
+ * `blendMode` and `colors` are positional placeholders in RN Skia's argument
667
+ * order; the renderer never fills them. `sampling` is passed only for an
668
+ * image with a `setImageSampling` setting — otherwise the call stops at `paint`.
669
+ */
670
+ drawAtlas(image: unknown, srcRects: RectLike[], dstXforms: RSXformLike[], paint: PaintLike, blendMode?: undefined, colors?: undefined, sampling?: SamplingOptionsLike): void;
655
671
  drawImageRect(image: unknown, src: RectLike, dst: RectLike, paint: PaintLike): void;
672
+ /**
673
+ * Sampled stretch/flip draw — `filterMode` and `mipmapMode` are the numeric
674
+ * Skia enum values (see `SamplingOptionsLike`). `paint` is optional only to
675
+ * mirror RN Skia's `paint?: SkPaint | null`; the renderer always passes one.
676
+ * Optional — absent on some test stubs; when it is missing, a stretch draw
677
+ * of an image with a sampling setting falls back to `drawImageRect`.
678
+ */
679
+ drawImageRectOptions?(image: unknown, src: RectLike, dst: RectLike, filterMode: number, mipmapMode: number, paint?: PaintLike | null): void;
656
680
  drawRect(rect: RectLike, paint: PaintLike): void;
657
681
  }
658
682
  /**
@@ -730,7 +754,24 @@ interface FrameRenderer {
730
754
  readonly canvas: CanvasLike;
731
755
  beginFrame(viewportWidth: number, viewportHeight: number, time?: number, pixelDensity?: number): void;
732
756
  drawAtlas(image: SkImageLike, commands: SpriteDrawCommand[]): void;
757
+ /**
758
+ * Set the texture sampling for every draw of `image` (an atlas or a texture)
759
+ * on both the atlas path and the stretch/flip path. The last call wins. An
760
+ * image with no setting keeps each path's own Skia default: linear on the
761
+ * atlas path (`drawAtlas`), nearest on the stretch path (`drawImageRect`).
762
+ * Throws `RangeError` for a mode other than `'nearest'` or `'linear'`.
763
+ */
764
+ setImageSampling(image: SkImageLike, sampling: ImageSampling): void;
733
765
  buildPostFxPasses(runtime: FrameRendererPostFxRuntime | null, chain: FrameRendererPostFxChain | null, width: number, height: number): readonly FrameRendererPostFxDescriptor[];
766
+ /**
767
+ * The compiled passes exactly as the runtime builds them — `uniforms` is the
768
+ * packed Float32Array `makeShaderWithChildren` takes. `buildPostFxPasses`
769
+ * derives its named JSX descriptors from these; an imperative compositor
770
+ * (GameView's web path) draws from them directly. Same null/unsupported/
771
+ * no-chain rules as `buildPostFxPasses` (empty array), same
772
+ * `runtime ?? bound`, `chain ?? bound` resolution.
773
+ */
774
+ compilePostFxPasses(runtime: FrameRendererPostFxRuntime | null, chain: FrameRendererPostFxChain | null, width: number, height: number): readonly FrameRendererCompiledPass[];
734
775
  setPostFxBinding(runtime: FrameRendererPostFxRuntime | null, chain: FrameRendererPostFxChain | null): void;
735
776
  /**
736
777
  * Whether `buildPostFxPasses` would attempt to build passes from the bound
@@ -931,5 +972,5 @@ export declare function measureText(font: BitmapFont, text: string): number;
931
972
  * Characters are batched as individual sprites from the font texture.
932
973
  */
933
974
  export declare function drawText(batch: SpriteBatch, font: BitmapFont, image: SkImageLike, text: string, x: number, y: number, scale?: number): void;
934
- export type { AnySpriteEffect, BatchCullBounds, BitmapFont, CanvasLike, CaveInteriorEffect, ColorFilterFactoryLike, CompiledShader, CustomShaderEffect, DrawSurfaceLike, Drawable, DropShadowEffect, FireEffect, FlashEffect, FogEffect, FollowOptions, ForestCanopyEffect, FrameRenderer, FrameRendererCompiledPass, FrameRendererModule, FrameRendererPostFxChain, FrameRendererPostFxDescriptor, FrameRendererPostFxRuntime, Glyph, GrayscaleEffect, ImageFilterFactoryLike, KerningPair, MoonCraterEffect, MountainHillsEffect, OutlineEffect, PaintLike, PictureLike, PictureRecorderLike, PositionData, RSXformLike, RectLike, RenderStats, RiverWaveEffect, RoofsCityEffect, RuntimeEffectFactoryLike, RuntimeEffectLike, ShaderUniforms, SpriteAnchor, SpriteColor, SpriteData, SpriteDrawCommand, SpriteEffect, TintEffect, WaterEffect };
975
+ export type { AnySpriteEffect, BatchCullBounds, BitmapFont, CanvasLike, CaveInteriorEffect, ColorFilterFactoryLike, CompiledShader, CustomShaderEffect, DrawSurfaceLike, Drawable, DropShadowEffect, FireEffect, FlashEffect, FogEffect, FollowOptions, ForestCanopyEffect, FrameRenderer, FrameRendererCompiledPass, FrameRendererModule, FrameRendererPostFxChain, FrameRendererPostFxDescriptor, FrameRendererPostFxRuntime, Glyph, GrayscaleEffect, ImageFilterFactoryLike, ImageSampling, KerningPair, MoonCraterEffect, MountainHillsEffect, OutlineEffect, PaintLike, PictureLike, PictureRecorderLike, PositionData, RSXformLike, RectLike, RenderStats, RiverWaveEffect, RoofsCityEffect, RuntimeEffectFactoryLike, RuntimeEffectLike, SamplingOptionsLike, ShaderUniforms, SpriteAnchor, SpriteColor, SpriteData, SpriteDrawCommand, SpriteEffect, TintEffect, WaterEffect };
935
976
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/camera2d.ts","../src/draw-order.ts","../src/renderer.ts","../src/sprite-effects.ts","../src/sprite-batch.ts","../src/frame-renderer.ts","../src/nine-slice.ts","../src/render-system.ts","../src/shaders.ts","../src/sprite-font.ts"],"mappings":";;;;UAGiB;;EAEf;;EAEA,SAAS;;EAET,WAAW;;;;;;;qBAiGA;;EAEX;EACA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,QAAQ;UAEA;UACA;UACA;UACA;UACA;UACA;;EAGR,YAAY,eAAe;;EAM3B,OAAO,QAAQ,MAAM,UAAU;;EAK/B;;;;;;;;;;;;EAeA,eAAe;;MAKX;;EAKJ,MAAM,mBAAmB;;;;;EAoBzB,YAAY,mBAAmB;;;;;EAoB/B,OAAO;;MAuEH;;MAKA;;EAKJ,cAAc,gBAAgB,iBAAiB;;EAK/C,kBAAkB,gBAAgB,gBAAgB,KAAK,OAAO;;EAW9D,cAAc,iBAAiB,kBAAkB;;EAKjD,kBAAkB,iBAAiB,iBAAiB,KAAK,OAAO;;EAahE,aAAa;;EAKb,cAAc,KAAK,OAAO;UAUlB;;;UCnVO;;EAEf;;;;;;;;;;;;;wBAcc,gBAAgB,UAAU,UAAU,OAAO,KAAK,kBAAkB;;;;;wBAmBlE,iBAAiB,GAAG,UAAU,GAAG;;UCnChC;EACf;EACA;EACA,UAAU,WAAW;EACrB,MAAM,YAAY;;EAElB,OAAO,iBAAiB,YAAY;EACpC,MAAM;;;UAIS;;;;;;;;;;EAUf;;;;;;;;EAQA;;;;;;qBAOW;;WAEF,OAAO;UAER;UACA;;EAGR,UAAU,Q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eACA;EAEF,UAAU,OAAO,aAAa,UAAU;EACxC,kBACE,SAAS,mCACT,OAAO,iCACP,eACA,0BACU;EACZ,iBACE,SAAS,mCACT,OAAO;;;;;;EAOT;EACA,YAAY;;;;;;;;wBAsCE,oBAAoB,MAAM,sBAAsB;;wBAgqBhD;;;;;;;;;;;;;wBAiBA;EAAsB;EAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBC17BvC,cACd,OAAO,aACP,OAAO,aACP,OAAO,aACP,WACA,WACA,WACA,WACA,eACA,SAAS,iBACT;;UCrCe;EACf;EACA;;;;;;UAOe;EACf;EACA;;;UAIe;EACf,OAAO;EACP,OAAO;EACP;EACA;EACA;;;;EAIA,SAAS;;EAET,SAAS;;;;EAIT;;;;EAIA;;;;;;;;;;;EAWA;;;;;;;EAOA;;;;EAIA;;EAEA;;;;;;;;;;;;;;;;;;;;wBA2Bc,mBACd,OAAO,OACP,OAAO,OACP,aAAa,aAAa,eAC1B,WAAW,aAAa,aACxB,OAAO;;qBA6DI,QAAM,aAAA;qBC/JN;qBAmCA;qBA0CA;qBA0BA;qBA6BA;qBA8BA;qBAyBA;qBAkCA;qBAgCA;;UCzPI;;EAEf;;EAEA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;;UAIe;EACf;EACA;EACA;;;UAIe;;EAEf;;EAEA;;EAEA,QAAQ,YAAY;;EAEpB,UAAU;;;;;wBAMI,gBAAgB,gBAAgB;;wBA8ChC,WAAW,MAAM,YAAY,eAAe;;wBAK5C,YAAY,MAAM,YAAY;;;;;wBAoB9B,SACd,OAAO,aACP,MAAM,YACN,OAAO,aACP,cACA,WACA,WACA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/camera2d.ts","../src/draw-order.ts","../src/renderer.ts","../src/sprite-effects.ts","../src/sprite-batch.ts","../src/frame-renderer.ts","../src/nine-slice.ts","../src/render-system.ts","../src/shaders.ts","../src/sprite-font.ts"],"mappings":";;;;UAGiB;;EAEf;;EAEA,S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EAAsB;EAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBCziCvC,cACd,OAAO,aACP,OAAO,aACP,OAAO,aACP,WACA,WACA,WACA,WACA,eACA,SAAS,iBACT;;UCrCe;EACf;EACA;;;;;;UAOe;EACf;EACA;;;UAIe;EACf,OAAO;EACP,OAAO;EACP;EACA;EACA;;;;EAIA,SAAS;;EAET,SAAS;;;;EAIT;;;;EAIA;;;;;;;;;;;EAWA;;;;;;;EAOA;;;;EAIA;;EAEA;;;;;;;;;;;;;;;;;;;;wBA2Bc,mBACd,OAAO,OACP,OAAO,OACP,aAAa,aAAa,eAC1B,WAAW,aAAa,aACxB,OAAO;;qBA6DI,QAAM,aAAA;qBC/JN;qBAmCA;qBA0CA;qBA0BA;qBA6BA;qBA8BA;qBAyBA;qBAkCA;qBAgCA;;UCzPI;;EAEf;;EAEA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;;UAIe;EACf;EACA;EACA;;;UAIe;;EAEf;;EAEA;;EAEA,QAAQ,YAAY;;EAEpB,UAAU;;;;;wBAMI,gBAAgB,gBAAgB;;wBA8ChC,WAAW,MAAM,YAAY,eAAe;;wBAK5C,YAAY,MAAM,YAAY;;;;;wBAoB9B,SACd,OAAO,aACP,MAAM,YACN,OAAO,aACP,cACA,WACA,WACA"}
package/dist/index.d.ts CHANGED
@@ -498,7 +498,8 @@ interface SpriteDrawCommand {
498
498
  * Participates in the batch key. Flipped sprites are drawn via
499
499
  * `drawImageRect` with a canvas scale(-1, 1) transform — one draw call
500
500
  * per sprite (per-sprite draw call trade-off, documented).
501
- * Unsupported in combination with rotation (same constraint as stretch mode).
501
+ * `rotation` is honoured: the renderer rotates about the anchor point (as
502
+ * the atlas path does) and then mirrors about the sprite centre.
502
503
  */
503
504
  flipX: boolean;
504
505
  /**
@@ -642,6 +643,16 @@ interface PaintLike {
642
643
  */
643
644
  setBlendMode?(mode: number): void;
644
645
  }
646
+ /** Texture sampling mode for `FrameRenderer.setImageSampling`. */
647
+ type ImageSampling = 'nearest' | 'linear';
648
+ /**
649
+ * RN Skia's `FilterOptions` shape: `filter` is the FilterMode (0 = Nearest,
650
+ * 1 = Linear), `mipmap` the MipmapMode (0 = None, 1 = Nearest, 2 = Linear).
651
+ */
652
+ interface SamplingOptionsLike {
653
+ filter: number;
654
+ mipmap?: number;
655
+ }
645
656
  /** Minimal draw surface the frame-renderer calls into. */
646
657
  interface DrawSurfaceLike {
647
658
  save(): number;
@@ -651,8 +662,21 @@ interface DrawSurfaceLike {
651
662
  /** rotate(degrees, cx, cy) — DEGREES, forwarded verbatim (both Skia backends take degrees). */
652
663
  rotate(degrees: number, cx: number, cy: number): void;
653
664
  clear(color: Float32Array): void;
654
- drawAtlas(image: unknown, srcRects: RectLike[], dstXforms: RSXformLike[], paint: PaintLike): void;
665
+ /**
666
+ * `blendMode` and `colors` are positional placeholders in RN Skia's argument
667
+ * order; the renderer never fills them. `sampling` is passed only for an
668
+ * image with a `setImageSampling` setting — otherwise the call stops at `paint`.
669
+ */
670
+ drawAtlas(image: unknown, srcRects: RectLike[], dstXforms: RSXformLike[], paint: PaintLike, blendMode?: undefined, colors?: undefined, sampling?: SamplingOptionsLike): void;
655
671
  drawImageRect(image: unknown, src: RectLike, dst: RectLike, paint: PaintLike): void;
672
+ /**
673
+ * Sampled stretch/flip draw — `filterMode` and `mipmapMode` are the numeric
674
+ * Skia enum values (see `SamplingOptionsLike`). `paint` is optional only to
675
+ * mirror RN Skia's `paint?: SkPaint | null`; the renderer always passes one.
676
+ * Optional — absent on some test stubs; when it is missing, a stretch draw
677
+ * of an image with a sampling setting falls back to `drawImageRect`.
678
+ */
679
+ drawImageRectOptions?(image: unknown, src: RectLike, dst: RectLike, filterMode: number, mipmapMode: number, paint?: PaintLike | null): void;
656
680
  drawRect(rect: RectLike, paint: PaintLike): void;
657
681
  }
658
682
  /**
@@ -730,7 +754,24 @@ interface FrameRenderer {
730
754
  readonly canvas: CanvasLike;
731
755
  beginFrame(viewportWidth: number, viewportHeight: number, time?: number, pixelDensity?: number): void;
732
756
  drawAtlas(image: SkImageLike, commands: SpriteDrawCommand[]): void;
757
+ /**
758
+ * Set the texture sampling for every draw of `image` (an atlas or a texture)
759
+ * on both the atlas path and the stretch/flip path. The last call wins. An
760
+ * image with no setting keeps each path's own Skia default: linear on the
761
+ * atlas path (`drawAtlas`), nearest on the stretch path (`drawImageRect`).
762
+ * Throws `RangeError` for a mode other than `'nearest'` or `'linear'`.
763
+ */
764
+ setImageSampling(image: SkImageLike, sampling: ImageSampling): void;
733
765
  buildPostFxPasses(runtime: FrameRendererPostFxRuntime | null, chain: FrameRendererPostFxChain | null, width: number, height: number): readonly FrameRendererPostFxDescriptor[];
766
+ /**
767
+ * The compiled passes exactly as the runtime builds them — `uniforms` is the
768
+ * packed Float32Array `makeShaderWithChildren` takes. `buildPostFxPasses`
769
+ * derives its named JSX descriptors from these; an imperative compositor
770
+ * (GameView's web path) draws from them directly. Same null/unsupported/
771
+ * no-chain rules as `buildPostFxPasses` (empty array), same
772
+ * `runtime ?? bound`, `chain ?? bound` resolution.
773
+ */
774
+ compilePostFxPasses(runtime: FrameRendererPostFxRuntime | null, chain: FrameRendererPostFxChain | null, width: number, height: number): readonly FrameRendererCompiledPass[];
734
775
  setPostFxBinding(runtime: FrameRendererPostFxRuntime | null, chain: FrameRendererPostFxChain | null): void;
735
776
  /**
736
777
  * Whether `buildPostFxPasses` would attempt to build passes from the bound
@@ -931,5 +972,5 @@ export declare function measureText(font: BitmapFont, text: string): number;
931
972
  * Characters are batched as individual sprites from the font texture.
932
973
  */
933
974
  export declare function drawText(batch: SpriteBatch, font: BitmapFont, image: SkImageLike, text: string, x: number, y: number, scale?: number): void;
934
- export type { AnySpriteEffect, BatchCullBounds, BitmapFont, CanvasLike, CaveInteriorEffect, ColorFilterFactoryLike, CompiledShader, CustomShaderEffect, DrawSurfaceLike, Drawable, DropShadowEffect, FireEffect, FlashEffect, FogEffect, FollowOptions, ForestCanopyEffect, FrameRenderer, FrameRendererCompiledPass, FrameRendererModule, FrameRendererPostFxChain, FrameRendererPostFxDescriptor, FrameRendererPostFxRuntime, Glyph, GrayscaleEffect, ImageFilterFactoryLike, KerningPair, MoonCraterEffect, MountainHillsEffect, OutlineEffect, PaintLike, PictureLike, PictureRecorderLike, PositionData, RSXformLike, RectLike, RenderStats, RiverWaveEffect, RoofsCityEffect, RuntimeEffectFactoryLike, RuntimeEffectLike, ShaderUniforms, SpriteAnchor, SpriteColor, SpriteData, SpriteDrawCommand, SpriteEffect, TintEffect, WaterEffect };
975
+ export type { AnySpriteEffect, BatchCullBounds, BitmapFont, CanvasLike, CaveInteriorEffect, ColorFilterFactoryLike, CompiledShader, CustomShaderEffect, DrawSurfaceLike, Drawable, DropShadowEffect, FireEffect, FlashEffect, FogEffect, FollowOptions, ForestCanopyEffect, FrameRenderer, FrameRendererCompiledPass, FrameRendererModule, FrameRendererPostFxChain, FrameRendererPostFxDescriptor, FrameRendererPostFxRuntime, Glyph, GrayscaleEffect, ImageFilterFactoryLike, ImageSampling, KerningPair, MoonCraterEffect, MountainHillsEffect, OutlineEffect, PaintLike, PictureLike, PictureRecorderLike, PositionData, RSXformLike, RectLike, RenderStats, RiverWaveEffect, RoofsCityEffect, RuntimeEffectFactoryLike, RuntimeEffectLike, SamplingOptionsLike, ShaderUniforms, SpriteAnchor, SpriteColor, SpriteData, SpriteDrawCommand, SpriteEffect, TintEffect, WaterEffect };
935
976
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/camera2d.ts","../src/draw-order.ts","../src/renderer.ts","../src/sprite-effects.ts","../src/sprite-batch.ts","../src/frame-renderer.ts","../src/nine-slice.ts","../src/render-system.ts","../src/shaders.ts","../src/sprite-font.ts"],"mappings":";;;;UAGiB;;EAEf;;EAEA,SAAS;;EAET,WAAW;;;;;;;qBAiGA;;EAEX;EACA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,QAAQ;UAEA;UACA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;;;;;;;;;;;;;;;wBA2Bc,mBACd,OAAO,OACP,OAAO,OACP,aAAa,aAAa,eAC1B,WAAW,aAAa,aACxB,OAAO;;qBA6DI,QAAM,aAAA;qBC/JN;qBAmCA;qBA0CA;qBA0BA;qBA6BA;qBA8BA;qBAyBA;qBAkCA;qBAgCA;;UCzPI;;EAEf;;EAEA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;;UAIe;EACf;EACA;EACA;;;UAIe;;EAEf;;EAEA;;EAEA,QAAQ,YAAY;;EAEpB,UAAU;;;;;wBAMI,gBAAgB,gBAAgB;;wBA8ChC,WAAW,MAAM,YAAY,eAAe;;wBAK5C,YAAY,MAAM,YAAY;;;;;wBAoB9B,SACd,OAAO,aACP,MAAM,YACN,OAAO,aACP,cACA,WACA,WACA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/camera2d.ts","../src/draw-order.ts","../src/renderer.ts","../src/sprite-effects.ts","../src/sprite-batch.ts","../src/frame-renderer.ts","../src/nine-slice.ts","../src/render-system.ts","../src/shaders.ts","../src/sprite-font.ts"],"mappings":";;;;UAGiB;;EAEf;;EAEA,SAAS;;EAET,WAAW;;;;;;;qBAiGA;;EAEX;EACA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,QAAQ;UAEA;UACA;UACA;UACA;UACA;UACA;;EAGR,YAAY,eAAe;;EAM3B,OAAO,QAAQ,MAAM,UAAU;;EAK/B;;;;;;;;;;;;EAeA,eAAe;;MAKX;;EAKJ,MAAM,mBAAmB;;;;;EAoBzB,YAAY,mBAAmB;;;;;EAoB/B,OAAO;;MAuEH;;MAKA;;EAKJ,cAAc,gBAAgB,iBAAiB;;EAK/C,kBAAkB,gBAAgB,gBAAgB,KAAK,OAAO;;EAW9D,cAAc,iBAAiB,kBAAkB;;EAKjD,kBAAkB,iBAAiB,iBAAiB,KAAK,OAAO;;EAahE,aAAa;;EAKb,cAAc,KAAK,OAAO;UAUlB;;;UCnVO;;EAEf;;;;;;;;;;;;;w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f;;EAEA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;;UAIe;EACf;EACA;EACA;;;UAIe;;EAEf;;EAEA;;EAEA,QAAQ,YAAY;;EAEpB,UAAU;;;;;wBAMI,gBAAgB,gBAAgB;;wBA8ChC,WAAW,MAAM,YAAY,eAAe;;wBAK5C,YAAY,MAAM,YAAY;;;;;wBAoB9B,SACd,OAAO,aACP,MAAM,YACN,OAAO,aACP,cACA,WACA,WACA"}
package/dist/index.js CHANGED
@@ -783,12 +783,21 @@ function flashIntensity(effect) {
783
783
  // src/frame-renderer.ts
784
784
  /** See the dev-flag note at the top of this file. */
785
785
  const G = globalThis;
786
+ /** `SpriteDrawCommand.rotation` is radians; `DrawSurfaceLike.rotate` takes degrees. */
787
+ const RAD_TO_DEG = 180 / Math.PI;
786
788
  const BLEND_SRC_OVER = 3;
787
789
  const BLEND_SRC_IN = 5;
788
790
  /** Skia BlendMode.SrcATop — r = s·da + d·(1−sa): keeps the art's alpha, lerps colour by the filter's alpha. */
789
791
  const BLEND_SRC_ATOP = 9;
790
792
  /** Skia BlendMode.Plus — additive: dst = clamp(src + dst). */
791
793
  const BLEND_PLUS = 12;
794
+ /** Shared empty result for `compilePostFxPasses`, so a chain-free frame allocates nothing. */
795
+ const EMPTY_COMPILED_PASSES = [];
796
+ /** The two sampling objects `setImageSampling` hands to the surface — shared, never rebuilt. */
797
+ const SAMPLING_NEAREST = { filter: 0 };
798
+ const SAMPLING_LINEAR = { filter: 1 };
799
+ /** Skia MipmapMode.None — the stretch path never mipmaps. */
800
+ const MIPMAP_NONE = 0;
792
801
  const OUTLINE_OFFSETS = [
793
802
  [1, 0],
794
803
  [-1, 0],
@@ -847,6 +856,7 @@ function createFrameRenderer(Skia) {
847
856
  const stretchDstRects = [];
848
857
  let stretchPaint = null;
849
858
  const zoneBgRects = [];
859
+ const imageSampling = /* @__PURE__ */ new WeakMap();
850
860
  let _cachedSrcSlice = null;
851
861
  let _cachedSrcSliceLen = 0;
852
862
  let _cachedXformSlice = null;
@@ -894,6 +904,17 @@ function createFrameRenderer(Skia) {
894
904
  _loggedOnce.add(msg);
895
905
  console.warn(`[postfx] ${msg}`);
896
906
  }
907
+ function compilePostFxPasses(runtime, chain, width, height) {
908
+ const rt = runtime ?? _boundRuntime;
909
+ const ch = chain ?? _boundChain;
910
+ if (rt === null || !rt.supported) return EMPTY_COMPILED_PASSES;
911
+ if (rt.buildPass === void 0) {
912
+ logOnce("buildPostFxPasses: runtime.supported but buildPass absent — no passes");
913
+ return EMPTY_COMPILED_PASSES;
914
+ }
915
+ if (ch === null) return EMPTY_COMPILED_PASSES;
916
+ return rt.buildPass(ch, width, height);
917
+ }
897
918
  const canvas = {
898
919
  save: () => current?.save() ?? 0,
899
920
  restore: () => {
@@ -1202,21 +1223,19 @@ function createFrameRenderer(Skia) {
1202
1223
  mountainHillsPaint.setShader(mountainHillsEffect.makeShader(mountainHillsUniforms));
1203
1224
  return mountainHillsPaint;
1204
1225
  }
1205
- function drawOutlined(cvs, image, commands, n, effect, alpha) {
1226
+ function drawOutlined(cvs, image, commands, n, effect, alpha, sampling) {
1206
1227
  const paint = applyOutlinePaint(effect);
1207
1228
  paint.setAlphaf(alpha);
1208
1229
  const srcs = getCachedSrcSlice(n);
1209
1230
  for (let k = 0; k < OUTLINE_OFFSETS.length; k++) {
1210
1231
  const offset = OUTLINE_OFFSETS[k];
1211
1232
  fillXforms(commands, n, offset[0] * effect.width, offset[1] * effect.width);
1212
- const dsts = getCachedXformSlice(n);
1213
- cvs.drawAtlas(image, srcs, dsts, paint);
1233
+ drawAtlasSampled(cvs, image, srcs, getCachedXformSlice(n), paint, sampling);
1214
1234
  }
1215
1235
  paint.setAlphaf(1);
1216
1236
  defaultPaint.setAlphaf(alpha);
1217
1237
  fillXforms(commands, n, 0, 0);
1218
- const mainDsts = getCachedXformSlice(n);
1219
- cvs.drawAtlas(image, srcs, mainDsts, defaultPaint);
1238
+ drawAtlasSampled(cvs, image, srcs, getCachedXformSlice(n), defaultPaint, sampling);
1220
1239
  defaultPaint.setAlphaf(1);
1221
1240
  }
1222
1241
  function resolveEffectPaint(effect) {
@@ -1260,6 +1279,7 @@ function createFrameRenderer(Skia) {
1260
1279
  const blendAdditive = cmd0.blend === "additive";
1261
1280
  const flipX = cmd0.flipX;
1262
1281
  const flipY = cmd0.flipY;
1282
+ const sampling = imageSampling.get(image);
1263
1283
  currentSpriteW = cmd0.dstW;
1264
1284
  currentSpriteH = cmd0.dstH;
1265
1285
  if (effect?.type === "roofs-city" || effect?.type === "forest-canopy" || effect?.type === "river-wave" || effect?.type === "moon-crater" || effect?.type === "cave-interior" || effect?.type === "mountain-hills") {
@@ -1293,12 +1313,13 @@ function createFrameRenderer(Skia) {
1293
1313
  const cx = cmd.dstX + cmd.dstW * .5;
1294
1314
  const cy = cmd.dstY + cmd.dstH * .5;
1295
1315
  current.save();
1316
+ if (cmd.rotation !== 0) current.rotate(cmd.rotation * RAD_TO_DEG, cmd.dstX + cmd.anchorX * cmd.dstW, cmd.dstY + cmd.anchorY * cmd.dstH);
1296
1317
  current.translate(cx, cy);
1297
1318
  current.scale(cmd.flipX ? -1 : 1, cmd.flipY ? -1 : 1);
1298
1319
  current.translate(-cx, -cy);
1299
- current.drawImageRect(image, srcR, dstR, sPaint);
1320
+ drawImageRectSampled(current, image, srcR, dstR, sPaint, sampling);
1300
1321
  current.restore();
1301
- } else current.drawImageRect(image, srcR, dstR, sPaint);
1322
+ } else drawImageRectSampled(current, image, srcR, dstR, sPaint, sampling);
1302
1323
  }
1303
1324
  sPaint.setAlphaf(1);
1304
1325
  if (blendAdditive) sPaint.setBlendMode?.(BLEND_SRC_OVER);
@@ -1311,7 +1332,7 @@ function createFrameRenderer(Skia) {
1311
1332
  outlinePaint?.setBlendMode?.(BLEND_PLUS);
1312
1333
  defaultPaint.setBlendMode?.(BLEND_PLUS);
1313
1334
  }
1314
- drawOutlined(current, image, commands, n, effect, alpha);
1335
+ drawOutlined(current, image, commands, n, effect, alpha, sampling);
1315
1336
  if (blendAdditive) {
1316
1337
  outlinePaint?.setBlendMode?.(BLEND_SRC_OVER);
1317
1338
  defaultPaint.setBlendMode?.(BLEND_SRC_OVER);
@@ -1324,10 +1345,15 @@ function createFrameRenderer(Skia) {
1324
1345
  const paint = effect === void 0 ? defaultPaint : resolveEffectPaint(effect);
1325
1346
  if (blendAdditive) paint.setBlendMode?.(BLEND_PLUS);
1326
1347
  paint.setAlphaf(alpha);
1327
- current.drawAtlas(image, srcs, dsts, paint);
1348
+ drawAtlasSampled(current, image, srcs, dsts, paint, sampling);
1328
1349
  paint.setAlphaf(1);
1329
1350
  if (blendAdditive) paint.setBlendMode?.(BLEND_SRC_OVER);
1330
1351
  },
1352
+ setImageSampling(image, sampling) {
1353
+ if (sampling === "nearest") imageSampling.set(image, SAMPLING_NEAREST);
1354
+ else if (sampling === "linear") imageSampling.set(image, SAMPLING_LINEAR);
1355
+ else throw new RangeError(`setImageSampling: unknown sampling '${String(sampling)}' (expected 'nearest' or 'linear')`);
1356
+ },
1331
1357
  setPostFxBinding(runtime, chain) {
1332
1358
  _boundRuntime = runtime;
1333
1359
  _boundChain = chain;
@@ -1335,16 +1361,9 @@ function createFrameRenderer(Skia) {
1335
1361
  hasPostFxBinding() {
1336
1362
  return _boundRuntime !== null && !!_boundRuntime.supported && _boundRuntime.buildPass !== void 0 && _boundChain !== null;
1337
1363
  },
1364
+ compilePostFxPasses,
1338
1365
  buildPostFxPasses(runtime, chain, width, height) {
1339
- const rt = runtime ?? _boundRuntime;
1340
- const ch = chain ?? _boundChain;
1341
- if (rt === null || !rt.supported) return [];
1342
- if (rt.buildPass === void 0) {
1343
- logOnce("buildPostFxPasses: runtime.supported but buildPass absent — no passes");
1344
- return [];
1345
- }
1346
- if (ch === null) return [];
1347
- const passes = rt.buildPass(ch, width, height);
1366
+ const passes = compilePostFxPasses(runtime, chain, width, height);
1348
1367
  if (passes.length === 0) return [];
1349
1368
  const out = [];
1350
1369
  for (const pass of passes) {
@@ -1405,6 +1424,15 @@ function getXformCounters() {
1405
1424
  unrotated: _xformUnrotatedCount
1406
1425
  };
1407
1426
  }
1427
+ /** Without a sampling setting this is exactly the 4-argument call the surface always received. */
1428
+ function drawAtlasSampled(cvs, image, srcs, dsts, paint, sampling) {
1429
+ if (sampling === void 0) cvs.drawAtlas(image, srcs, dsts, paint);
1430
+ else cvs.drawAtlas(image, srcs, dsts, paint, void 0, void 0, sampling);
1431
+ }
1432
+ function drawImageRectSampled(cvs, image, src, dst, paint, sampling) {
1433
+ if (sampling === void 0 || cvs.drawImageRectOptions === void 0) cvs.drawImageRect(image, src, dst, paint);
1434
+ else cvs.drawImageRectOptions(image, src, dst, sampling.filter, MIPMAP_NONE, paint);
1435
+ }
1408
1436
  function writeColor(out, color, alphaMul) {
1409
1437
  out[0] = color.r;
1410
1438
  out[1] = color.g;