@egret/runtime 0.0.0-stage → 7.0.2

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.
Files changed (157) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +21 -0
  3. package/README.md +70 -2
  4. package/README.zh-CN.md +71 -0
  5. package/dist/AssetLease.d.ts +23 -0
  6. package/dist/AssetLease.js +69 -0
  7. package/dist/AssetManager.d.ts +58 -0
  8. package/dist/AssetManager.js +451 -0
  9. package/dist/AssetRef.d.ts +21 -0
  10. package/dist/AssetRef.js +33 -0
  11. package/dist/Bitmap.d.ts +40 -0
  12. package/dist/Bitmap.js +545 -0
  13. package/dist/ByteReader.d.ts +32 -0
  14. package/dist/ByteReader.js +178 -0
  15. package/dist/ByteWriter.d.ts +30 -0
  16. package/dist/ByteWriter.js +181 -0
  17. package/dist/CancellationController.d.ts +10 -0
  18. package/dist/CancellationController.js +66 -0
  19. package/dist/DisplayObject.d.ts +97 -0
  20. package/dist/DisplayObject.js +366 -0
  21. package/dist/DisplayObjectContainer.d.ts +28 -0
  22. package/dist/DisplayObjectContainer.js +226 -0
  23. package/dist/EgretError.d.ts +12 -0
  24. package/dist/EgretError.js +36 -0
  25. package/dist/Event.d.ts +47 -0
  26. package/dist/Event.js +84 -0
  27. package/dist/EventDispatcher.d.ts +24 -0
  28. package/dist/EventDispatcher.js +178 -0
  29. package/dist/Graphics.d.ts +117 -0
  30. package/dist/Graphics.js +548 -0
  31. package/dist/Mesh2D.d.ts +27 -0
  32. package/dist/Mesh2D.js +200 -0
  33. package/dist/NineSliceBitmap.d.ts +24 -0
  34. package/dist/NineSliceBitmap.js +164 -0
  35. package/dist/NineSliceGeometry2D.d.ts +19 -0
  36. package/dist/NineSliceGeometry2D.js +126 -0
  37. package/dist/Scope.d.ts +19 -0
  38. package/dist/Scope.js +133 -0
  39. package/dist/SequencePlayer.d.ts +12 -0
  40. package/dist/SequencePlayer.js +69 -0
  41. package/dist/Sprite.d.ts +8 -0
  42. package/dist/Sprite.js +12 -0
  43. package/dist/Stage.d.ts +14 -0
  44. package/dist/Stage.js +31 -0
  45. package/dist/Texture.d.ts +30 -0
  46. package/dist/Texture.js +178 -0
  47. package/dist/assetManagerOwnerState.d.ts +36 -0
  48. package/dist/assetManagerOwnerState.js +115 -0
  49. package/dist/assetState.d.ts +45 -0
  50. package/dist/assetState.js +2 -0
  51. package/dist/atlasFrameLayout.d.ts +21 -0
  52. package/dist/atlasFrameLayout.js +48 -0
  53. package/dist/bitmapDisplayState.d.ts +24 -0
  54. package/dist/bitmapDisplayState.js +22 -0
  55. package/dist/coordinateInverse.d.ts +4 -0
  56. package/dist/coordinateInverse.js +107 -0
  57. package/dist/diagnostics.d.ts +4 -0
  58. package/dist/diagnostics.js +13 -0
  59. package/dist/displayBounds.d.ts +9 -0
  60. package/dist/displayBounds.js +181 -0
  61. package/dist/displayCoordinates.d.ts +8 -0
  62. package/dist/displayCoordinates.js +81 -0
  63. package/dist/displayHitState.d.ts +18 -0
  64. package/dist/displayHitState.js +97 -0
  65. package/dist/displayHitTest.d.ts +8 -0
  66. package/dist/displayHitTest.js +219 -0
  67. package/dist/displayInputOperations.d.ts +12 -0
  68. package/dist/displayInputOperations.js +71 -0
  69. package/dist/displayTransform.d.ts +5 -0
  70. package/dist/displayTransform.js +38 -0
  71. package/dist/displayTreeState.d.ts +90 -0
  72. package/dist/displayTreeState.js +450 -0
  73. package/dist/displayVisualState.d.ts +76 -0
  74. package/dist/displayVisualState.js +141 -0
  75. package/dist/errorHelp.d.ts +15 -0
  76. package/dist/errorHelp.js +435 -0
  77. package/dist/errorHelpZh.d.ts +5 -0
  78. package/dist/errorHelpZh.js +342 -0
  79. package/dist/geometry.d.ts +173 -0
  80. package/dist/geometry.js +311 -0
  81. package/dist/graphicsFill.d.ts +37 -0
  82. package/dist/graphicsFill.js +302 -0
  83. package/dist/graphicsShape.d.ts +170 -0
  84. package/dist/graphicsShape.js +961 -0
  85. package/dist/index.d.ts +53 -0
  86. package/dist/index.js +31 -0
  87. package/dist/input/PointerRouter.d.ts +4 -0
  88. package/dist/input/PointerRouter.js +453 -0
  89. package/dist/input/index.d.ts +3 -0
  90. package/dist/input/index.js +3 -0
  91. package/dist/input/types.d.ts +64 -0
  92. package/dist/input/types.js +3 -0
  93. package/dist/meshCaptureSnapshot.d.ts +5 -0
  94. package/dist/meshCaptureSnapshot.js +13 -0
  95. package/dist/meshDisplayState.d.ts +18 -0
  96. package/dist/meshDisplayState.js +21 -0
  97. package/dist/ownership.d.ts +75 -0
  98. package/dist/ownership.js +157 -0
  99. package/dist/paragraph/Paragraph.d.ts +13 -0
  100. package/dist/paragraph/Paragraph.js +193 -0
  101. package/dist/paragraph/ParagraphCache.d.ts +5 -0
  102. package/dist/paragraph/ParagraphCache.js +354 -0
  103. package/dist/paragraph/geometry.d.ts +4 -0
  104. package/dist/paragraph/geometry.js +180 -0
  105. package/dist/paragraph/index.d.ts +3 -0
  106. package/dist/paragraph/index.js +3 -0
  107. package/dist/paragraph/request.d.ts +6 -0
  108. package/dist/paragraph/request.js +191 -0
  109. package/dist/paragraph/types.d.ts +183 -0
  110. package/dist/paragraph/types.js +2 -0
  111. package/dist/preparedDisplaySubtree.d.ts +7 -0
  112. package/dist/preparedDisplaySubtree.js +205 -0
  113. package/dist/renderEffect.d.ts +57 -0
  114. package/dist/renderEffect.js +109 -0
  115. package/dist/sequenceClip.d.ts +48 -0
  116. package/dist/sequenceClip.js +197 -0
  117. package/dist/sharedFrameCapture.d.ts +24 -0
  118. package/dist/sharedFrameCapture.js +1128 -0
  119. package/dist/spriteSheet.d.ts +34 -0
  120. package/dist/spriteSheet.js +321 -0
  121. package/dist/srgbBytes.d.ts +3 -0
  122. package/dist/srgbBytes.js +64 -0
  123. package/dist/text/TextField.d.ts +13 -0
  124. package/dist/text/TextField.js +261 -0
  125. package/dist/text/TextRasterCache.d.ts +5 -0
  126. package/dist/text/TextRasterCache.js +1191 -0
  127. package/dist/text/budget.d.ts +51 -0
  128. package/dist/text/budget.js +116 -0
  129. package/dist/text/index.d.ts +4 -0
  130. package/dist/text/index.js +3 -0
  131. package/dist/text/plan.d.ts +16 -0
  132. package/dist/text/plan.js +238 -0
  133. package/dist/text/request.d.ts +44 -0
  134. package/dist/text/request.js +303 -0
  135. package/dist/text/types.d.ts +179 -0
  136. package/dist/text/types.js +2 -0
  137. package/dist/textDisplayState.d.ts +21 -0
  138. package/dist/textDisplayState.js +27 -0
  139. package/dist/ui/displayCommit.d.ts +43 -0
  140. package/dist/ui/displayCommit.js +384 -0
  141. package/dist/ui/editing.d.ts +3 -0
  142. package/dist/ui/editing.js +3 -0
  143. package/dist/ui/heightIndex.d.ts +35 -0
  144. package/dist/ui/heightIndex.js +295 -0
  145. package/dist/ui/index.d.ts +6 -0
  146. package/dist/ui/index.js +6 -0
  147. package/dist/ui/layout.d.ts +9 -0
  148. package/dist/ui/layout.js +349 -0
  149. package/dist/ui/managedState.d.ts +12 -0
  150. package/dist/ui/managedState.js +44 -0
  151. package/dist/ui/textEditState.d.ts +4 -0
  152. package/dist/ui/textEditState.js +206 -0
  153. package/dist/ui/textEditTypes.d.ts +48 -0
  154. package/dist/ui/textEditTypes.js +2 -0
  155. package/dist/ui/types.d.ts +99 -0
  156. package/dist/ui/types.js +2 -0
  157. package/package.json +44 -4
@@ -0,0 +1,170 @@
1
+ import type { ImageData2D, Matrix2D, Rectangle2D, SharedGeometry2D } from '@egret/contracts';
2
+ import type { ShapeGradient } from './graphicsFill.js';
3
+ import type { AssetLease } from './AssetLease.js';
4
+ import type { Texture } from './Texture.js';
5
+ /**
6
+ * An image as a fill: the lease of its texture, whether it repeats, and the map from a node's units to the image, in
7
+ * which 0 to 1 is once across it: `u = a·x + c·y + tx` and `v = b·x + d·y + ty`.
8
+ */
9
+ export interface ShapeBitmap {
10
+ readonly lease: AssetLease<Texture>;
11
+ readonly repeat: boolean;
12
+ readonly width: number;
13
+ readonly height: number;
14
+ readonly a: number;
15
+ readonly b: number;
16
+ readonly c: number;
17
+ readonly d: number;
18
+ readonly tx: number;
19
+ readonly ty: number;
20
+ }
21
+ /** `feather` is how far, in the node's units, the edge of what is painted fades to nothing; none when it is not there. */
22
+ export interface ShapePaint {
23
+ readonly color: number;
24
+ readonly alpha: number;
25
+ readonly gradient?: ShapeGradient | undefined;
26
+ readonly bitmap?: ShapeBitmap | undefined;
27
+ readonly feather?: number | undefined;
28
+ }
29
+ export type LineCaps = 'none' | 'round' | 'square';
30
+ export type LineJoints = 'miter' | 'round' | 'bevel';
31
+ /** A line: its width, how its ends and corners are drawn, and the lengths of its dashes and gaps in turn, if it is dashed. */
32
+ export interface ShapeLine extends ShapePaint {
33
+ readonly width: number;
34
+ readonly caps: LineCaps;
35
+ readonly joints: LineJoints;
36
+ readonly miterLimit: number;
37
+ readonly dash: readonly number[] | undefined;
38
+ }
39
+ /** A path being drawn with moveTo and lineTo: its paints, and each subpath as x, y pairs. */
40
+ export interface ShapePath {
41
+ readonly fill: ShapePaint | undefined;
42
+ readonly line: ShapeLine | undefined;
43
+ readonly subpaths: number[][];
44
+ }
45
+ /**
46
+ * Triangles that are drawn together: x, y of each vertex; linear-light r, g, b and alpha of each vertex; where each
47
+ * vertex is in its image; three vertex numbers for each triangle. They are over one white pixel, or over an image.
48
+ */
49
+ export interface ShapeBatch {
50
+ positions: number[];
51
+ colors: number[];
52
+ uvs: number[];
53
+ indices: number[];
54
+ bitmap: ShapeBitmap | undefined;
55
+ }
56
+ /** A drawing in order: the batches that are finished, and the one being added to. A fill of another image begins a batch. */
57
+ export interface ShapeDrawing extends ShapeBatch {
58
+ done: ShapeBatch[];
59
+ }
60
+ export interface ShapeState extends ShapeDrawing {
61
+ path: ShapePath | undefined;
62
+ /** What the lists and the path give, made when capture or bounds first ask after a change. */
63
+ resolved: ResolvedShape | undefined;
64
+ }
65
+ /** One geometry for each batch that has a triangle, in drawing order, with the image it is drawn over if it has one. */
66
+ export interface ResolvedPart {
67
+ readonly geometry: SharedGeometry2D;
68
+ readonly bitmap: ShapeBitmap | undefined;
69
+ }
70
+ export interface ResolvedShape {
71
+ readonly parts: readonly ResolvedPart[];
72
+ readonly bounds: Rectangle2D;
73
+ }
74
+ /** The most one node's shapes may hold: what one shared geometry takes. */
75
+ export declare const GRAPHICS_SHAPE_LIMITS: Readonly<{
76
+ maxVertices: 65536;
77
+ maxIndices: 196608;
78
+ maxLogicalBytes: 4980736;
79
+ maxPathPoints: 8192;
80
+ maxLineWidth: 1024;
81
+ maxDashes: 16384;
82
+ maxGradientStops: 16;
83
+ maxFillTriangles: 16384;
84
+ maxBatches: 16;
85
+ maxRepeatPixels: 8192;
86
+ }>;
87
+ /** The one white pixel every shape samples: its colour is the colour of its vertices. */
88
+ export declare const SHAPE_PAGE: ImageData2D;
89
+ export declare const SHAPE_REGION: Readonly<{
90
+ packed: Readonly<{
91
+ x: 0;
92
+ y: 0;
93
+ width: 1;
94
+ height: 1;
95
+ }>;
96
+ logicalWidth: 1;
97
+ logicalHeight: 1;
98
+ trimX: 0;
99
+ trimY: 0;
100
+ quarterTurn: 0;
101
+ }>;
102
+ export declare function createShapeState(): ShapeState;
103
+ /** A copy that can be drawn on without changing the drawing it was made from. */
104
+ export declare function copyDrawing(from: ShapeDrawing): ShapeDrawing;
105
+ type Target = ShapeDrawing;
106
+ /** A convex outline as a fan from its first corner. */
107
+ export declare function fillConvex(target: Target, outline: readonly number[], color: ShapePaint): void;
108
+ /** Any simple outline, by cutting ears. An outline that crosses itself is filled without a promise about where. */
109
+ export declare function fillPolygon(target: Target, outline: readonly number[], color: ShapePaint): void;
110
+ /**
111
+ * What closed outlines cover, filled. One outline that does not cross itself is cut into ears; several, or one that
112
+ * crosses itself, are filled by the non-zero rule, so an outline drawn the other way round inside another is a hole.
113
+ * A gradient is given as the colours of the corners, with triangles cut until that is close enough.
114
+ * False when the fill would take more triangles than one fill may.
115
+ */
116
+ export declare function fillOutlines(target: Target, outlines: readonly (readonly number[])[], convex: boolean, color: ShapePaint, edge?: boolean): boolean;
117
+ /**
118
+ * A line of a width along points. Two pieces meet at a corner in one point on its inside, so a translucent line is not
119
+ * darker there; its outside is a mitre, cut to a bevel when longer than `miterLimit` half-widths, a bevel or an arc.
120
+ * An open line ends flat, in a half square or in a half circle. False when its dashes are more than a line may have.
121
+ */
122
+ export declare function strokeLine(target: Target, line: readonly number[], closed: boolean, style: ShapeLine): boolean;
123
+ /** How many straight pieces a curve of this radius is drawn with: each is within a quarter unit of the curve. */
124
+ export declare function curveSegments(radius: number): number;
125
+ /** An ellipse as an outline, starting at its right and going on through its bottom. */
126
+ export declare function ellipseOutline(cx: number, cy: number, rx: number, ry: number): number[];
127
+ /** A rectangle whose corners are quarter ellipses of the two radii. */
128
+ export declare function roundRectOutline(x: number, y: number, width: number, height: number, rx: number, ry: number): number[];
129
+ /** The points of an arc after its first, which the caller has already placed. */
130
+ export declare function arcPoints(cx: number, cy: number, radius: number, start: number, end: number, anticlockwise: boolean): number[];
131
+ /** The points of a curve of two or three control points after its first, which is `from`. */
132
+ export declare function bezierPoints(from: readonly [number, number], controls: readonly number[], to: readonly [number, number]): number[];
133
+ /** A shape drawn at once: its fill under its line. False when it is more than a fill or a line may be. */
134
+ export declare function addOutline(target: Target, outline: readonly number[], convex: boolean, fill: ShapePaint | undefined, line: ShapeLine | undefined): boolean;
135
+ /** The triangles of a path: its parts filled together as closed outlines, then each lined, closed only where its ends meet. */
136
+ export declare function addPath(target: Target, path: ShapePath): boolean;
137
+ /** Whether a drawing of this many vertices and indices is one a node may hold. */
138
+ export declare function shapeFits(vertices: number, indices: number): boolean;
139
+ /** Whether a drawing is one a node may hold: every batch within what one geometry takes, and no more batches than a node has. */
140
+ export declare function drawingFits(drawing: ShapeDrawing): boolean;
141
+ /** The geometries and bounds of a node's shapes, or undefined while they hold no triangle. */
142
+ export declare function resolveShape(shape: ShapeState): ResolvedShape | undefined;
143
+ /** The image of a mask, the region of it that is whole, and where it lies in the masked node's units. */
144
+ export interface ShapeMaskImage {
145
+ readonly image: ImageData2D;
146
+ readonly region: {
147
+ readonly packed: Rectangle2D;
148
+ readonly logicalWidth: number;
149
+ readonly logicalHeight: number;
150
+ readonly trimX: 0;
151
+ readonly trimY: 0;
152
+ readonly quarterTurn: 0;
153
+ };
154
+ readonly rect: Rectangle2D;
155
+ }
156
+ /** The most pixels a side of a mask's image has, and how many samples a pixel takes on each side. */
157
+ export declare const SHAPE_MASK_LIMITS: Readonly<{
158
+ maxEdge: 2048;
159
+ samples: 4;
160
+ }>;
161
+ /**
162
+ * The image of what a mask draws, its filled rectangles and its drawing placed by `matrix` in the masked node's units,
163
+ * at `scale` pixels to a unit of that node. `mask` is what the image is kept for.
164
+ */
165
+ export declare function shapeMaskImage(mask: object, primitives: readonly {
166
+ readonly rect: Rectangle2D;
167
+ readonly alpha: number;
168
+ }[], shape: ResolvedShape | undefined, matrix: Matrix2D, scale: number): ShapeMaskImage;
169
+ export {};
170
+ //# sourceMappingURL=graphicsShape.d.ts.map