@next2d/display 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.
@@ -0,0 +1,571 @@
1
+ import { BitmapData } from "./BitmapData";
2
+ import { Matrix } from "@next2d/geom";
3
+ import { GraphicsParentImpl, CapsStyleImpl, JointStyleImpl, FilterArrayImpl, BlendModeImpl, BoundsImpl, PlayerHitObjectImpl, SpreadMethodImpl, GradientTypeImpl, InterpolationMethodImpl } from "@next2d/interface";
4
+ import { CanvasToWebGLContext } from "@next2d/webgl";
5
+ /**
6
+ * Graphics クラスには、ベクターシェイプの作成に使用できる一連のメソッドがあります。
7
+ * 描画をサポートする表示オブジェクトには、Sprite および Shape オブジェクトがあります。
8
+ * これらの各クラスには、Graphics オブジェクトである graphics プロパティがあります。
9
+ * 以下は、簡単に使用できるように用意されているヘルパー関数の一例です。
10
+ * drawRect()、drawRoundRect()、drawCircle()、および drawEllipse()。
11
+ *
12
+ * The Graphics class contains a set of methods that you can use to create a vector shape.
13
+ * Display objects that support drawing include Sprite and Shape objects.
14
+ * Each of these classes includes a graphics property that is a Graphics object.
15
+ * The following are among those helper functions provided for ease of use:
16
+ * drawRect(), drawRoundRect(), drawCircle(), and drawEllipse().
17
+ *
18
+ * @class
19
+ * @memberOf next2d.display
20
+ */
21
+ export declare class Graphics {
22
+ private readonly _$displayObject;
23
+ _$maxAlpha: number;
24
+ private _$pointerX;
25
+ private _$pointerY;
26
+ _$canDraw: boolean;
27
+ private _$fillType;
28
+ private _$fillGradient;
29
+ private _$fillBitmap;
30
+ private _$fillStyleR;
31
+ private _$fillStyleG;
32
+ private _$fillStyleB;
33
+ private _$fillStyleA;
34
+ private _$doFill;
35
+ private _$lineType;
36
+ private _$lineGradient;
37
+ private _$caps;
38
+ private _$joints;
39
+ private _$miterLimit;
40
+ private _$lineWidth;
41
+ private _$lineStyleR;
42
+ private _$lineStyleG;
43
+ private _$lineStyleB;
44
+ private _$lineStyleA;
45
+ private _$doLine;
46
+ _$xMin: number;
47
+ _$xMax: number;
48
+ _$yMin: number;
49
+ _$yMax: number;
50
+ _$buffer: Float32Array | null;
51
+ _$recode: any[] | null;
52
+ private _$fills;
53
+ private _$lines;
54
+ /**
55
+ * @param {DisplayObject} src
56
+ *
57
+ * @constructor
58
+ * @public
59
+ */
60
+ constructor(src?: GraphicsParentImpl<any> | null);
61
+ /**
62
+ * @description 指定されたクラスのストリングを返します。
63
+ * Returns the string representation of the specified class.
64
+ *
65
+ * @return {string}
66
+ * @default [class Graphics]
67
+ * @method
68
+ * @static
69
+ */
70
+ static toString(): string;
71
+ /**
72
+ * @description 指定されたクラスの空間名を返します。
73
+ * Returns the space name of the specified class.
74
+ *
75
+ * @return {string}
76
+ * @default next2d.display.Bitmap
77
+ * @const
78
+ * @static
79
+ */
80
+ static get namespace(): string;
81
+ /**
82
+ * @description 指定されたオブジェクトのストリングを返します。
83
+ * Returns the string representation of the specified object.
84
+ *
85
+ * @return {string}
86
+ * @default [object Graphics]
87
+ * @method
88
+ * @public
89
+ */
90
+ toString(): string;
91
+ /**
92
+ * @description 指定されたオブジェクトの空間名を返します。
93
+ * Returns the space name of the specified object.
94
+ *
95
+ * @return {string}
96
+ * @default next2d.display.Graphics
97
+ * @const
98
+ * @public
99
+ */
100
+ get namespace(): string;
101
+ /**
102
+ * @return {number}
103
+ * @default 0
104
+ * @const
105
+ * @static
106
+ * @private
107
+ */
108
+ static get MOVE_TO(): number;
109
+ /**
110
+ * @return {number}
111
+ * @default 1
112
+ * @const
113
+ * @static
114
+ * @private
115
+ */
116
+ static get CURVE_TO(): number;
117
+ /**
118
+ * @return {number}
119
+ * @default 2
120
+ * @const
121
+ * @static
122
+ * @private
123
+ */
124
+ static get LINE_TO(): number;
125
+ /**
126
+ * @return {number}
127
+ * @default 3
128
+ * @const
129
+ * @static
130
+ * @private
131
+ */
132
+ static get CUBIC(): number;
133
+ /**
134
+ * @return {number}
135
+ * @default 4
136
+ * @const
137
+ * @static
138
+ * @private
139
+ */
140
+ static get ARC(): number;
141
+ /**
142
+ * @return {number}
143
+ * @default 5
144
+ * @const
145
+ * @static
146
+ * @private
147
+ */
148
+ static get FILL_STYLE(): number;
149
+ /**
150
+ * @return {number}
151
+ * @default 6
152
+ * @const
153
+ * @static
154
+ * @private
155
+ */
156
+ static get STROKE_STYLE(): number;
157
+ /**
158
+ * @return {number}
159
+ * @default 7
160
+ * @const
161
+ * @static
162
+ * @private
163
+ */
164
+ static get END_FILL(): number;
165
+ /**
166
+ * @return {number}
167
+ * @default 8
168
+ * @const
169
+ * @static
170
+ * @private
171
+ */
172
+ static get END_STROKE(): number;
173
+ /**
174
+ * @return {number}
175
+ * @default 9
176
+ * @const
177
+ * @static
178
+ * @private
179
+ */
180
+ static get BEGIN_PATH(): number;
181
+ /**
182
+ * @return {number}
183
+ * @default 10
184
+ * @const
185
+ * @static
186
+ * @private
187
+ */
188
+ static get GRADIENT_FILL(): number;
189
+ /**
190
+ * @return {number}
191
+ * @default 11
192
+ * @const
193
+ * @static
194
+ * @private
195
+ */
196
+ static get GRADIENT_STROKE(): number;
197
+ /**
198
+ * @return {number}
199
+ * @default 12
200
+ * @const
201
+ * @static
202
+ * @private
203
+ */
204
+ static get CLOSE_PATH(): number;
205
+ /**
206
+ * @return {number}
207
+ * @default 13
208
+ * @const
209
+ * @static
210
+ * @private
211
+ */
212
+ static get BITMAP_FILL(): number;
213
+ /**
214
+ * @return {number}
215
+ * @default 14
216
+ * @const
217
+ * @static
218
+ * @private
219
+ */
220
+ static get BITMAP_STROKE(): number;
221
+ /**
222
+ * @description 描画領域をビットマップイメージで塗りつぶします。
223
+ * Fills a drawing area with a bitmap image.
224
+ *
225
+ * @param {BitmapData} bitmap_data
226
+ * @param {Matrix} [matrix=null]
227
+ * @param {boolean} [repeat=true]
228
+ * @param {boolean} [smooth=false]
229
+ * @return {Graphics}
230
+ * @method
231
+ * @public
232
+ */
233
+ beginBitmapFill(bitmap_data: BitmapData, matrix?: Matrix | null, repeat?: boolean, smooth?: boolean): Graphics;
234
+ /**
235
+ * @description 描画のときに他の Graphics メソッド(lineTo() や drawCircle() など)
236
+ * に対する今後の呼び出しに使用する単純な一色塗りを指定します。
237
+ * Specifies a simple one-color fill that subsequent calls
238
+ * to other Graphics methods (such as lineTo() or drawCircle()) use when drawing.
239
+ *
240
+ * @param {string|number} [color=0]
241
+ * @param {number} [alpha=1.0]
242
+ * @return {Graphics}
243
+ * @method
244
+ * @public
245
+ */
246
+ beginFill(color?: string | number, alpha?: number): Graphics;
247
+ /**
248
+ * @description Graphics の他のメソッド(lineTo()、drawCircle() など)に対する、
249
+ * オブジェクトの後続の呼び出しに使用するグラデーション塗りを指定します。
250
+ * Specifies a gradient fill used by subsequent calls
251
+ * to other Graphics methods (such as lineTo() or drawCircle()) for the object.
252
+ *
253
+ * @param {string} type
254
+ * @param {array} colors
255
+ * @param {array} alphas
256
+ * @param {array} ratios
257
+ * @param {Matrix} [matrix=null]
258
+ * @param {string} [spread_method=SpreadMethod.PAD]
259
+ * @param {string} [interpolation_method=InterpolationMethod.RGB]
260
+ * @param {number} [focal_point_ratio=0]
261
+ * @return {Graphics}
262
+ * @method
263
+ * @public
264
+ */
265
+ beginGradientFill(type: GradientTypeImpl, colors: number[] | string[], alphas: number[], ratios: number[], matrix?: Matrix | null, spread_method?: SpreadMethodImpl, interpolation_method?: InterpolationMethodImpl, focal_point_ratio?: number): Graphics;
266
+ /**
267
+ * @description この Graphics オブジェクトに描画されているグラフィックをクリアし、
268
+ * 塗りと線のスタイルの設定をリセットします。
269
+ * Clears the graphics that were drawn to this Graphics object,
270
+ * and resets fill and line style settings.
271
+ *
272
+ * @return {Graphics}
273
+ * @method
274
+ * @public
275
+ */
276
+ clear(): Graphics;
277
+ /**
278
+ * @description すべての描画コマンドをソース Graphics オブジェクトから、呼び出し Graphics オブジェクトにコピーします。
279
+ * Copies all of drawing commands from the source Graphics object into the calling Graphics object.
280
+ *
281
+ * @return {Graphics}
282
+ * @method
283
+ * @public
284
+ */
285
+ clone(): Graphics;
286
+ /**
287
+ * @description すべての描画コマンドをソース Graphics オブジェクトから、呼び出し Graphics オブジェクトにコピーします。
288
+ * Copies all of drawing commands from the source Graphics object into the calling Graphics object.
289
+ *
290
+ * @param {Graphics} graphics
291
+ * @return {void}
292
+ * @method
293
+ * @public
294
+ */
295
+ copyFrom(graphics: Graphics): void;
296
+ /**
297
+ * @description 現在の描画位置から指定されたアンカーポイントに 3 次ベジェ曲線を描画します。
298
+ * Draws a cubic Bezier curve from the current drawing position to the specified anchor point.
299
+ *
300
+ * @param {number} control_x1
301
+ * @param {number} control_y1
302
+ * @param {number} control_x2
303
+ * @param {number} control_y2
304
+ * @param {number} anchor_x
305
+ * @param {number} anchor_y
306
+ * @return {Graphics}
307
+ * @method
308
+ * @public
309
+ */
310
+ cubicCurveTo(control_x1: number, control_y1: number, control_x2: number, control_y2: number, anchor_x: number, anchor_y: number): Graphics;
311
+ /**
312
+ * @description (controlX, controlY) で指定されたコントロールポイントを使用し、
313
+ * 現在の描画位置から (anchorX, anchorY) まで、現在の線のスタイルで 2 次ベジェ曲線を描画します。
314
+ * Draws a quadratic Bezier curve using the current line style from
315
+ * the current drawing position to (anchorX, anchorY)
316
+ * and using the control point that (controlX, controlY) specifies.
317
+ *
318
+ * @param {number} control_x
319
+ * @param {number} control_y
320
+ * @param {number} anchor_x
321
+ * @param {number} anchor_y
322
+ * @return {Graphics}
323
+ * @method
324
+ * @public
325
+ */
326
+ curveTo(control_x: number, control_y: number, anchor_x: number, anchor_y: number): Graphics;
327
+ /**
328
+ * @description 円を描画します。
329
+ * Draws a circle.
330
+ *
331
+ * @param {number} x
332
+ * @param {number} y
333
+ * @param {number} radius
334
+ * @return {Graphics}
335
+ * @method
336
+ * @public
337
+ */
338
+ drawCircle(x: number, y: number, radius: number): Graphics;
339
+ /**
340
+ * @description 楕円を描画します。
341
+ * Draws an ellipse.
342
+ *
343
+ * @param {number} x
344
+ * @param {number} y
345
+ * @param {number} width
346
+ * @param {number} height
347
+ * @return {Graphics}
348
+ * @method
349
+ * @public
350
+ */
351
+ drawEllipse(x: number, y: number, width: number, height: number): Graphics;
352
+ /**
353
+ * @description 矩形を描画します。
354
+ * Draws a rectangle.
355
+ *
356
+ * @param {number} x
357
+ * @param {number} y
358
+ * @param {number} width
359
+ * @param {number} height
360
+ * @return {Graphics}
361
+ * @method
362
+ * @public
363
+ */
364
+ drawRect(x: number, y: number, width: number, height: number): Graphics;
365
+ /**
366
+ * @description 角丸矩形を描画します。
367
+ * Draws a rounded rectangle.
368
+ *
369
+ * @param {number} x
370
+ * @param {number} y
371
+ * @param {number} width
372
+ * @param {number} height
373
+ * @param {number} ellipse_width
374
+ * @param {number} [ellipse_height=NaN]
375
+ * @return {Graphics}
376
+ * @method
377
+ * @public
378
+ */
379
+ drawRoundRect(x: number, y: number, width: number, height: number, ellipse_width: number, ellipse_height?: number): Graphics;
380
+ /**
381
+ * @description beginFill()、beginGradientFill()、または beginBitmapFill() メソッドへの
382
+ * 最後の呼び出し以降に追加された線と曲線に塗りを適用します。
383
+ * Applies a fill to the lines and curves that were added since
384
+ * the last call to the beginFill(), beginGradientFill(),
385
+ * or beginBitmapFill() method.
386
+ *
387
+ * @return {Graphics}
388
+ * @method
389
+ * @public
390
+ */
391
+ endFill(): Graphics;
392
+ /**
393
+ * @description lineStyle()、または lineGradientStyle() メソッドへの
394
+ * 最後の呼び出し以降に追加された線と曲線に塗りを適用します。
395
+ * Applies a fill to the lines and curves that were added since
396
+ * the last call to the beginFill() or beginGradientFill() method.
397
+ *
398
+ * @return {Graphics}
399
+ * @method
400
+ * @public
401
+ */
402
+ endLine(): Graphics;
403
+ /**
404
+ * @description 線の描画で、線として使用するビットマップを指定します。
405
+ * Specifies a bitmap to use for the line stroke when drawing lines.
406
+ *
407
+ * @param {BitmapData} bitmap_data
408
+ * @param {Matrix} [matrix=null]
409
+ * @param {boolean} [repeat=true]
410
+ * @param {boolean} [smooth=false]
411
+ * @return {Graphics}
412
+ * @method
413
+ * @public
414
+ */
415
+ lineBitmapStyle(bitmap_data: BitmapData, matrix?: Matrix | null, repeat?: boolean, smooth?: boolean): Graphics;
416
+ /**
417
+ * @description 線の描画で使用するグラデーションを指定します。
418
+ * Specifies a gradient to use for the stroke when drawing lines.
419
+ *
420
+ * @param {string} type
421
+ * @param {array} colors
422
+ * @param {array} alphas
423
+ * @param {array} ratios
424
+ * @param {Matrix} [matrix=null]
425
+ * @param {string} [spread_method=SpreadMethod.PAD]
426
+ * @param {string} [interpolation_method=InterpolationMethod.RGB]
427
+ * @param {number} [focal_point_ratio=0]
428
+ * @return {Graphics}
429
+ * @method
430
+ * @public
431
+ */
432
+ lineGradientStyle(type: GradientTypeImpl, colors: number[], alphas: number[], ratios: number[], matrix?: Matrix | null, spread_method?: SpreadMethodImpl, interpolation_method?: InterpolationMethodImpl, focal_point_ratio?: number): Graphics;
433
+ /**
434
+ * @description lineTo() メソッドや drawCircle() メソッドなど、
435
+ * Graphics のメソッドの後続の呼び出しに使用する線スタイルを指定します。
436
+ * Specifies a line style used for subsequent calls
437
+ * to Graphics methods such as the lineTo() method
438
+ * or the drawCircle() method.
439
+ *
440
+ * @param {number} [thickness=NaN]
441
+ * @param {number|string} [color=0]
442
+ * @param {number} [alpha=1]
443
+ * @param {string} [caps=CapsStyle.NONE]
444
+ * @param {string} [joints=JointStyle.ROUND]
445
+ * @param {number} [miter_limit=3]
446
+ * @return {Graphics}
447
+ * @method
448
+ * @public
449
+ */
450
+ lineStyle(thickness?: number, color?: string | number, alpha?: number, caps?: CapsStyleImpl, joints?: JointStyleImpl, miter_limit?: number): Graphics;
451
+ /**
452
+ * @description 現在の描画位置から (x, y) まで、現在の線のスタイルを使用して線を描画します。
453
+ * その後で、現在の描画位置は (x, y) に設定されます。
454
+ * Draws a line using the current line style from the current drawing position to (x, y);
455
+ * the current drawing position is then set to (x, y).
456
+ *
457
+ * @param {number} x
458
+ * @param {number} y
459
+ * @returns {Graphics}
460
+ * @method
461
+ * @public
462
+ */
463
+ lineTo(x: number, y: number): Graphics;
464
+ /**
465
+ * @description 現在の描画位置を (x, y) に移動します。
466
+ * Moves the current drawing position to (x, y).
467
+ *
468
+ * @param {number} x
469
+ * @param {number} y
470
+ * @returns {Graphics}
471
+ * @method
472
+ * @public
473
+ */
474
+ moveTo(x: number, y: number): Graphics;
475
+ /**
476
+ * @param {CanvasToWebGLContext} context
477
+ * @param {Float32Array} matrix
478
+ * @return {void}
479
+ * @method
480
+ * @private
481
+ */
482
+ _$clip(context: CanvasToWebGLContext, matrix: Float32Array): void;
483
+ /**
484
+ * @param {CanvasToWebGLContext} context
485
+ * @param {Float32Array} matrix
486
+ * @param {Float32Array} color_transform
487
+ * @param {string} [blend_mode=BlendMode.NORMAL]
488
+ * @param {array} [filters=null]
489
+ * @return {void}
490
+ * @method
491
+ * @private
492
+ */
493
+ _$draw(context: CanvasToWebGLContext, matrix: Float32Array, color_transform: Float32Array, blend_mode?: BlendModeImpl, filters?: FilterArrayImpl | null): void;
494
+ /**
495
+ * @param {CanvasToWebGLContext} context
496
+ * @param {Float32Array} [color_transform=null]
497
+ * @param {boolean} [is_clip=false]
498
+ * @return {void}
499
+ * @method
500
+ * @private
501
+ */
502
+ _$doDraw(context: CanvasToWebGLContext, color_transform?: Float32Array | null, is_clip?: boolean): void;
503
+ /**
504
+ * @param {CanvasRenderingContext2D} context
505
+ * @param {Float32Array} matrix
506
+ * @param {object} options
507
+ * @param {boolean} [is_clip=false]
508
+ * @return {boolean}
509
+ * @method
510
+ * @private
511
+ */
512
+ _$hit(context: CanvasRenderingContext2D, matrix: Float32Array, options: PlayerHitObjectImpl, is_clip?: boolean): boolean;
513
+ /**
514
+ * @return {object}
515
+ * @method
516
+ * @private
517
+ */
518
+ _$getBounds(): BoundsImpl;
519
+ /**
520
+ * @return {void}
521
+ * @method
522
+ * @private
523
+ */
524
+ _$restart(): void;
525
+ /**
526
+ * @param {number} [x=0]
527
+ * @param {number} [y=0]
528
+ * @return {void}
529
+ * @method
530
+ * @private
531
+ */
532
+ _$setBounds(x?: number, y?: number): void;
533
+ /**
534
+ * @param {number} x
535
+ * @param {number} y
536
+ * @return {void}
537
+ * @method
538
+ * @private
539
+ */
540
+ _$setFillBounds(x?: number, y?: number): void;
541
+ /**
542
+ * @param {number} x
543
+ * @param {number} y
544
+ * @return {void}
545
+ * @method
546
+ * @private
547
+ */
548
+ _$setLineBounds(x?: number, y?: number): void;
549
+ /**
550
+ * @param {array} data
551
+ * @method
552
+ * @private
553
+ */
554
+ _$margePath(data: any[]): void;
555
+ /**
556
+ * @return {Float32Array}
557
+ * @method
558
+ * @private
559
+ */
560
+ _$getRecodes(): Float32Array;
561
+ /**
562
+ * @param {CanvasToWebGLContext|CanvasRenderingContext2D} context
563
+ * @param {Float32Array} [color_transform=null]
564
+ * @param {boolean} [is_clip=false]
565
+ * @param {object} [options=null]
566
+ * @return {boolean}
567
+ * @method
568
+ * @private
569
+ */
570
+ _$runCommand(context: CanvasToWebGLContext | CanvasRenderingContext2D, color_transform?: Float32Array | null, is_clip?: boolean, options?: PlayerHitObjectImpl | null): boolean;
571
+ }