From 627dc0c3bda3a1ea17f2ad867bb3597e68897f29 Mon Sep 17 00:00:00 2001 From: Yury Abaitov Date: Sat, 28 Oct 2017 02:52:59 +0300 Subject: [PATCH] easeljs stageGL support (#21025) * stageGL support * fix * fixes --- types/easeljs/index.d.ts | 73 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/types/easeljs/index.d.ts b/types/easeljs/index.d.ts index d47f631728..462c9f04cf 100644 --- a/types/easeljs/index.d.ts +++ b/types/easeljs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for EaselJS 0.8.0 +// Type definitions for EaselJS 1.0.0 // Project: http://www.createjs.com/#!/EaselJS // Definitions by: Pedro Ferreira , Chris Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -53,6 +53,22 @@ declare namespace createjs { clone(): Bitmap; } + export class BitmapCache { + constructor(); + + // properties + cacheID: number; + + // methods + static getFilterBounds(target: DisplayObject, output?: Rectangle): Rectangle; + toString(): string; + define(target: DisplayObject, x: number, y: number, width: number, height: number, scale?: number): void; + update(compositeOperation?: string): void; + release(): void; + getCacheDataURL(): string; + draw(ctx: CanvasRenderingContext2D): boolean; + } + export class ScaleBitmap extends DisplayObject { constructor(imageOrUrl: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | Object | string, scale9Grid: Rectangle); @@ -211,6 +227,7 @@ declare namespace createjs { // properties alpha: number; + bitmapCache: BitmapCache; cacheCanvas: HTMLCanvasElement | Object; cacheID: number; compositeOperation: string; @@ -924,6 +941,60 @@ declare namespace createjs { } + interface IStageGLOptions { + preserveBuffer?: boolean; + antialias?: boolean; + transparent?: boolean; + premultiply?: boolean; + autoPurge?: number; + } + + export class StageGL extends Stage { + constructor(canvas: HTMLCanvasElement | string | Object, options?: IStageGLOptions); + + // properties + static VERTEX_PROPERTY_COUNT: number; + static INDICIES_PER_CARD: number; + static DEFAULT_MAX_BATCH_SIZE: number; + static WEBGL_MAX_INDEX_NUM: number; + static UV_RECT: number; + static COVER_VERT: Float32Array; + static COVER_UV: Float32Array; + static COVER_UV_FLIP: Float32Array; + static REGULAR_VARYING_HEADER: string; + static REGULAR_VERTEX_HEADER: string; + static REGULAR_FRAGMENT_HEADER: string; + static REGULAR_VERTEX_BODY: string; + static REGULAR_FRAGMENT_BODY: string; + static REGULAR_FRAG_COLOR_NORMAL: string; + static REGULAR_FRAG_COLOR_PREMULTIPLY: string; + static PARTICLE_VERTEX_BODY: string; + static PARTICLE_FRAGMENT_BODY: string; + static COVER_VARYING_HEADER: string; + static COVER_VERTEX_HEADER: string; + static COVER_FRAGMENT_HEADER: string; + static COVER_VERTEX_BODY: string; + static COVER_FRAGMENT_BODY: string; + isWebGL: boolean; + autoPurge: number; + vocalDebug: boolean; + + // methods + static buildUVRects(spritesheet: SpriteSheet, target?: number, onlyTarget?: boolean): Object; + static isWebGLActive(ctx: CanvasRenderingContext2D): boolean; + cacheDraw(target: DisplayObject, filters: Filter[], manager: BitmapCache): boolean; + getBaseTexture(w?: number, h?: number): WebGLTexture | null; + getFilterShader(filter: Filter | Object): WebGLProgram; + getRenderBufferTexture (w: number, h: number): WebGLTexture; + getTargetRenderTexture (target: DisplayObject, w: number, h: number): Object; + protectTextureSlot(id: number, lock?: boolean): void; + purgeTextures(count?: number): void; + releaseTexture(item: DisplayObject | WebGLTexture | HTMLImageElement | HTMLCanvasElement): void; + setTextureParams(gl: WebGLRenderingContext, isPOT?: boolean): void; + updateSimultaneousTextureCount(count?: number): void; + updateViewport(width: number, height: number): void; + } + export class Text extends DisplayObject { constructor(text?: string, font?: string, color?: string);