@next2d/webgl 1.14.20

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 (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/BezierConverter.d.ts +59 -0
  4. package/dist/BezierConverter.js +106 -0
  5. package/dist/CanvasGradientToWebGL.d.ts +96 -0
  6. package/dist/CanvasGradientToWebGL.js +181 -0
  7. package/dist/CanvasPatternToWebGL.d.ts +39 -0
  8. package/dist/CanvasPatternToWebGL.js +66 -0
  9. package/dist/CanvasToWebGLContext.d.ts +591 -0
  10. package/dist/CanvasToWebGLContext.js +1427 -0
  11. package/dist/CanvasToWebGLContextBlend.d.ts +97 -0
  12. package/dist/CanvasToWebGLContextBlend.js +299 -0
  13. package/dist/CanvasToWebGLContextGrid.d.ts +74 -0
  14. package/dist/CanvasToWebGLContextGrid.js +283 -0
  15. package/dist/CanvasToWebGLContextMask.d.ts +113 -0
  16. package/dist/CanvasToWebGLContextMask.js +436 -0
  17. package/dist/CanvasToWebGLContextPath.d.ts +111 -0
  18. package/dist/CanvasToWebGLContextPath.js +210 -0
  19. package/dist/CanvasToWebGLContextStyle.d.ts +78 -0
  20. package/dist/CanvasToWebGLContextStyle.js +139 -0
  21. package/dist/ColorBufferPool.d.ts +58 -0
  22. package/dist/ColorBufferPool.js +134 -0
  23. package/dist/FrameBufferManager.d.ts +135 -0
  24. package/dist/FrameBufferManager.js +358 -0
  25. package/dist/StencilBufferPool.d.ts +56 -0
  26. package/dist/StencilBufferPool.js +142 -0
  27. package/dist/TextureManager.d.ts +130 -0
  28. package/dist/TextureManager.js +296 -0
  29. package/dist/VertexArrayObjectManager.d.ts +96 -0
  30. package/dist/VertexArrayObjectManager.js +277 -0
  31. package/dist/WebGLFillMeshGenerator.d.ts +31 -0
  32. package/dist/WebGLFillMeshGenerator.js +101 -0
  33. package/dist/WebGLStrokeMeshGenerator.d.ts +183 -0
  34. package/dist/WebGLStrokeMeshGenerator.js +504 -0
  35. package/dist/index.d.ts +6 -0
  36. package/dist/index.js +6 -0
  37. package/dist/interface/AttachmentImpl.d.ts +11 -0
  38. package/dist/interface/AttachmentImpl.js +1 -0
  39. package/dist/interface/BoundsImpl.d.ts +6 -0
  40. package/dist/interface/BoundsImpl.js +1 -0
  41. package/dist/interface/CapsStyleImpl.d.ts +1 -0
  42. package/dist/interface/CapsStyleImpl.js +1 -0
  43. package/dist/interface/ClipObjectImpl.d.ts +14 -0
  44. package/dist/interface/ClipObjectImpl.js +1 -0
  45. package/dist/interface/FillMeshImpl.d.ts +5 -0
  46. package/dist/interface/FillMeshImpl.js +1 -0
  47. package/dist/interface/GradientTypeImpl.d.ts +1 -0
  48. package/dist/interface/GradientTypeImpl.js +1 -0
  49. package/dist/interface/GridImpl.d.ts +6 -0
  50. package/dist/interface/GridImpl.js +1 -0
  51. package/dist/interface/IndexRangeImpl.d.ts +4 -0
  52. package/dist/interface/IndexRangeImpl.js +1 -0
  53. package/dist/interface/InterpolationMethodImpl.d.ts +1 -0
  54. package/dist/interface/InterpolationMethodImpl.js +1 -0
  55. package/dist/interface/JointStyleImpl.d.ts +1 -0
  56. package/dist/interface/JointStyleImpl.js +1 -0
  57. package/dist/interface/SpreadMethodImpl.d.ts +1 -0
  58. package/dist/interface/SpreadMethodImpl.js +1 -0
  59. package/dist/interface/StrokeMethImpl.d.ts +4 -0
  60. package/dist/interface/StrokeMethImpl.js +1 -0
  61. package/dist/interface/UniformDataImpl.d.ts +5 -0
  62. package/dist/interface/UniformDataImpl.js +1 -0
  63. package/dist/interface/VerticesImpl.d.ts +1 -0
  64. package/dist/interface/VerticesImpl.js +1 -0
  65. package/dist/shader/CanvasToWebGLShader.d.ts +85 -0
  66. package/dist/shader/CanvasToWebGLShader.js +192 -0
  67. package/dist/shader/CanvasToWebGLShaderList.d.ts +70 -0
  68. package/dist/shader/CanvasToWebGLShaderList.js +109 -0
  69. package/dist/shader/GradientLUTGenerator.d.ts +36 -0
  70. package/dist/shader/GradientLUTGenerator.js +123 -0
  71. package/dist/shader/WebGLShaderUniform.d.ts +52 -0
  72. package/dist/shader/WebGLShaderUniform.js +165 -0
  73. package/dist/shader/fragment/FragmentShaderLibrary.d.ts +18 -0
  74. package/dist/shader/fragment/FragmentShaderLibrary.js +35 -0
  75. package/dist/shader/fragment/FragmentShaderSource.d.ts +29 -0
  76. package/dist/shader/fragment/FragmentShaderSource.js +99 -0
  77. package/dist/shader/fragment/FragmentShaderSourceBlend.d.ts +67 -0
  78. package/dist/shader/fragment/FragmentShaderSourceBlend.js +319 -0
  79. package/dist/shader/fragment/FragmentShaderSourceGradient.d.ts +44 -0
  80. package/dist/shader/fragment/FragmentShaderSourceGradient.js +114 -0
  81. package/dist/shader/fragment/FragmentShaderSourceGradientLUT.d.ts +14 -0
  82. package/dist/shader/fragment/FragmentShaderSourceGradientLUT.js +58 -0
  83. package/dist/shader/fragment/FragmentShaderSourceTexture.d.ts +12 -0
  84. package/dist/shader/fragment/FragmentShaderSourceTexture.js +36 -0
  85. package/dist/shader/fragment/filter/FragmentShaderSourceBlurFilter.d.ts +12 -0
  86. package/dist/shader/fragment/filter/FragmentShaderSourceBlurFilter.js +42 -0
  87. package/dist/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.d.ts +11 -0
  88. package/dist/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.js +35 -0
  89. package/dist/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.d.ts +16 -0
  90. package/dist/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.js +80 -0
  91. package/dist/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.d.ts +15 -0
  92. package/dist/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.js +106 -0
  93. package/dist/shader/fragment/filter/FragmentShaderSourceFilter.d.ts +112 -0
  94. package/dist/shader/fragment/filter/FragmentShaderSourceFilter.js +275 -0
  95. package/dist/shader/variants/BlendShaderVariantCollection.d.ts +99 -0
  96. package/dist/shader/variants/BlendShaderVariantCollection.js +239 -0
  97. package/dist/shader/variants/FilterShaderVariantCollection.d.ts +150 -0
  98. package/dist/shader/variants/FilterShaderVariantCollection.js +395 -0
  99. package/dist/shader/variants/GradientLUTShaderVariantCollection.d.ts +49 -0
  100. package/dist/shader/variants/GradientLUTShaderVariantCollection.js +107 -0
  101. package/dist/shader/variants/GradientShapeShaderVariantCollection.d.ts +61 -0
  102. package/dist/shader/variants/GradientShapeShaderVariantCollection.js +196 -0
  103. package/dist/shader/variants/ShapeShaderVariantCollection.d.ts +117 -0
  104. package/dist/shader/variants/ShapeShaderVariantCollection.js +427 -0
  105. package/dist/shader/vertex/VertexShaderLibrary.d.ts +18 -0
  106. package/dist/shader/vertex/VertexShaderLibrary.js +75 -0
  107. package/dist/shader/vertex/VertexShaderSource.d.ts +23 -0
  108. package/dist/shader/vertex/VertexShaderSource.js +92 -0
  109. package/dist/shader/vertex/VertexShaderSourceFill.d.ts +45 -0
  110. package/dist/shader/vertex/VertexShaderSourceFill.js +112 -0
  111. package/dist/shader/vertex/VertexShaderSourceStroke.d.ts +27 -0
  112. package/dist/shader/vertex/VertexShaderSourceStroke.js +149 -0
  113. package/package.json +37 -0
@@ -0,0 +1,283 @@
1
+ import { $Math } from "@next2d/share";
2
+ /**
3
+ * @class
4
+ */
5
+ export class CanvasToWebGLContextGrid {
6
+ /**
7
+ * @constructor
8
+ * @public
9
+ */
10
+ constructor() {
11
+ /**
12
+ * @type {boolean}
13
+ * @default false
14
+ * @public
15
+ */
16
+ this.enabled = false;
17
+ /**
18
+ * @type {number}
19
+ * @default 1
20
+ * @public
21
+ */
22
+ this.parentMatrixA = 1;
23
+ /**
24
+ * @type {number}
25
+ * @default 1
26
+ * @public
27
+ */
28
+ this.parentMatrixB = 0;
29
+ /**
30
+ * @type {number}
31
+ * @default 1
32
+ * @public
33
+ */
34
+ this.parentMatrixC = 0;
35
+ /**
36
+ * @type {number}
37
+ * @default 1
38
+ * @public
39
+ */
40
+ this.parentMatrixD = 0;
41
+ /**
42
+ * @type {number}
43
+ * @default 1
44
+ * @public
45
+ */
46
+ this.parentMatrixE = 1;
47
+ /**
48
+ * @type {number}
49
+ * @default 1
50
+ * @public
51
+ */
52
+ this.parentMatrixF = 0;
53
+ /**
54
+ * @type {number}
55
+ * @default 1
56
+ * @public
57
+ */
58
+ this.parentMatrixG = 0;
59
+ /**
60
+ * @type {number}
61
+ * @default 1
62
+ * @public
63
+ */
64
+ this.parentMatrixH = 0;
65
+ /**
66
+ * @type {number}
67
+ * @default 1
68
+ * @public
69
+ */
70
+ this.parentMatrixI = 1;
71
+ /**
72
+ * @type {number}
73
+ * @default 1
74
+ * @public
75
+ */
76
+ this.ancestorMatrixA = 1;
77
+ /**
78
+ * @type {number}
79
+ * @default 1
80
+ * @public
81
+ */
82
+ this.ancestorMatrixB = 0;
83
+ /**
84
+ * @type {number}
85
+ * @default 1
86
+ * @public
87
+ */
88
+ this.ancestorMatrixC = 0;
89
+ /**
90
+ * @type {number}
91
+ * @default 1
92
+ * @public
93
+ */
94
+ this.ancestorMatrixD = 0;
95
+ /**
96
+ * @type {number}
97
+ * @default 1
98
+ * @public
99
+ */
100
+ this.ancestorMatrixE = 1;
101
+ /**
102
+ * @type {number}
103
+ * @default 1
104
+ * @public
105
+ */
106
+ this.ancestorMatrixF = 0;
107
+ /**
108
+ * @type {number}
109
+ * @default 1
110
+ * @public
111
+ */
112
+ this.ancestorMatrixG = 0;
113
+ /**
114
+ * @type {number}
115
+ * @default 1
116
+ * @public
117
+ */
118
+ this.ancestorMatrixH = 0;
119
+ /**
120
+ * @type {number}
121
+ * @default 1
122
+ * @public
123
+ */
124
+ this.ancestorMatrixI = 1;
125
+ /**
126
+ * @type {number}
127
+ * @default 0
128
+ * @public
129
+ */
130
+ this.parentViewportX = 0;
131
+ /**
132
+ * @type {number}
133
+ * @default 0
134
+ * @public
135
+ */
136
+ this.parentViewportY = 0;
137
+ /**
138
+ * @type {number}
139
+ * @default 0
140
+ * @public
141
+ */
142
+ this.parentViewportW = 0;
143
+ /**
144
+ * @type {number}
145
+ * @default 0
146
+ * @public
147
+ */
148
+ this.parentViewportH = 0;
149
+ /**
150
+ * @type {number}
151
+ * @default 0.00001
152
+ * @public
153
+ */
154
+ this.minXST = 0.00001;
155
+ /**
156
+ * @type {number}
157
+ * @default 0.00001
158
+ * @public
159
+ */
160
+ this.minYST = 0.00001;
161
+ /**
162
+ * @type {number}
163
+ * @default 0.00001
164
+ * @public
165
+ */
166
+ this.minXPQ = 0.00001;
167
+ /**
168
+ * @type {number}
169
+ * @default 0.00001
170
+ * @public
171
+ */
172
+ this.minYPQ = 0.00001;
173
+ /**
174
+ * @type {number}
175
+ * @default 0.99999
176
+ * @public
177
+ */
178
+ this.maxXST = 0.99999;
179
+ /**
180
+ * @type {number}
181
+ * @default 0.99999
182
+ * @public
183
+ */
184
+ this.maxYST = 0.99999;
185
+ /**
186
+ * @type {number}
187
+ * @default 0.99999
188
+ * @public
189
+ */
190
+ this.maxXPQ = 0.99999;
191
+ /**
192
+ * @type {number}
193
+ * @default 0.99999
194
+ * @public
195
+ */
196
+ this.maxYPQ = 0.99999;
197
+ }
198
+ /**
199
+ * @param {number} x
200
+ * @param {number} y
201
+ * @param {number} width
202
+ * @param {number} height
203
+ * @param {object} bounds
204
+ * @param {object} grid
205
+ * @param {number} same_scale
206
+ * @param {number} parentA
207
+ * @param {number} parentB
208
+ * @param {number} parentC
209
+ * @param {number} parentD
210
+ * @param {number} parentE
211
+ * @param {number} parentF
212
+ * @param {number} ancestorA
213
+ * @param {number} ancestorB
214
+ * @param {number} ancestorC
215
+ * @param {number} ancestorD
216
+ * @param {number} ancestorE
217
+ * @param {number} ancestorF
218
+ * @return {void}
219
+ * @method
220
+ * @public
221
+ */
222
+ enable(x, y, width, height, bounds, grid, same_scale, parentA, parentB, parentC, parentD, parentE, parentF, ancestorA, ancestorB, ancestorC, ancestorD, ancestorE, ancestorF) {
223
+ const boundsWidth = bounds.xMax - bounds.xMin;
224
+ const boundsHeight = bounds.yMax - bounds.yMin;
225
+ const gridWidth = grid.w;
226
+ const gridHeight = grid.h;
227
+ const sameWidth = $Math.abs($Math.ceil(boundsWidth * same_scale));
228
+ const sameHeight = $Math.abs($Math.ceil(boundsHeight * same_scale));
229
+ // 等倍サイズでの正規化grid
230
+ const minXST = gridWidth > 0 ? (grid.x - bounds.xMin) / boundsWidth : 0.00001;
231
+ const minYST = gridHeight > 0 ? (grid.y - bounds.yMin) / boundsHeight : 0.00001;
232
+ const maxXST = gridWidth > 0 ? (grid.x + grid.w - bounds.xMin) / boundsWidth : 0.99999;
233
+ const maxYST = gridHeight > 0 ? (grid.y + grid.h - bounds.yMin) / boundsHeight : 0.99999;
234
+ // 現在サイズでの正規化grid
235
+ let minXPQ = sameWidth * minXST / width;
236
+ let minYPQ = sameHeight * minYST / height;
237
+ let maxXPQ = (width - sameWidth * (1 - maxXST)) / width;
238
+ let maxYPQ = (height - sameHeight * (1 - maxYST)) / height;
239
+ if (minXPQ >= maxXPQ) {
240
+ const m = minXST / (minXST + (1 - maxXST));
241
+ minXPQ = $Math.max(m - 0.00001, 0);
242
+ maxXPQ = $Math.min(m + 0.00001, 1);
243
+ }
244
+ if (minYPQ >= maxYPQ) {
245
+ const m = minYST / (minYST + (1 - maxYST));
246
+ minYPQ = $Math.max(m - 0.00001, 0);
247
+ maxYPQ = $Math.min(m + 0.00001, 1);
248
+ }
249
+ this.enabled = true;
250
+ this.parentMatrixA = parentA;
251
+ this.parentMatrixB = parentB;
252
+ this.parentMatrixD = parentC;
253
+ this.parentMatrixE = parentD;
254
+ this.parentMatrixG = parentE;
255
+ this.parentMatrixH = parentF;
256
+ this.ancestorMatrixA = ancestorA;
257
+ this.ancestorMatrixB = ancestorB;
258
+ this.ancestorMatrixD = ancestorC;
259
+ this.ancestorMatrixE = ancestorD;
260
+ this.ancestorMatrixG = ancestorE;
261
+ this.ancestorMatrixH = ancestorF;
262
+ this.parentViewportX = x;
263
+ this.parentViewportY = y;
264
+ this.parentViewportW = width;
265
+ this.parentViewportH = height;
266
+ this.minXST = minXST;
267
+ this.minYST = minYST;
268
+ this.minXPQ = minXPQ;
269
+ this.minYPQ = minYPQ;
270
+ this.maxXST = maxXST;
271
+ this.maxYST = maxYST;
272
+ this.maxXPQ = maxXPQ;
273
+ this.maxYPQ = maxYPQ;
274
+ }
275
+ /**
276
+ * @return void
277
+ * @method
278
+ * @public
279
+ */
280
+ disable() {
281
+ this.enabled = false;
282
+ }
283
+ }
@@ -0,0 +1,113 @@
1
+ import type { CanvasToWebGLContext } from "./CanvasToWebGLContext";
2
+ /**
3
+ * @class
4
+ */
5
+ export declare class CanvasToWebGLContextMask {
6
+ private readonly _$context;
7
+ private readonly _$gl;
8
+ private readonly _$clips;
9
+ private readonly _$poolClip;
10
+ private _$clipStatus;
11
+ private _$containerClip;
12
+ private _$currentClip;
13
+ /**
14
+ * @param {CanvasToWebGLContext} context
15
+ * @param {WebGL2RenderingContext} gl
16
+ * @constructor
17
+ * @public
18
+ */
19
+ constructor(context: CanvasToWebGLContext, gl: WebGL2RenderingContext);
20
+ /**
21
+ * @member {boolean}
22
+ * @public
23
+ */
24
+ get containerClip(): boolean;
25
+ set containerClip(flag: boolean);
26
+ /**
27
+ * @param {boolean} mask
28
+ * @return {void}
29
+ * @method
30
+ * @private
31
+ */
32
+ _$onClear(mask: boolean): void;
33
+ /**
34
+ * @param {boolean} mask
35
+ * @return {void}
36
+ * @method
37
+ * @private
38
+ */
39
+ _$onBind(mask: boolean): void;
40
+ /**
41
+ * @return {void}
42
+ * @method
43
+ * @private
44
+ */
45
+ _$onClearRect(): void;
46
+ /**
47
+ * @return {void}
48
+ * @method
49
+ * @private
50
+ */
51
+ _$endClip(): void;
52
+ /**
53
+ * @return {void}
54
+ * @method
55
+ * @private
56
+ */
57
+ _$enterClip(): void;
58
+ /**
59
+ * @return {void}
60
+ * @method
61
+ * @private
62
+ */
63
+ _$beginClipDef(): void;
64
+ /**
65
+ * @return {void}
66
+ * @method
67
+ * @private
68
+ */
69
+ _$endClipDef(): void;
70
+ /**
71
+ * @return {void}
72
+ * @method
73
+ * @private
74
+ */
75
+ _$leaveClip(): void;
76
+ /**
77
+ * @return {void}
78
+ * @method
79
+ * @private
80
+ */
81
+ _$drawContainerClip(): void;
82
+ /**
83
+ * @param {number} level
84
+ * @param {number} w
85
+ * @param {number} h
86
+ * @return {void}
87
+ * @method
88
+ * @private
89
+ */
90
+ _$unionStencilMask(level: number, w: number, h: number): void;
91
+ /**
92
+ * @param {WebGLVertexArrayObject} vertex_array
93
+ * @param {Float32Array} matrix
94
+ * @param {number} width
95
+ * @param {number} height
96
+ * @return {boolean}
97
+ * @method
98
+ * @private
99
+ */
100
+ _$onClip(vertex_array: WebGLVertexArrayObject, matrix: Float32Array, width: number, height: number): boolean;
101
+ /**
102
+ * @return {void}
103
+ * @method
104
+ * @public
105
+ */
106
+ _$onSave(): void;
107
+ /**
108
+ * @return {void}
109
+ * @method
110
+ * @public
111
+ */
112
+ _$onRestore(): void;
113
+ }