@egret/runtime 0.0.0-stage → 7.0.1-rc.3
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/LICENSE +201 -0
- package/NOTICE +21 -0
- package/README.md +70 -2
- package/README.zh-CN.md +71 -0
- package/dist/AssetLease.d.ts +23 -0
- package/dist/AssetLease.js +69 -0
- package/dist/AssetManager.d.ts +56 -0
- package/dist/AssetManager.js +451 -0
- package/dist/AssetRef.d.ts +20 -0
- package/dist/AssetRef.js +32 -0
- package/dist/Bitmap.d.ts +40 -0
- package/dist/Bitmap.js +545 -0
- package/dist/ByteReader.d.ts +30 -0
- package/dist/ByteReader.js +177 -0
- package/dist/ByteWriter.d.ts +29 -0
- package/dist/ByteWriter.js +180 -0
- package/dist/CancellationController.d.ts +10 -0
- package/dist/CancellationController.js +66 -0
- package/dist/DisplayObject.d.ts +89 -0
- package/dist/DisplayObject.js +340 -0
- package/dist/DisplayObjectContainer.d.ts +28 -0
- package/dist/DisplayObjectContainer.js +226 -0
- package/dist/EgretError.d.ts +11 -0
- package/dist/EgretError.js +36 -0
- package/dist/Event.d.ts +45 -0
- package/dist/Event.js +84 -0
- package/dist/EventDispatcher.d.ts +24 -0
- package/dist/EventDispatcher.js +178 -0
- package/dist/Graphics.d.ts +106 -0
- package/dist/Graphics.js +504 -0
- package/dist/Mesh2D.d.ts +27 -0
- package/dist/Mesh2D.js +200 -0
- package/dist/NineSliceBitmap.d.ts +24 -0
- package/dist/NineSliceBitmap.js +164 -0
- package/dist/NineSliceGeometry2D.d.ts +18 -0
- package/dist/NineSliceGeometry2D.js +126 -0
- package/dist/Scope.d.ts +18 -0
- package/dist/Scope.js +133 -0
- package/dist/SequencePlayer.d.ts +12 -0
- package/dist/SequencePlayer.js +69 -0
- package/dist/Sprite.d.ts +8 -0
- package/dist/Sprite.js +12 -0
- package/dist/Stage.d.ts +14 -0
- package/dist/Stage.js +31 -0
- package/dist/Texture.d.ts +29 -0
- package/dist/Texture.js +177 -0
- package/dist/assetManagerOwnerState.d.ts +36 -0
- package/dist/assetManagerOwnerState.js +115 -0
- package/dist/assetState.d.ts +44 -0
- package/dist/assetState.js +2 -0
- package/dist/atlasFrameLayout.d.ts +21 -0
- package/dist/atlasFrameLayout.js +48 -0
- package/dist/bitmapDisplayState.d.ts +24 -0
- package/dist/bitmapDisplayState.js +22 -0
- package/dist/coordinateInverse.d.ts +4 -0
- package/dist/coordinateInverse.js +107 -0
- package/dist/diagnostics.d.ts +4 -0
- package/dist/diagnostics.js +13 -0
- package/dist/displayBounds.d.ts +9 -0
- package/dist/displayBounds.js +181 -0
- package/dist/displayCoordinates.d.ts +8 -0
- package/dist/displayCoordinates.js +81 -0
- package/dist/displayHitState.d.ts +18 -0
- package/dist/displayHitState.js +97 -0
- package/dist/displayHitTest.d.ts +8 -0
- package/dist/displayHitTest.js +219 -0
- package/dist/displayInputOperations.d.ts +12 -0
- package/dist/displayInputOperations.js +71 -0
- package/dist/displayTransform.d.ts +5 -0
- package/dist/displayTransform.js +38 -0
- package/dist/displayTreeState.d.ts +90 -0
- package/dist/displayTreeState.js +450 -0
- package/dist/displayVisualState.d.ts +74 -0
- package/dist/displayVisualState.js +140 -0
- package/dist/errorHelp.d.ts +14 -0
- package/dist/errorHelp.js +432 -0
- package/dist/errorHelpZh.d.ts +5 -0
- package/dist/errorHelpZh.js +340 -0
- package/dist/graphicsFill.d.ts +37 -0
- package/dist/graphicsFill.js +302 -0
- package/dist/graphicsShape.d.ts +144 -0
- package/dist/graphicsShape.js +755 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +28 -0
- package/dist/input/PointerRouter.d.ts +4 -0
- package/dist/input/PointerRouter.js +453 -0
- package/dist/input/index.d.ts +3 -0
- package/dist/input/index.js +3 -0
- package/dist/input/types.d.ts +58 -0
- package/dist/input/types.js +3 -0
- package/dist/meshCaptureSnapshot.d.ts +5 -0
- package/dist/meshCaptureSnapshot.js +13 -0
- package/dist/meshDisplayState.d.ts +18 -0
- package/dist/meshDisplayState.js +21 -0
- package/dist/ownership.d.ts +75 -0
- package/dist/ownership.js +157 -0
- package/dist/paragraph/Paragraph.d.ts +13 -0
- package/dist/paragraph/Paragraph.js +193 -0
- package/dist/paragraph/ParagraphCache.d.ts +5 -0
- package/dist/paragraph/ParagraphCache.js +354 -0
- package/dist/paragraph/geometry.d.ts +4 -0
- package/dist/paragraph/geometry.js +180 -0
- package/dist/paragraph/index.d.ts +3 -0
- package/dist/paragraph/index.js +3 -0
- package/dist/paragraph/request.d.ts +6 -0
- package/dist/paragraph/request.js +191 -0
- package/dist/paragraph/types.d.ts +183 -0
- package/dist/paragraph/types.js +2 -0
- package/dist/preparedDisplaySubtree.d.ts +7 -0
- package/dist/preparedDisplaySubtree.js +205 -0
- package/dist/renderEffect.d.ts +47 -0
- package/dist/renderEffect.js +87 -0
- package/dist/sequenceClip.d.ts +42 -0
- package/dist/sequenceClip.js +196 -0
- package/dist/sharedFrameCapture.d.ts +24 -0
- package/dist/sharedFrameCapture.js +1069 -0
- package/dist/spriteSheet.d.ts +34 -0
- package/dist/spriteSheet.js +321 -0
- package/dist/srgbBytes.d.ts +3 -0
- package/dist/srgbBytes.js +64 -0
- package/dist/text/TextField.d.ts +13 -0
- package/dist/text/TextField.js +261 -0
- package/dist/text/TextRasterCache.d.ts +5 -0
- package/dist/text/TextRasterCache.js +1191 -0
- package/dist/text/budget.d.ts +51 -0
- package/dist/text/budget.js +116 -0
- package/dist/text/index.d.ts +4 -0
- package/dist/text/index.js +3 -0
- package/dist/text/plan.d.ts +16 -0
- package/dist/text/plan.js +238 -0
- package/dist/text/request.d.ts +44 -0
- package/dist/text/request.js +303 -0
- package/dist/text/types.d.ts +179 -0
- package/dist/text/types.js +2 -0
- package/dist/textDisplayState.d.ts +21 -0
- package/dist/textDisplayState.js +27 -0
- package/dist/ui/displayCommit.d.ts +43 -0
- package/dist/ui/displayCommit.js +376 -0
- package/dist/ui/editing.d.ts +3 -0
- package/dist/ui/editing.js +3 -0
- package/dist/ui/heightIndex.d.ts +35 -0
- package/dist/ui/heightIndex.js +295 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/layout.d.ts +9 -0
- package/dist/ui/layout.js +349 -0
- package/dist/ui/managedState.d.ts +12 -0
- package/dist/ui/managedState.js +44 -0
- package/dist/ui/textEditState.d.ts +4 -0
- package/dist/ui/textEditState.js +206 -0
- package/dist/ui/textEditTypes.d.ts +48 -0
- package/dist/ui/textEditTypes.js +2 -0
- package/dist/ui/types.d.ts +99 -0
- package/dist/ui/types.js +2 -0
- package/package.json +44 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Bitmap } from './Bitmap.js';
|
|
2
|
+
import type { SequenceClip, SequencePlaybackMode, SequenceSample } from './sequenceClip.js';
|
|
3
|
+
/** Explicit absolute-time selection borrowing a target and its exact current lease. */
|
|
4
|
+
export declare class SequencePlayer {
|
|
5
|
+
constructor(bitmap: Bitmap, clip: SequenceClip, mode?: SequencePlaybackMode);
|
|
6
|
+
applyAt(elapsedSeconds: number): SequenceSample;
|
|
7
|
+
get lastSample(): SequenceSample | undefined;
|
|
8
|
+
get isDisposed(): boolean;
|
|
9
|
+
/** Drop every borrow; the last owned immutable sample is safe to retain. */
|
|
10
|
+
dispose(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=SequencePlayer.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Bitmap, applyBitmapAtlasFrame, readBitmapBinding, readBitmapImage } from './Bitmap.js';
|
|
2
|
+
import { EgretError } from './EgretError.js';
|
|
3
|
+
import { commitBinding, engineOf } from './ownership.js';
|
|
4
|
+
import { sampleSequenceClip } from './sequenceClip.js';
|
|
5
|
+
const states = new WeakMap();
|
|
6
|
+
// Capture the trusted operation once; caller overrides never supply crop authority.
|
|
7
|
+
const setCrop = Object.getOwnPropertyDescriptor(Bitmap.prototype, 'sourceRect').set;
|
|
8
|
+
function stateOf(receiver) {
|
|
9
|
+
const state = states.get(receiver);
|
|
10
|
+
if (state === undefined)
|
|
11
|
+
throw new EgretError('SEQ_PLAYER_INVALID');
|
|
12
|
+
return state;
|
|
13
|
+
}
|
|
14
|
+
/** Explicit absolute-time selection borrowing a target and its exact current lease. */
|
|
15
|
+
export class SequencePlayer {
|
|
16
|
+
constructor(bitmap, clip, mode = 'once') {
|
|
17
|
+
const target = readBitmapBinding(bitmap);
|
|
18
|
+
if (target === undefined)
|
|
19
|
+
throw new EgretError('BITMAP_TEXTURE_REQUIRED');
|
|
20
|
+
const snapshot = readBitmapImage(target.lease);
|
|
21
|
+
if (mode !== 'once' && mode !== 'loop')
|
|
22
|
+
throw new EgretError('SEQ_INPUT_INVALID');
|
|
23
|
+
// Authenticate before reading even frozen-looking public clip dimensions.
|
|
24
|
+
sampleSequenceClip(clip, 0, { mode });
|
|
25
|
+
const { image, sourceRect } = snapshot;
|
|
26
|
+
if (snapshot.viewRegion !== null ||
|
|
27
|
+
sourceRect.x !== 0 ||
|
|
28
|
+
sourceRect.y !== 0 ||
|
|
29
|
+
sourceRect.width !== image.width ||
|
|
30
|
+
sourceRect.height !== image.height ||
|
|
31
|
+
clip.atlasWidth !== image.width ||
|
|
32
|
+
clip.atlasHeight !== image.height) {
|
|
33
|
+
throw new EgretError('SEQ_ATLAS_MISMATCH');
|
|
34
|
+
}
|
|
35
|
+
states.set(this, { binding: { bitmap, lease: target.lease, clip, mode }, lastSample: undefined });
|
|
36
|
+
// Affinity survives disposal, but cleanup belongs only to an adopting Scope.
|
|
37
|
+
commitBinding([this], engineOf(bitmap));
|
|
38
|
+
}
|
|
39
|
+
applyAt(elapsedSeconds) {
|
|
40
|
+
const state = stateOf(this);
|
|
41
|
+
const binding = state.binding;
|
|
42
|
+
if (binding === undefined)
|
|
43
|
+
throw new EgretError('SEQ_PLAYER_DISPOSED');
|
|
44
|
+
const target = readBitmapBinding(binding.bitmap);
|
|
45
|
+
// Exact identity precedes entitlement, including a cleared target slot.
|
|
46
|
+
if (target?.lease !== binding.lease)
|
|
47
|
+
throw new EgretError('SEQ_BINDING_CHANGED');
|
|
48
|
+
readBitmapImage(binding.lease);
|
|
49
|
+
const sample = sampleSequenceClip(binding.clip, elapsedSeconds, { mode: binding.mode });
|
|
50
|
+
if (sample.region.layout === undefined)
|
|
51
|
+
Reflect.apply(setCrop, binding.bitmap, [sample.region]);
|
|
52
|
+
else
|
|
53
|
+
applyBitmapAtlasFrame(binding.bitmap, sample.region);
|
|
54
|
+
// Crop and natural geometry have committed; only now publish the sample.
|
|
55
|
+
state.lastSample = sample;
|
|
56
|
+
return sample;
|
|
57
|
+
}
|
|
58
|
+
get lastSample() {
|
|
59
|
+
return stateOf(this).lastSample;
|
|
60
|
+
}
|
|
61
|
+
get isDisposed() {
|
|
62
|
+
return stateOf(this).binding === undefined;
|
|
63
|
+
}
|
|
64
|
+
/** Drop every borrow; the last owned immutable sample is safe to retain. */
|
|
65
|
+
dispose() {
|
|
66
|
+
stateOf(this).binding = undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=SequencePlayer.js.map
|
package/dist/Sprite.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DisplayObjectContainer } from './DisplayObjectContainer.js';
|
|
2
|
+
import { Graphics } from './Graphics.js';
|
|
3
|
+
/** Stable drawing facade; a Sprite never shares or rebinds its Graphics. */
|
|
4
|
+
export declare class Sprite extends DisplayObjectContainer {
|
|
5
|
+
readonly graphics: Graphics;
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Sprite.d.ts.map
|
package/dist/Sprite.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DisplayObjectContainer } from './DisplayObjectContainer.js';
|
|
2
|
+
import { Graphics } from './Graphics.js';
|
|
3
|
+
/** Stable drawing facade; a Sprite never shares or rebinds its Graphics. */
|
|
4
|
+
export class Sprite extends DisplayObjectContainer {
|
|
5
|
+
graphics;
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.graphics = new Graphics(this);
|
|
9
|
+
Object.defineProperty(this, 'graphics', { value: this.graphics, writable: false, configurable: false });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Sprite.js.map
|
package/dist/Stage.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DisplayObjectContainer } from "./DisplayObjectContainer.js";
|
|
2
|
+
import type { DisplayObject } from "./DisplayObject.js";
|
|
3
|
+
import type { HitTestOptions } from "./displayHitTest.js";
|
|
4
|
+
import { ASSERT_ATTACHABLE } from "./ownership.js";
|
|
5
|
+
import type { EngineContext } from "./ownership.js";
|
|
6
|
+
export declare let createStage: (engine: EngineContext) => Stage;
|
|
7
|
+
/** Created and bound by Engine; there is no implicit global stage. */
|
|
8
|
+
export declare class Stage extends DisplayObjectContainer {
|
|
9
|
+
private constructor();
|
|
10
|
+
/** Pick one authored input area after complete structural/arithmetic admission. */
|
|
11
|
+
hitTest(globalX: number, globalY: number, options?: HitTestOptions): DisplayObject | undefined;
|
|
12
|
+
[ASSERT_ATTACHABLE](): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Stage.d.ts.map
|
package/dist/Stage.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DisplayObjectContainer } from "./DisplayObjectContainer.js";
|
|
2
|
+
import { queryDisplayHit } from "./displayHitTest.js";
|
|
3
|
+
import { ASSERT_ATTACHABLE, bind } from "./ownership.js";
|
|
4
|
+
import { EgretError } from "./EgretError.js";
|
|
5
|
+
import { markStageRoot } from "./displayTreeState.js";
|
|
6
|
+
import { createPreparedDisplayOperations } from "./preparedDisplaySubtree.js";
|
|
7
|
+
export let createStage;
|
|
8
|
+
const CREATION_TOKEN = Symbol("egret.stageFactory");
|
|
9
|
+
/** Created and bound by Engine; there is no implicit global stage. */
|
|
10
|
+
export class Stage extends DisplayObjectContainer {
|
|
11
|
+
constructor(engine, token) {
|
|
12
|
+
super();
|
|
13
|
+
if (token !== CREATION_TOKEN)
|
|
14
|
+
throw new EgretError("STAGE_FACTORY_REQUIRED");
|
|
15
|
+
markStageRoot(this);
|
|
16
|
+
bind(this, engine);
|
|
17
|
+
engine.registerPreparedDisplayOperations?.(createPreparedDisplayOperations(this));
|
|
18
|
+
}
|
|
19
|
+
static {
|
|
20
|
+
createStage = (engine) => new Stage(engine, CREATION_TOKEN);
|
|
21
|
+
}
|
|
22
|
+
/** Pick one authored input area after complete structural/arithmetic admission. */
|
|
23
|
+
hitTest(globalX, globalY, options) {
|
|
24
|
+
return queryDisplayHit(this, globalX, globalY, options);
|
|
25
|
+
}
|
|
26
|
+
// A Stage is an engine root and cannot become another display node's child.
|
|
27
|
+
[ASSERT_ATTACHABLE]() {
|
|
28
|
+
throw new EgretError("STAGE_ROOT_ONLY");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Stage.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ImageData2D, TextureRegion2D, TextureViewRegionInput2D, TextureViewRegion2D } from "@egret/contracts";
|
|
2
|
+
/** An immutable CPU image view with a separate, terminal wrapper lifetime. */
|
|
3
|
+
export declare class Texture {
|
|
4
|
+
private readonly textureBrand;
|
|
5
|
+
private constructor();
|
|
6
|
+
get imageData(): ImageData2D;
|
|
7
|
+
get sourceRect(): TextureRegion2D;
|
|
8
|
+
get viewRegion(): TextureViewRegion2D | null;
|
|
9
|
+
get width(): number;
|
|
10
|
+
get height(): number;
|
|
11
|
+
get isDisposed(): boolean;
|
|
12
|
+
/** Drop only the wrapper reference; saved image values keep their own pixels. */
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function createTexture(image: ImageData2D, sourceRect?: TextureRegion2D): Texture;
|
|
16
|
+
/** Create an explicit logical view over an authentic straight CPU image. */
|
|
17
|
+
export declare function createTextureView(image: ImageData2D, region: TextureViewRegionInput2D): Texture;
|
|
18
|
+
/** Brand-only: disposal does not change the identity of a Texture. */
|
|
19
|
+
export declare function isTexture(value: unknown): value is Texture;
|
|
20
|
+
export interface TextureSnapshot2D {
|
|
21
|
+
readonly image: ImageData2D;
|
|
22
|
+
readonly sourceRect: TextureRegion2D;
|
|
23
|
+
readonly viewRegion: TextureViewRegion2D | null;
|
|
24
|
+
}
|
|
25
|
+
/** The image alone, under the checks of `readTextureSnapshot` and without a record of its own. */
|
|
26
|
+
export declare function readTextureImage(texture: Texture): ImageData2D;
|
|
27
|
+
/** Runtime-private authority; never consult subclass-overridable getters. */
|
|
28
|
+
export declare function readTextureSnapshot(texture: Texture): TextureSnapshot2D;
|
|
29
|
+
//# sourceMappingURL=Texture.d.ts.map
|
package/dist/Texture.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { isImageData2D } from "@egret/contracts";
|
|
2
|
+
import { EgretError } from "./EgretError.js";
|
|
3
|
+
// Capture the original intrinsic before descriptor callbacks can replace it;
|
|
4
|
+
// Texture snapshots must not introduce late callbacks inside resource checkpoints.
|
|
5
|
+
const freeze = Object.freeze;
|
|
6
|
+
const apply = Reflect.apply;
|
|
7
|
+
const isArray = Array.isArray;
|
|
8
|
+
const safeInteger = Number.isSafeInteger;
|
|
9
|
+
const TypeFault = TypeError;
|
|
10
|
+
const RangeFault = RangeError;
|
|
11
|
+
const weakGet = WeakMap.prototype.get;
|
|
12
|
+
const weakSet = WeakMap.prototype.set;
|
|
13
|
+
const weakHas = WeakMap.prototype.has;
|
|
14
|
+
const CREATION_TOKEN = Symbol("egret.textureFactory");
|
|
15
|
+
const states = new WeakMap();
|
|
16
|
+
let createInstance;
|
|
17
|
+
function stateOf(value) {
|
|
18
|
+
const state = apply(weakGet, states, [value]);
|
|
19
|
+
if (state === undefined)
|
|
20
|
+
throw new EgretError("TEXTURE_INVALID");
|
|
21
|
+
return state;
|
|
22
|
+
}
|
|
23
|
+
/** Snapshot every known field before validation; no callbacks occur at commit. */
|
|
24
|
+
function copyRegion(image, input) {
|
|
25
|
+
if (input === undefined)
|
|
26
|
+
return freeze({ x: 0, y: 0, width: image.width, height: image.height });
|
|
27
|
+
try {
|
|
28
|
+
if (input === null || typeof input !== "object")
|
|
29
|
+
throw new TypeError("Texture region must be a record");
|
|
30
|
+
const x = input.x, y = input.y, width = input.width, height = input.height;
|
|
31
|
+
for (const [value, positive] of [
|
|
32
|
+
[x, false],
|
|
33
|
+
[y, false],
|
|
34
|
+
[width, true],
|
|
35
|
+
[height, true]
|
|
36
|
+
]) {
|
|
37
|
+
if (typeof value !== "number")
|
|
38
|
+
throw new TypeError("Texture region fields must be numbers");
|
|
39
|
+
if (!Number.isSafeInteger(value) || (positive ? value <= 0 : value < 0))
|
|
40
|
+
throw new RangeError("Texture region integer range");
|
|
41
|
+
}
|
|
42
|
+
const right = x + width, bottom = y + height;
|
|
43
|
+
if (!Number.isSafeInteger(right) || !Number.isSafeInteger(bottom) || right > image.width || bottom > image.height) {
|
|
44
|
+
throw new RangeError("Texture region exceeds its image");
|
|
45
|
+
}
|
|
46
|
+
return freeze({ x: x === 0 ? 0 : x, y: y === 0 ? 0 : y, width, height });
|
|
47
|
+
}
|
|
48
|
+
catch (cause) {
|
|
49
|
+
throw new EgretError("TEXTURE_REGION_INVALID", { cause });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function viewInteger(value, positive, maximum) {
|
|
53
|
+
if (typeof value !== "number")
|
|
54
|
+
throw new TypeFault("Texture view region fields must be numbers");
|
|
55
|
+
if (!safeInteger(value) || (positive ? value <= 0 : value < 0) || value > maximum) {
|
|
56
|
+
throw new RangeFault("Texture view region integer range");
|
|
57
|
+
}
|
|
58
|
+
return value === 0 ? 0 : value;
|
|
59
|
+
}
|
|
60
|
+
/** Stage the entire region before validation, then own both immutable records. */
|
|
61
|
+
function copyViewRegion(image, input) {
|
|
62
|
+
try {
|
|
63
|
+
if (typeof input !== "object" || input === null || isArray(input)) {
|
|
64
|
+
throw new TypeFault("Texture view region must be a record");
|
|
65
|
+
}
|
|
66
|
+
const packedInput = input.packed;
|
|
67
|
+
const logicalWidthInput = input.logicalWidth;
|
|
68
|
+
const logicalHeightInput = input.logicalHeight;
|
|
69
|
+
const trimXInput = input.trimX;
|
|
70
|
+
const trimYInput = input.trimY;
|
|
71
|
+
const quarterTurnInput = input.quarterTurn;
|
|
72
|
+
// A late top-level getter outranks an earlier malformed packed record.
|
|
73
|
+
if (typeof packedInput !== "object" || packedInput === null || isArray(packedInput)) {
|
|
74
|
+
throw new TypeFault("Texture view region must be a record");
|
|
75
|
+
}
|
|
76
|
+
const xInput = packedInput.x;
|
|
77
|
+
const yInput = packedInput.y;
|
|
78
|
+
const widthInput = packedInput.width;
|
|
79
|
+
const heightInput = packedInput.height;
|
|
80
|
+
const x = viewInteger(xInput, false, 1048576);
|
|
81
|
+
const y = viewInteger(yInput, false, 1048576);
|
|
82
|
+
const width = viewInteger(widthInput, true, 1048576);
|
|
83
|
+
const height = viewInteger(heightInput, true, 1048576);
|
|
84
|
+
const logicalWidth = viewInteger(logicalWidthInput, true, 1048576);
|
|
85
|
+
const logicalHeight = viewInteger(logicalHeightInput, true, 1048576);
|
|
86
|
+
const trimX = viewInteger(trimXInput, false, 1048576);
|
|
87
|
+
const trimY = viewInteger(trimYInput, false, 1048576);
|
|
88
|
+
const quarterTurn = viewInteger(quarterTurnInput, false, 3);
|
|
89
|
+
const right = x + width, bottom = y + height;
|
|
90
|
+
if (!safeInteger(right) || !safeInteger(bottom) || right > image.width || bottom > image.height) {
|
|
91
|
+
throw new RangeFault("Texture view region exceeds its image");
|
|
92
|
+
}
|
|
93
|
+
const rotated = quarterTurn === 1 || quarterTurn === 3;
|
|
94
|
+
const contentWidth = rotated ? height : width;
|
|
95
|
+
const contentHeight = rotated ? width : height;
|
|
96
|
+
if (trimX + contentWidth > logicalWidth || trimY + contentHeight > logicalHeight) {
|
|
97
|
+
throw new RangeFault("Texture view content exceeds its logical region");
|
|
98
|
+
}
|
|
99
|
+
const packed = freeze({ x, y, width, height });
|
|
100
|
+
return freeze({ packed, logicalWidth, logicalHeight, trimX, trimY, quarterTurn: quarterTurn });
|
|
101
|
+
}
|
|
102
|
+
catch (cause) {
|
|
103
|
+
throw new EgretError("TEXTURE_VIEW_REGION_INVALID", { cause });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** An immutable CPU image view with a separate, terminal wrapper lifetime. */
|
|
107
|
+
export class Texture {
|
|
108
|
+
constructor(image, sourceRect, token, viewRegion) {
|
|
109
|
+
if (token !== CREATION_TOKEN)
|
|
110
|
+
throw new EgretError("TEXTURE_FACTORY_REQUIRED");
|
|
111
|
+
// The original registry operation prevents descriptor callbacks from adding
|
|
112
|
+
// a new callback between completed CPU ownership and identity publication.
|
|
113
|
+
apply(weakSet, states, [this, freeze({ image, sourceRect, viewRegion })]);
|
|
114
|
+
}
|
|
115
|
+
static {
|
|
116
|
+
createInstance = (image, sourceRect, viewRegion = null) => new Texture(image, sourceRect, CREATION_TOKEN, viewRegion);
|
|
117
|
+
}
|
|
118
|
+
get imageData() {
|
|
119
|
+
return readTextureSnapshot(this).image;
|
|
120
|
+
}
|
|
121
|
+
get sourceRect() {
|
|
122
|
+
return stateOf(this).sourceRect;
|
|
123
|
+
}
|
|
124
|
+
get viewRegion() {
|
|
125
|
+
return stateOf(this).viewRegion;
|
|
126
|
+
}
|
|
127
|
+
get width() {
|
|
128
|
+
return stateOf(this).sourceRect.width;
|
|
129
|
+
}
|
|
130
|
+
get height() {
|
|
131
|
+
return stateOf(this).sourceRect.height;
|
|
132
|
+
}
|
|
133
|
+
get isDisposed() {
|
|
134
|
+
return stateOf(this).image === undefined;
|
|
135
|
+
}
|
|
136
|
+
/** Drop only the wrapper reference; saved image values keep their own pixels. */
|
|
137
|
+
dispose() {
|
|
138
|
+
const state = stateOf(this);
|
|
139
|
+
if (state.image !== undefined)
|
|
140
|
+
apply(weakSet, states, [
|
|
141
|
+
this,
|
|
142
|
+
freeze({ image: undefined, sourceRect: state.sourceRect, viewRegion: state.viewRegion })
|
|
143
|
+
]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
export function createTexture(image, sourceRect) {
|
|
147
|
+
if (!isImageData2D(image))
|
|
148
|
+
throw new EgretError("TEXTURE_IMAGE_INVALID", { cause: new TypeError("Authentic ImageData2D required") });
|
|
149
|
+
return createInstance(image, copyRegion(image, sourceRect));
|
|
150
|
+
}
|
|
151
|
+
/** Create an explicit logical view over an authentic straight CPU image. */
|
|
152
|
+
export function createTextureView(image, region) {
|
|
153
|
+
if (!isImageData2D(image))
|
|
154
|
+
throw new EgretError("TEXTURE_IMAGE_INVALID", { cause: new TypeFault("Authentic ImageData2D required") });
|
|
155
|
+
const viewRegion = copyViewRegion(image, region);
|
|
156
|
+
// Instance allocation/registry failures are outside region-error wrapping.
|
|
157
|
+
return createInstance(image, viewRegion.packed, viewRegion);
|
|
158
|
+
}
|
|
159
|
+
/** Brand-only: disposal does not change the identity of a Texture. */
|
|
160
|
+
export function isTexture(value) {
|
|
161
|
+
return apply(weakHas, states, [value]);
|
|
162
|
+
}
|
|
163
|
+
/** The image alone, under the checks of `readTextureSnapshot` and without a record of its own. */
|
|
164
|
+
export function readTextureImage(texture) {
|
|
165
|
+
const image = stateOf(texture).image;
|
|
166
|
+
if (image === undefined)
|
|
167
|
+
throw new EgretError("TEXTURE_DISPOSED");
|
|
168
|
+
return image;
|
|
169
|
+
}
|
|
170
|
+
/** Runtime-private authority; never consult subclass-overridable getters. */
|
|
171
|
+
export function readTextureSnapshot(texture) {
|
|
172
|
+
const state = stateOf(texture);
|
|
173
|
+
if (state.image === undefined)
|
|
174
|
+
throw new EgretError("TEXTURE_DISPOSED");
|
|
175
|
+
return freeze({ image: state.image, sourceRect: state.sourceRect, viewRegion: state.viewRegion });
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=Texture.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AssetAcquireOptions, AssetProvider } from "./AssetManager.js";
|
|
2
|
+
import type { AssetLease } from "./AssetLease.js";
|
|
3
|
+
import type { AssetRef, AssetType } from "./AssetRef.js";
|
|
4
|
+
import type { EngineContext } from "./ownership.js";
|
|
5
|
+
/** @internal Narrow immutable group assembly; no manager or owner lookup escapes. */
|
|
6
|
+
export interface AssetGroupOperations {
|
|
7
|
+
readonly admitGroupRefs: (refs: readonly unknown[]) => void;
|
|
8
|
+
readonly acquire: <T>(ref: AssetRef<T>, options?: AssetAcquireOptions) => Promise<AssetLease<T>>;
|
|
9
|
+
readonly claimGroupLease: (lease: unknown, group: object) => void;
|
|
10
|
+
readonly releaseGroupLease: (lease: unknown) => void;
|
|
11
|
+
}
|
|
12
|
+
/** Private authority installed only by authentic AssetManager construction. */
|
|
13
|
+
interface AssetManagerOwner {
|
|
14
|
+
readonly context: EngineContext;
|
|
15
|
+
readonly assertOpen: () => void;
|
|
16
|
+
readonly register: <T>(type: AssetType<T>, provider: AssetProvider<NoInfer<T>>) => void;
|
|
17
|
+
readonly acquire: <T>(ref: AssetRef<T>, options?: AssetAcquireOptions) => Promise<AssetLease<T>>;
|
|
18
|
+
readonly invalidate: <T>(ref: AssetRef<T>) => void;
|
|
19
|
+
}
|
|
20
|
+
/** Called once from the manager constructor; no cache or provider import is needed. */
|
|
21
|
+
export declare function registerAssetManagerOwner(manager: object, owner: AssetManagerOwner): void;
|
|
22
|
+
/** Return the immutable intrinsic operations, never a structural caller port. */
|
|
23
|
+
export declare function requireAssetManagerOwner(value: unknown): AssetManagerOwner;
|
|
24
|
+
/** Only pre-commit preparation can be retried; the release callback is idempotent. */
|
|
25
|
+
export declare function beginTextCacheCreation(manager: object): () => void;
|
|
26
|
+
/** Consume the sole lifetime before provider registration or the fixed 32 ref IDs. */
|
|
27
|
+
export declare function commitTextCacheLifetime(manager: object, closeCache: () => void): void;
|
|
28
|
+
/** Make the manager unavailable without invoking any cache or external callback. */
|
|
29
|
+
export declare function markAssetManagerOwnerClosed(manager: object): void;
|
|
30
|
+
/** Consume first; trusted cache close handles and diagnoses its own cleanup faults. */
|
|
31
|
+
export declare function closeOwnedTextCache(manager: object): void;
|
|
32
|
+
/** One additional fixed paragraph profile shares the same manager and shutdown boundary. */
|
|
33
|
+
export declare function beginParagraphCacheCreation(manager: object): () => void;
|
|
34
|
+
export declare function commitParagraphCacheLifetime(manager: object, close: () => void): void;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=assetManagerOwnerState.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { EgretError } from "./EgretError.js";
|
|
2
|
+
const APPLY = Reflect.apply;
|
|
3
|
+
const WEAK_GET = WeakMap.prototype.get;
|
|
4
|
+
const WEAK_HAS = WeakMap.prototype.has;
|
|
5
|
+
const WEAK_SET = WeakMap.prototype.set;
|
|
6
|
+
const FREEZE = Object.freeze;
|
|
7
|
+
const states = new WeakMap();
|
|
8
|
+
function requireState(value) {
|
|
9
|
+
// Intrinsic lookup authenticates identity without any caller property read.
|
|
10
|
+
const state = APPLY(WEAK_GET, states, [value]);
|
|
11
|
+
if (state === undefined)
|
|
12
|
+
throw new EgretError("TEXT_ASSETS_INVALID");
|
|
13
|
+
return state;
|
|
14
|
+
}
|
|
15
|
+
function assertOwnerOpen(state) {
|
|
16
|
+
// Preserve the original manager/Engine cause before any lifetime or busy refusal.
|
|
17
|
+
state.owner.assertOpen();
|
|
18
|
+
if (state.closed)
|
|
19
|
+
throw new EgretError("TEXT_CACHE_CLOSED");
|
|
20
|
+
}
|
|
21
|
+
/** Called once from the manager constructor; no cache or provider import is needed. */
|
|
22
|
+
export function registerAssetManagerOwner(manager, owner) {
|
|
23
|
+
if (APPLY(WEAK_HAS, states, [manager]))
|
|
24
|
+
throw new EgretError("TEXT_ASSETS_INVALID");
|
|
25
|
+
APPLY(WEAK_SET, states, [
|
|
26
|
+
manager,
|
|
27
|
+
{
|
|
28
|
+
owner: FREEZE(owner),
|
|
29
|
+
closed: false,
|
|
30
|
+
creationBusy: false,
|
|
31
|
+
lifetimeCommitted: false,
|
|
32
|
+
closeCache: undefined,
|
|
33
|
+
paragraphLifetimeCommitted: false,
|
|
34
|
+
closeParagraphCache: undefined
|
|
35
|
+
}
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
/** Return the immutable intrinsic operations, never a structural caller port. */
|
|
39
|
+
export function requireAssetManagerOwner(value) {
|
|
40
|
+
return requireState(value).owner;
|
|
41
|
+
}
|
|
42
|
+
/** Only pre-commit preparation can be retried; the release callback is idempotent. */
|
|
43
|
+
export function beginTextCacheCreation(manager) {
|
|
44
|
+
const state = requireState(manager);
|
|
45
|
+
assertOwnerOpen(state);
|
|
46
|
+
if (state.lifetimeCommitted)
|
|
47
|
+
throw new EgretError("TEXT_CACHE_ALREADY_CREATED");
|
|
48
|
+
if (state.creationBusy)
|
|
49
|
+
throw new EgretError("TEXT_CACHE_REENTRANT");
|
|
50
|
+
state.creationBusy = true;
|
|
51
|
+
let active = true;
|
|
52
|
+
return () => {
|
|
53
|
+
if (!active)
|
|
54
|
+
return;
|
|
55
|
+
active = false;
|
|
56
|
+
state.creationBusy = false;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Consume the sole lifetime before provider registration or the fixed 32 ref IDs. */
|
|
60
|
+
export function commitTextCacheLifetime(manager, closeCache) {
|
|
61
|
+
const state = requireState(manager);
|
|
62
|
+
assertOwnerOpen(state);
|
|
63
|
+
if (state.lifetimeCommitted)
|
|
64
|
+
throw new EgretError("TEXT_CACHE_ALREADY_CREATED");
|
|
65
|
+
if (!state.creationBusy)
|
|
66
|
+
throw new EgretError("TEXT_CACHE_REENTRANT");
|
|
67
|
+
state.lifetimeCommitted = true;
|
|
68
|
+
state.closeCache = closeCache;
|
|
69
|
+
}
|
|
70
|
+
/** Make the manager unavailable without invoking any cache or external callback. */
|
|
71
|
+
export function markAssetManagerOwnerClosed(manager) {
|
|
72
|
+
requireState(manager).closed = true;
|
|
73
|
+
}
|
|
74
|
+
/** Consume first; trusted cache close handles and diagnoses its own cleanup faults. */
|
|
75
|
+
export function closeOwnedTextCache(manager) {
|
|
76
|
+
const state = requireState(manager);
|
|
77
|
+
const closeCache = state.closeCache;
|
|
78
|
+
state.closeCache = undefined;
|
|
79
|
+
const closeParagraphCache = state.closeParagraphCache;
|
|
80
|
+
state.closeParagraphCache = undefined;
|
|
81
|
+
try {
|
|
82
|
+
closeCache?.();
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
closeParagraphCache?.();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** One additional fixed paragraph profile shares the same manager and shutdown boundary. */
|
|
89
|
+
export function beginParagraphCacheCreation(manager) {
|
|
90
|
+
const state = requireState(manager);
|
|
91
|
+
assertOwnerOpen(state);
|
|
92
|
+
if (state.paragraphLifetimeCommitted)
|
|
93
|
+
throw new EgretError("PARAGRAPH_CACHE_ALREADY_CREATED");
|
|
94
|
+
if (state.creationBusy)
|
|
95
|
+
throw new EgretError("TEXT_CACHE_REENTRANT");
|
|
96
|
+
state.creationBusy = true;
|
|
97
|
+
let active = true;
|
|
98
|
+
return () => {
|
|
99
|
+
if (active) {
|
|
100
|
+
active = false;
|
|
101
|
+
state.creationBusy = false;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function commitParagraphCacheLifetime(manager, close) {
|
|
106
|
+
const state = requireState(manager);
|
|
107
|
+
assertOwnerOpen(state);
|
|
108
|
+
if (state.paragraphLifetimeCommitted)
|
|
109
|
+
throw new EgretError("PARAGRAPH_CACHE_ALREADY_CREATED");
|
|
110
|
+
if (!state.creationBusy)
|
|
111
|
+
throw new EgretError("TEXT_CACHE_REENTRANT");
|
|
112
|
+
state.paragraphLifetimeCommitted = true;
|
|
113
|
+
state.closeParagraphCache = close;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=assetManagerOwnerState.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CancellationSignal } from "@egret/contracts";
|
|
2
|
+
import type { AssetLease } from "./AssetLease.js";
|
|
3
|
+
import type { AssetRef } from "./AssetRef.js";
|
|
4
|
+
import type { CancellationController } from "./CancellationController.js";
|
|
5
|
+
/** Erased callbacks stay inside the manager; public generics remain invariant. */
|
|
6
|
+
export interface ProviderBinding {
|
|
7
|
+
readonly load: (ref: AssetRef<never>, context: AssetLoadContext) => Promise<unknown>;
|
|
8
|
+
readonly dispose: (value: unknown) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface AssetLoadContext {
|
|
11
|
+
readonly signal: CancellationSignal;
|
|
12
|
+
readonly resourceGeneration: number;
|
|
13
|
+
readonly taskId: number;
|
|
14
|
+
}
|
|
15
|
+
export interface Identity {
|
|
16
|
+
readonly type: object;
|
|
17
|
+
generation: number;
|
|
18
|
+
}
|
|
19
|
+
/** Installing is a transaction: detach waits until addEventListener has returned. */
|
|
20
|
+
export interface Waiter {
|
|
21
|
+
pending: boolean;
|
|
22
|
+
installing: boolean;
|
|
23
|
+
listening: boolean;
|
|
24
|
+
readonly signal: CancellationSignal | undefined;
|
|
25
|
+
readonly listener: () => void;
|
|
26
|
+
readonly resolve: (lease: AssetLease<unknown>) => void;
|
|
27
|
+
readonly reject: (cause: unknown) => void;
|
|
28
|
+
readonly entry: Entry;
|
|
29
|
+
}
|
|
30
|
+
export interface Entry {
|
|
31
|
+
readonly ref: AssetRef<never>;
|
|
32
|
+
readonly provider: ProviderBinding;
|
|
33
|
+
readonly controller: CancellationController;
|
|
34
|
+
readonly generation: number;
|
|
35
|
+
readonly taskId: number;
|
|
36
|
+
readonly waiters: Set<Waiter>;
|
|
37
|
+
readonly leases: Set<AssetLease<unknown>>;
|
|
38
|
+
state: "loading" | "ready" | "terminal";
|
|
39
|
+
started: boolean;
|
|
40
|
+
hasValue: boolean;
|
|
41
|
+
cleanupAttempted: boolean;
|
|
42
|
+
value: unknown;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=assetState.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Logical canvas and unpacked placement of a clockwise-packed atlas rectangle. */
|
|
2
|
+
export interface AtlasFrameLayout {
|
|
3
|
+
readonly sourceWidth: number;
|
|
4
|
+
readonly sourceHeight: number;
|
|
5
|
+
readonly trimX: number;
|
|
6
|
+
readonly trimY: number;
|
|
7
|
+
readonly packedRotation: 0 | 90;
|
|
8
|
+
}
|
|
9
|
+
interface Field {
|
|
10
|
+
readonly present: boolean;
|
|
11
|
+
readonly value: unknown;
|
|
12
|
+
}
|
|
13
|
+
interface CapturedLayout {
|
|
14
|
+
readonly fields?: readonly Field[];
|
|
15
|
+
}
|
|
16
|
+
/** Capture only; each factory owns its staging and semantic scheduling. */
|
|
17
|
+
export declare function captureAtlasFrameLayout(frame: object, read: (source: object, key: string) => Field, operation: <T>(callback: () => T) => T): CapturedLayout;
|
|
18
|
+
/** Validate scalars and allocate a frozen owned copy, retaining no caller graph. */
|
|
19
|
+
export declare function copyAtlasFrameLayout(captured: CapturedLayout, width: number, height: number, reject: (kind: 'shape' | 'region') => never): AtlasFrameLayout;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=atlasFrameLayout.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const keys = ['sourceWidth', 'sourceHeight', 'trimX', 'trimY', 'packedRotation'];
|
|
2
|
+
/** Capture only; each factory owns its staging and semantic scheduling. */
|
|
3
|
+
export function captureAtlasFrameLayout(frame, read, operation) {
|
|
4
|
+
const field = read(frame, 'layout');
|
|
5
|
+
if (!field.present || field.value === null || typeof field.value !== 'object')
|
|
6
|
+
return {};
|
|
7
|
+
if (operation(() => Array.isArray(field.value)))
|
|
8
|
+
return {};
|
|
9
|
+
const source = field.value;
|
|
10
|
+
const fields = [];
|
|
11
|
+
for (const key of keys)
|
|
12
|
+
fields.push(read(source, key));
|
|
13
|
+
return { fields };
|
|
14
|
+
}
|
|
15
|
+
/** Validate scalars and allocate a frozen owned copy, retaining no caller graph. */
|
|
16
|
+
export function copyAtlasFrameLayout(captured, width, height, reject) {
|
|
17
|
+
const fields = captured.fields;
|
|
18
|
+
if (fields === undefined || fields.some(field => !field.present))
|
|
19
|
+
return reject('shape');
|
|
20
|
+
const values = fields.map(field => field.value);
|
|
21
|
+
const [sourceWidth, sourceHeight, trimX, trimY, packedRotation] = values;
|
|
22
|
+
if (typeof sourceWidth !== 'number' ||
|
|
23
|
+
!Number.isSafeInteger(sourceWidth) ||
|
|
24
|
+
sourceWidth <= 0 ||
|
|
25
|
+
typeof sourceHeight !== 'number' ||
|
|
26
|
+
!Number.isSafeInteger(sourceHeight) ||
|
|
27
|
+
sourceHeight <= 0 ||
|
|
28
|
+
typeof trimX !== 'number' ||
|
|
29
|
+
!Number.isSafeInteger(trimX) ||
|
|
30
|
+
trimX < 0 ||
|
|
31
|
+
typeof trimY !== 'number' ||
|
|
32
|
+
!Number.isSafeInteger(trimY) ||
|
|
33
|
+
trimY < 0 ||
|
|
34
|
+
(packedRotation !== 0 && packedRotation !== 90))
|
|
35
|
+
return reject('region');
|
|
36
|
+
const right = trimX + (packedRotation === 90 ? height : width);
|
|
37
|
+
const bottom = trimY + (packedRotation === 90 ? width : height);
|
|
38
|
+
if (!Number.isSafeInteger(right) || !Number.isSafeInteger(bottom) || right > sourceWidth || bottom > sourceHeight)
|
|
39
|
+
return reject('region');
|
|
40
|
+
return Object.freeze({
|
|
41
|
+
sourceWidth,
|
|
42
|
+
sourceHeight,
|
|
43
|
+
trimX: trimX === 0 ? 0 : trimX,
|
|
44
|
+
trimY: trimY === 0 ? 0 : trimY,
|
|
45
|
+
packedRotation: packedRotation === 0 ? 0 : 90
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=atlasFrameLayout.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AtlasFrameLayout } from './atlasFrameLayout.js';
|
|
2
|
+
import type { DisplayObject } from './DisplayObject.js';
|
|
3
|
+
import type { AssetLease } from './AssetLease.js';
|
|
4
|
+
import type { Texture } from './Texture.js';
|
|
5
|
+
import type { TextureRegion2D, TextureViewRegion2D } from '@egret/contracts';
|
|
6
|
+
export interface BitmapCaptureState {
|
|
7
|
+
readonly layout?: AtlasFrameLayout;
|
|
8
|
+
readonly lease: AssetLease<Texture>;
|
|
9
|
+
readonly sourceRect: TextureRegion2D;
|
|
10
|
+
readonly viewRegion: TextureViewRegion2D | null;
|
|
11
|
+
readonly width: number;
|
|
12
|
+
readonly height: number;
|
|
13
|
+
}
|
|
14
|
+
/** Call-local internal read view; it grants no lease or published-state authority. */
|
|
15
|
+
export interface BitmapCaptureView {
|
|
16
|
+
read(node: DisplayObject): BitmapCaptureState | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** A registered cleared slot remains different from an unregistered receiver. */
|
|
19
|
+
export declare function hasBitmapState(value: unknown): boolean;
|
|
20
|
+
/** Read cached metadata only; this port grants no live image entitlement. */
|
|
21
|
+
export declare function readBitmapState(node: DisplayObject): BitmapCaptureState | undefined;
|
|
22
|
+
/** Bitmap alone writes its slot, preserving existing mutation/lifetime guards. */
|
|
23
|
+
export declare function writeBitmapState(node: DisplayObject, value: BitmapCaptureState | undefined): void;
|
|
24
|
+
//# sourceMappingURL=bitmapDisplayState.d.ts.map
|