forked from pixijs-userland/pixi-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pixi.js.d.ts
3407 lines (2773 loc) · 118 KB
/
pixi.js.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for Pixi.js 4.5
// Project: https://github.com/pixijs/pixi.js/tree/dev
// Definitions by: clark-stevenson <https://github.com/pixijs/pixi-typescript>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace PIXI {
// from CONST
export const VERSION: typeof CONST.VERSION;
export const PI_2: typeof CONST.PI_2;
export const RAD_TO_DEG: typeof CONST.RAD_TO_DEG;
export const DEG_TO_RAD: typeof CONST.DEG_TO_RAD;
export const RENDERER_TYPE: typeof CONST.RENDERER_TYPE;
export const BLEND_MODES: typeof CONST.BLEND_MODES;
export const DRAW_MODES: typeof CONST.DRAW_MODES;
export const SCALE_MODES: typeof CONST.SCALE_MODES;
export const WRAP_MODES: typeof CONST.WRAP_MODES;
export const TRANSFORM_MODE: typeof CONST.TRANSFORM_MODE;
export const PRECISION: typeof CONST.PRECISION;
export const GC_MODES: typeof CONST.GC_MODES;
export const SHAPES: typeof CONST.SHAPES;
export const TEXT_GRADIENT: typeof CONST.TEXT_GRADIENT;
export const UPDATE_PRIORITY: typeof CONST.UPDATE_PRIORITY;
export function autoDetectRenderer(width: number, height: number, options?: PIXI.RendererOptions, forceCanvas?: boolean): PIXI.WebGLRenderer | PIXI.CanvasRenderer;
export function autoDetectRenderer(options?: PIXI.RendererOptions): PIXI.WebGLRenderer | PIXI.CanvasRenderer;
export const loader: PIXI.loaders.Loader;
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////SETTINGS///////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
export namespace settings {
export let TARGET_FPMS: number;
export let MIPMAP_TEXTURES: boolean;
export let RESOLUTION: number;
export let FILTER_RESOLUTION: number;
export let SPRITE_MAX_TEXTURES: number;
export let SPRITE_BATCH_SIZE: number;
export let RETINA_PREFIX: RegExp;
export const RENDER_OPTIONS: {
view: HTMLCanvasElement | null,
antialias: boolean,
forceFXAA: boolean,
autoResize: boolean,
transparent: boolean,
backgroundColor: number,
clearBeforeRender: boolean,
preserveDrawingBuffer: boolean,
roundPixels: boolean
width: number,
height: number,
legacy: boolean,
};
export let TRANSFORM_MODE: number;
export let GC_MODE: number;
export let GC_MAX_IDLE: number;
export let GC_MAX_CHECK_COUNT: number;
export let WRAP_MODE: number;
export let SCALE_MODE: number;
export let PRECISION_VERTEX: string;
export let PRECISION_FRAGMENT: string;
export let PRECISION: string;
export let UPLOADS_PER_FRAME: number;
export let CAN_UPLOAD_SAME_BUFFER: boolean;
}
//////////////////////////////////////////////////////////////////////////////
/////////////////////////////ACCESSIBILITY////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
export namespace accessibility {
// accessibility
export class AccessibilityManager {
constructor(renderer: CanvasRenderer | WebGLRenderer);
public activate(): void;
public deactivate(): void;
protected div: HTMLElement;
protected pool: HTMLElement[];
protected renderId: number;
debug: boolean;
renderer: SystemRenderer;
protected children: AccessibleTarget[];
protected isActive: boolean;
protected updateAccessibleObjects(displayObject: DisplayObject): void;
protected update(): void;
protected capHitArea(hitArea: HitArea): void;
protected addChild(displayObject: DisplayObject): void;
protected _onClick(e: interaction.InteractionEvent): void;
protected _onFocus(e: interaction.InteractionEvent): void;
protected _onFocusOut(e: interaction.InteractionEvent): void;
protected _onKeyDown(e: interaction.InteractionEvent): void;
protected _onMouseMove(): void;
destroy(): void;
}
export interface AccessibleTarget {
accessible: boolean;
accessibleTitle: string | null;
accessibleHint: string | null;
tabIndex: number;
}
}
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////CORE//////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// const
export namespace CONST {
export const VERSION: string;
export const PI_2: number;
export const RAD_TO_DEG: number;
export const DEG_TO_RAD: number;
export const TARGET_FPMS: number;
export const RENDERER_TYPE: {
UNKNOWN: number;
WEBGL: number;
CANVAS: number;
};
export const BLEND_MODES: {
NORMAL: number;
ADD: number;
MULTIPLY: number;
SCREEN: number;
OVERLAY: number;
DARKEN: number;
LIGHTEN: number;
COLOR_DODGE: number;
COLOR_BURN: number;
HARD_LIGHT: number;
SOFT_LIGHT: number;
DIFFERENCE: number;
EXCLUSION: number;
HUE: number;
SATURATION: number;
COLOR: number;
LUMINOSITY: number;
NORMAL_NPM: number;
ADD_NPM: number;
SCREEN_NPM: number;
};
export const DRAW_MODES: {
POINTS: number;
LINES: number;
LINE_LOOP: number;
LINE_STRIP: number;
TRIANGLES: number;
TRIANGLE_STRIP: number;
TRIANGLE_FAN: number;
};
export const SCALE_MODES: {
LINEAR: number,
NEAREST: number
};
export const GC_MODES: {
AUTO: number;
MANUAL: number;
};
export const WRAP_MODES: {
CLAMP: number;
MIRRORED_REPEAT: number;
REPEAT: number;
};
export const TRANSFORM_MODE: {
DEFAULT: number;
DYNAMIC: number;
STATIC: number;
};
export const URL_FILE_EXTENSION: RegExp | string;
export const DATA_URI: RegExp | string;
export const SVG_SIZE: RegExp | string;
export const SHAPES: {
POLY: number;
RECT: number;
CIRC: number;
ELIP: number;
RREC: number;
};
export const PRECISION: {
LOW: string;
MEDIUM: string;
HIGH: string;
};
export const TEXT_GRADIENT: {
LINEAR_VERTICAL: number;
LINEAR_HORIZONTAL: number;
};
export const UPDATE_PRIORITY: {
INTERACTION: number;
HIGH: number;
NORMAL: number;
LOW: number;
UTILITY: number;
};
}
// display
export interface ApplicationOptions extends RendererOptions {
view?: HTMLCanvasElement;
transparent?: boolean;
autoResize?: boolean;
antialias?: boolean;
resolution?: number;
clearBeforeRender?: boolean;
backgroundColor?: number;
roundPixels?: boolean;
context?: WebGLRenderingContext;
preserveDrawingBuffer?: boolean;
legacy?: boolean;
width?: number;
height?: number;
forceCanvas?: boolean;
sharedTicker?: boolean;
sharedLoader?: boolean;
}
export class Application {
constructor(options?: ApplicationOptions)
constructor(width?: number, height?: number, options?: ApplicationOptions, noWebGL?: boolean, sharedTicker?: boolean, sharedLoader?: boolean);
private _ticker: ticker.Ticker;
renderer: PIXI.WebGLRenderer | PIXI.CanvasRenderer;
stage: Container;
ticker: ticker.Ticker;
readonly screen: Rectangle;
stop(): void;
start(): void;
render(): void;
destroy(removeView?: boolean): void;
readonly view: HTMLCanvasElement;
}
export interface DestroyOptions {
children?: boolean;
texture?: boolean;
baseTexture?: boolean;
}
export class Bounds {
minX: number;
minY: number;
maxX: number;
maxY: number;
rect: Rectangle;
isEmpty(): boolean;
clear(): void;
getRectangle(rect?: Rectangle): Rectangle;
addPoint(point: Point): void;
addQuad(vertices: number[]): Bounds | undefined;
addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void;
addVertices(transform: Transform, vertices: number[], beginOffset: number, endOffset: number): void;
addBounds(bounds: Bounds): void;
addBoundsMask(bounds: Bounds, mask: Bounds): void;
addBoundsArea(bounds: Bounds, area: Rectangle): void;
}
export class Container extends DisplayObject {
// begin extras.getChildByName
getChildByName(name: string): DisplayObject;
// end extras.getChildByName
children: DisplayObject[];
width: number;
height: number;
protected onChildrenChange: (...args: any[]) => void;
addChild<T extends DisplayObject>(child: T, ...additionalChildren: DisplayObject[]): T;
addChildAt<T extends DisplayObject>(child: T, index: number): T;
swapChildren(child: DisplayObject, child2: DisplayObject): void;
getChildIndex(child: DisplayObject): number;
setChildIndex(child: DisplayObject, index: number): void;
getChildAt(index: number): DisplayObject;
removeChild(child: DisplayObject): DisplayObject;
removeChildAt(index: number): DisplayObject;
removeChildren(beginIndex?: number, endIndex?: number): DisplayObject[];
updateTransform(): void;
calculateBounds(): void;
protected _calculateBounds(): void;
protected containerUpdateTransform(): void;
renderWebGL(renderer: WebGLRenderer): void;
renderAdvancedWebGL(renderer: WebGLRenderer): void;
protected _renderWebGL(renderer: WebGLRenderer): void;
protected _renderCanvas(renderer: CanvasRenderer): void;
renderCanvas(renderer: CanvasRenderer): void;
destroy(options?: DestroyOptions | boolean): void;
once(event: "added" | "removed", fn: (displayObject: DisplayObject) => void, context?: any): this;
//tslint:disable-next-line:ban-types forbidden-types
once(event: string, fn: Function, context?: any): this;
on(event: "added" | "removed", fn: (displayObject: DisplayObject) => void, context?: any): this;
//tslint:disable-next-line:ban-types forbidden-types
on(event: string, fn: Function, context?: any): this;
//tslint:disable-next-line:ban-types forbidden-types
off(event: "added" | "removed" | string, fn?: Function, context?: any): this;
}
export class DisplayObject extends utils.EventEmitter implements interaction.InteractiveTarget, accessibility.AccessibleTarget {
// begin extras.cacheAsBitmap
protected _cacheAsBitmap: boolean;
protected _cacheData: boolean;
cacheAsBitmap: boolean;
protected _renderCachedWebGL(renderer: WebGLRenderer): void;
protected _initCachedDisplayObject(renderer: WebGLRenderer): void;
protected _renderCachedCanvas(renderer: CanvasRenderer): void;
protected _initCachedDisplayObjectCanvas(renderer: CanvasRenderer): void;
protected _calculateCachedBounds(): Rectangle;
protected _getCachedLocalBounds(): Rectangle;
protected _destroyCachedDisplayObject(): void;
protected _cacheAsBitmapDestroy(options: boolean | any): void;
// end extras.cacheAsBitmap
// begin extras.getChildByName
name: string | null;
// end extras.getChildByName
// begin extras.getGlobalPosition
getGlobalPosition(point?: Point, skipUpdate?: boolean): Point;
// end extras.getGlobalPosition
// begin accessible target
accessible: boolean;
accessibleTitle: string | null;
accessibleHint: string | null;
tabIndex: number;
// end accessible target
// begin interactive target
interactive: boolean;
interactiveChildren: boolean;
hitArea: PIXI.Rectangle | PIXI.Circle | PIXI.Ellipse | PIXI.Polygon | PIXI.RoundedRectangle;
buttonMode: boolean;
cursor: string;
trackedPointers(): { [key: number]: interaction.InteractionTrackingData; };
// depricated
defaultCursor: string;
// end interactive target
transform: TransformBase;
alpha: number;
visible: boolean;
renderable: boolean;
parent: Container;
worldAlpha: number;
filterArea: Rectangle;
protected _filters: Filter[] | null;
protected _enabledFilters: Filter[] | null;
protected _bounds: Bounds;
protected _boundsID: number;
protected _lastBoundsID: number;
protected _boundsRect: Rectangle;
protected _localBoundsRect: Rectangle;
protected _mask: PIXI.Graphics | PIXI.Sprite;
protected readonly _destroyed: boolean;
x: number;
y: number;
worldTransform: Matrix;
localTransform: Matrix;
position: Point | ObservablePoint;
scale: Point | ObservablePoint;
pivot: Point | ObservablePoint;
skew: ObservablePoint;
rotation: number;
worldVisible: boolean;
mask: PIXI.Graphics | PIXI.Sprite;
filters: Filter[] | null;
updateTransform(): void;
protected displayObjectUpdateTransform(): void;
protected _recursivePostUpdateTransform(): void;
getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;
getLocalBounds(rect?: Rectangle): Rectangle;
//creates and returns a new point
toGlobal(position: PointLike): Point;
//modifies the x and y of the passed point and returns it
toGlobal<T extends PointLike>(position: PointLike, point?: T, skipUpdate?: boolean): T;
//creates and returns a new point
toLocal(position: PointLike, from?: DisplayObject): Point;
//modifies the x and y of the passed point and returns it
toLocal<T extends PointLike>(position: PointLike, from?: DisplayObject, point?: T, skipUpdate?: boolean): T;
renderWebGL(renderer: WebGLRenderer): void;
renderCanvas(renderer: CanvasRenderer): void;
setParent(container: Container): Container;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, pivotX?: number, pivotY?: number): DisplayObject;
destroy(): void;
on(event: interaction.InteractionEventTypes, fn: (event: interaction.InteractionEvent) => void, context?: any): this;
once(event: interaction.InteractionEventTypes, fn: (event: interaction.InteractionEvent) => void, context?: any): this;
removeListener(event: interaction.InteractionEventTypes, fn?: (event: interaction.InteractionEvent) => void, context?: any): this;
removeAllListeners(event: interaction.InteractionEventTypes): this;
off(event: interaction.InteractionEventTypes, fn?: (event: interaction.InteractionEvent) => void, context?: any): this;
addListener(event: interaction.InteractionEventTypes, fn: (event: interaction.InteractionEvent) => void, context?: any): this;
}
export class TransformBase {
static IDENTITY: TransformBase;
worldTransform: Matrix;
localTransform: Matrix;
protected _worldID: number;
updateLocalTransform(): void;
updateTransform(parentTransform: TransformBase): void;
updateWorldTransform(parentTransform: TransformBase): void;
}
export class TransformStatic extends TransformBase {
position: ObservablePoint;
scale: ObservablePoint;
pivot: ObservablePoint;
skew: ObservablePoint;
protected _rotation: number;
protected _sr?: number;
protected _cr?: number;
protected _cy?: number;
protected _sy?: number;
protected _nsx?: number;
protected _cx?: number;
protected _currentLocalID: number;
protected onChange(): void;
updateSkew(): void;
updateLocalTransform(): void;
updateTransform(parentTransform: TransformBase): void;
setFromMatrix(matrix: Matrix): void;
rotation: number;
}
export class Transform extends TransformBase {
constructor();
position: Point;
scale: Point;
skew: ObservablePoint;
pivot: Point;
protected _rotation: number;
protected _sr?: number;
protected _cr?: number;
protected _cy?: number;
protected _sy?: number;
protected _nsx?: number;
protected _cx?: number;
updateSkew(): void;
setFromMatrix(matrix: Matrix): void;
rotation: number;
}
// graphics
export class GraphicsData {
constructor(lineWidth: number, lineColor: number, lineAlpha: number, fillColor: number, fillAlpha: number, fill: boolean, nativeLines: boolean, shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle | any);
lineWidth: number;
nativeLines: boolean;
lineColor: number;
lineAlpha: number;
protected _lineTint: number;
fillColor: number;
fillAlpha: number;
protected _fillTint: number;
fill: boolean;
protected holes: Circle[] | Rectangle[] | Ellipse[] | Polygon[] | RoundedRectangle[] | any[];
shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle | any;
type?: number;
clone(): GraphicsData;
addHole(shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle | any): void;
destroy(options?: DestroyOptions | boolean): void;
}
export class Graphics extends Container {
constructor(nativeLines?: boolean);
fillAlpha: number;
lineWidth: number;
nativeLines: boolean;
lineColor: number;
protected graphicsData: GraphicsData[];
tint: number;
protected _prevTint: number;
blendMode: number;
currentPath: GraphicsData;
protected _webGL: any;
isMask: boolean;
boundsPadding: number;
protected _localBounds: Bounds;
dirty: number;
fastRectDirty: number;
clearDirty: number;
boundsDirty: number;
protected cachedSpriteDirty: boolean;
protected _spriteRect: Rectangle;
protected _fastRect: boolean;
static _SPRITE_TEXTURE: Texture;
clone(): Graphics;
lineStyle(lineWidth?: number, color?: number, alpha?: number): Graphics;
moveTo(x: number, y: number): Graphics;
lineTo(x: number, y: number): Graphics;
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): Graphics;
bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): Graphics;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics;
arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): Graphics;
beginFill(color: number, alpha?: number): Graphics;
endFill(): Graphics;
drawRect(x: number, y: number, width: number, height: number): Graphics;
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): Graphics;
drawCircle(x: number, y: number, radius: number): Graphics;
drawEllipse(x: number, y: number, width: number, height: number): Graphics;
drawPolygon(path: number[] | Point[]): Graphics;
clear(): Graphics;
isFastRect(): boolean;
protected _renderCanvas(renderer: CanvasRenderer): void;
protected _calculateBounds(): Rectangle;
protected _renderSpriteRect(renderer: PIXI.SystemRenderer): void;
containsPoint(point: Point): boolean;
updateLocalBounds(): void;
drawShape(shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle | any): GraphicsData;
generateCanvasTexture(scaleMode?: number, resolution?: number): Texture;
protected closePath(): Graphics;
protected addHole(): Graphics;
destroy(options?: DestroyOptions | boolean): void;
}
export class CanvasGraphicsRenderer {
constructor(renderer: SystemRenderer);
render(graphics: Graphics): void;
protected updateGraphicsTint(graphics: Graphics): void;
protected renderPolygon(points: Point[], close: boolean, context: CanvasRenderingContext2D): void;
destroy(): void;
}
export class GraphicsRenderer extends ObjectRenderer {
constructor(renderer: PIXI.CanvasRenderer);
protected graphicsDataPool: GraphicsData[];
protected primitiveShader: PrimitiveShader;
gl: WebGLRenderingContext;
CONTEXT_UID: number;
destroy(): void;
render(graphics: Graphics): void;
protected updateGraphics(graphics: PIXI.Graphics): void;
getWebGLData(webGL: WebGLRenderingContext, type: number, nativeLines: number): WebGLGraphicsData;
}
export class WebGLGraphicsData {
constructor(gl: WebGLRenderingContext, shader: glCore.GLShader, attribsState: glCore.AttribState);
gl: WebGLRenderingContext;
color: number[];
points: Point[];
indices: number[];
buffer: WebGLBuffer;
indexBuffer: WebGLBuffer;
dirty: boolean;
glPoints: number[];
glIndices: number[];
shader: glCore.GLShader;
vao: glCore.VertexArrayObject;
nativeLines: boolean;
reset(): void;
upload(): void;
destroy(): void;
}
export class PrimitiveShader extends glCore.GLShader { }
// math
export namespace GroupD8 {
export const E: number;
export const SE: number;
export const S: number;
export const SW: number;
export const W: number;
export const NW: number;
export const N: number;
export const NE: number;
export const MIRROR_HORIZONTAL: number;
export const MIRROR_VERTICAL: number;
export function uX(ind: number): number;
export function uY(ind: number): number;
export function vX(ind: number): number;
export function vY(ind: number): number;
export function inv(rotation: number): number;
export function add(rotationSecond: number, rotationFirst: number): number;
export function sub(rotationSecond: number, rotationFirst: number): number;
export function rotate180(rotation: number): number;
export function isSwapWidthHeight(rotation: number): boolean;
export function byDirection(dx: number, dy: number): number;
export function matrixAppendRotationInv(matrix: Matrix, rotation: number, tx: number, ty: number): void;
}
export class Matrix {
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
a: number;
b: number;
c: number;
d: number;
tx: number;
ty: number;
fromArray(array: number[]): void;
set(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
toArray(transpose?: boolean, out?: number[]): number[];
apply(pos: Point, newPos?: Point): Point;
applyInverse(pos: Point, newPos?: Point): Point;
translate(x: number, y: number): Matrix;
scale(x: number, y: number): Matrix;
rotate(angle: number): Matrix;
append(matrix: Matrix): Matrix;
setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number): PIXI.Matrix;
prepend(matrix: Matrix): Matrix;
invert(): Matrix;
identity(): Matrix;
decompose(transform: TransformBase): TransformBase;
clone(): Matrix;
copy(matrix: Matrix): Matrix;
static IDENTITY: Matrix;
static TEMP_MATRIX: Matrix;
}
class PointLike {
x: number;
y: number;
set(x?: number, y?: number): void;
copy(point: PointLike): void;
}
export class ObservablePoint extends PointLike {
constructor(cb: () => any, scope?: any, x?: number, y?: number);
cb: () => any;
scope: any;
}
export class Point extends PointLike {
constructor(x?: number, y?: number);
clone(): Point;
equals(p: PointLike): boolean;
}
export interface HitArea {
contains(x: number, y: number): boolean;
}
export class Circle {
constructor(x?: number, y?: number, radius?: number);
x: number;
y: number;
radius: number;
type: number;
clone(): Circle;
contains(x: number, y: number): boolean;
getBounds(): Rectangle;
}
export class Ellipse {
constructor(x?: number, y?: number, width?: number, height?: number);
x: number;
y: number;
width: number;
height: number;
type: number;
clone(): Ellipse;
contains(x: number, y: number): boolean;
getBounds(): Rectangle;
}
export class Polygon {
constructor(points: Point[] | number[]);
// Note - Rest Params cannot be combined with |
//tslint:disable-next-line:unified-signatures
constructor(...points: Point[]);
//tslint:disable-next-line:unified-signatures
constructor(...points: number[]);
closed: boolean;
points: number[];
type: number;
clone(): Polygon;
contains(x: number, y: number): boolean;
close(): void;
}
export class Rectangle {
constructor(x?: number, y?: number, width?: number, height?: number);
x: number;
y: number;
width: number;
height: number;
type: number;
left: number;
right: number;
top: number;
bottom: number;
static EMPTY: Rectangle;
clone(): Rectangle;
copy(rectangle: Rectangle): Rectangle;
contains(x: number, y: number): boolean;
pad(paddingX: number, paddingY: number): void;
fit(rectangle: Rectangle): void;
enlarge(rectangle: Rectangle): void;
}
export class RoundedRectangle {
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
x: number;
y: number;
width: number;
height: number;
radius: number;
type: number;
clone(): RoundedRectangle;
contains(x: number, y: number): boolean;
}
// renderers
export interface RendererOptions {
view?: HTMLCanvasElement;
transparent?: boolean;
autoResize?: boolean;
antialias?: boolean;
resolution?: number;
clearBeforeRender?: boolean;
backgroundColor?: number;
roundPixels?: boolean;
context?: WebGLRenderingContext;
width?: number;
height?: number;
forceCanvas?: boolean;
}
export class SystemRenderer extends utils.EventEmitter {
constructor(system: string, options?: RendererOptions);
constructor(system: string, screenWidth?: number, screenHeight?: number, options?: RendererOptions);
type: number;
options: RendererOptions;
screen: Rectangle;
readonly width: number;
readonly height: number;
view: HTMLCanvasElement;
resolution: number;
transparent: boolean;
autoResize: boolean;
blendModes: any; // todo?
preserveDrawingBuffer: boolean;
clearBeforeRender: boolean;
roundPixels: boolean;
protected _backgroundColor: number;
protected _backgroundColorRgba: number[];
protected _backgroundColorString: string;
protected _tempDisplayObjectParent: Container;
protected _lastObjectRendered: DisplayObject;
resize(screenWidth: number, screenHeight: number): void;
generateTexture(displayObject: DisplayObject, scaleMode?: number, resolution?: number): RenderTexture;
render(...args: any[]): void;
destroy(removeView?: boolean): void;
}
export class CanvasRenderer extends SystemRenderer {
// plugintarget mixin start
static __plugins: any;
//tslint:disable-next-line:ban-types forbidden-types
static registerPlugin(pluginName: string, ctor: Function): void;
plugins: any;
initPlugins(): void;
destroyPlugins(): void;
// plugintarget mixin end
// from InteractionManager
interaction?: interaction.InteractionManager;
constructor(options?: RendererOptions);
constructor(screenWidth?: number, screenHeight?: number, options?: RendererOptions);
rootContext: CanvasRenderingContext2D;
rootResolution?: number;
refresh: boolean;
maskManager: CanvasMaskManager;
smoothProperty: string;
extract: extract.CanvasExtract;
context: CanvasRenderingContext2D | null;
render(displayObject: PIXI.DisplayObject, renderTexture?: PIXI.RenderTexture, clear?: boolean, transform?: PIXI.Transform, skipUpdateTransform?: boolean): void
setBlendMode(blendMode: number): void;
destroy(removeView?: boolean): void;
clear(clearColor?: string): void;
on(event: "prerender" | "postrender", fn: () => void, context?: any): this;
once(event: "prerender" | "postrender", fn: () => void, context?: any): this;
removeListener(event: "prerender" | "postrender", fn?: () => void, context?: any): this;
removeAllListeners(event: "prerender" | "postrender"): this;
off(event: "prerender" | "postrender", fn?: () => void, context?: any): this;
addListener(event: "prerender" | "postrender", fn: () => void, context?: any): this;
}
export class CanvasMaskManager {
constructor(renderer: CanvasRenderer);
pushMask(maskData: any): void;
protected renderGraphicsShape(graphics: Graphics): void;
popMask(renderer: WebGLRenderer | CanvasRenderer): void;
destroy(): void;
}
export class CanvasRenderTarget {
constructor(width: number, height: number, resolution: number);
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
resolution: number;
width: number;
height: number;
clear(): void;
resize(width: number, height: number): void;
destroy(): void;
}
export interface WebGLRendererOptions {
view?: HTMLCanvasElement;
transparent?: boolean;
autoResize?: boolean;
antialias?: boolean;
forceFXAA?: boolean;
resolution?: number;
clearBeforeRender?: boolean;
backgroundColor?: number;
preserveDrawingBuffer?: boolean;
roundPixels?: boolean;
legacy?: boolean;
width?: number;
height?: number;
}
export class WebGLRenderer extends SystemRenderer {
// plugintarget mixin start
static __plugins: any;
//tslint:disable-next-line:ban-types forbidden-types
static registerPlugin(pluginName: string, ctor: Function): void;
plugins: any;
initPlugins(): void;
destroyPlugins(): void;
// plugintarget mixin end
// from InteractionManager
interaction: interaction.InteractionManager;
constructor(options?: WebGLRendererOptions);
constructor(screenWidth?: number, screenHeight?: number, options?: WebGLRendererOptions);
protected _contextOptions: {
alpha: boolean;
antiAlias?: boolean;
premultipliedAlpha: boolean;
stencil: boolean;
preseveDrawingBuffer?: boolean;
};
protected _backgroundColorRgba: number[];
maskManager: MaskManager;
stencilManager?: StencilManager;
emptyRenderer: ObjectRenderer;
currentRenderer: ObjectRenderer;
gl: WebGLRenderingContext;
CONTEXT_UID: number;
state?: WebGLState;
renderingToScreen: boolean;
boundTextures: Texture[];
filterManager: FilterManager;
textureManager?: TextureManager;
textureGC?: TextureGarbageCollector;
extract: extract.WebGLExtract;
protected drawModes: any;
protected _activeShader: Shader;
_activeRenderTarget: RenderTarget;
protected _initContext(): void;
render(displayObject: PIXI.DisplayObject, renderTexture?: PIXI.RenderTexture, clear?: boolean, transform?: PIXI.Transform, skipUpdateTransform?: boolean): void
setObjectRenderer(objectRenderer: ObjectRenderer): void;
flush(): void;
setBlendMode(blendMode: number): void;
clear(clearColor?: number): void;
setTransform(matrix: Matrix): void;
clearRenderTexture(renderTexture: RenderTexture, clearColor?: number): WebGLRenderer;
bindRenderTexture(renderTexture: RenderTexture, transform: Transform): WebGLRenderer;
bindRenderTarget(renderTarget: RenderTarget): WebGLRenderer;
bindShader(shader: Shader, autoProject?: boolean): WebGLRenderer;
bindTexture(texture: Texture | BaseTexture, location?: number, forceLocation?: boolean): number;
unbindTexture(texture: Texture | BaseTexture): WebGLRenderer | undefined;
createVao(): glCore.VertexArrayObject;
bindVao(vao: glCore.VertexArrayObject): WebGLRenderer;
reset(): WebGLRenderer;
handleContextLost: (event: WebGLContextEvent) => void;
handleContextRestored: () => void;
destroy(removeView?: boolean): void;
on(event: "prerender" | "postrender", fn: () => void, context?: any): this;
on(event: "context", fn: (gl: WebGLRenderingContext) => void, context?: any): this;
once(event: "prerender" | "postrender", fn: () => void, context?: any): this;
once(event: "context", fn: (gl: WebGLRenderingContext) => void, context?: any): this;
removeListener(event: "prerender" | "postrender", fn?: () => void, context?: any): this;
removeListener(event: "context", fn?: (gl: WebGLRenderingContext) => void, context?: any): this;
removeAllListeners(event: "prerender" | "postrender" | "context"): this;
off(event: "prerender" | "postrender", fn?: () => void, context?: any): this;
off(event: "context", fn?: (gl: WebGLRenderingContext) => void, context?: any): this;
addListener(event: "prerender" | "postrender", fn: () => void, context?: any): this;
addListener(event: "context", fn: (gl: WebGLRenderingContext) => void, context?: any): this;
}
export class WebGLState {
constructor(gl: WebGLRenderingContext);
activeState: number[];
defaultState: number[];