import { ImageType } from "./utilities"; import { DataBuffer } from "@awayjs/graphics"; export interface IRemotable { _id: number; } /** * Remoting phases. */ export declare const enum RemotingPhase { /** * Objects are serialized. During this phase all reachable remotable objects (all objects * reachable from a root set) that are dirty are remoted. This includes all dirty object * properties except for dirty references. */ Objects = 0, /** * Object references are serialized. All objects that are referred to have already been * remoted at this point. */ References = 1 } export declare const enum MessageBits { HasMatrix = 1, HasBounds = 2, HasChildren = 4, HasColorTransform = 8, HasClipRect = 16, HasMiscellaneousProperties = 32, HasMask = 64, HasClip = 128 } export declare const enum IDMask { None = 0, Asset = 134217728 } /** * Serialization Format. All commands start with a message tag. */ export declare const enum MessageTag { EOF = 0, /** * id int32, * hasBits int32, * matrix Matrix, * colorMatrix ColorMatrix, * mask int32, * misc * blendMode int32, * visible int32 * * @type {number} */ UpdateFrame = 100, UpdateGraphics = 101, UpdateBitmapData = 102, UpdateTextContent = 103, UpdateStage = 104, UpdateNetStream = 105, RequestBitmapData = 106, UpdateCurrentMouseTarget = 107, DrawToBitmap = 200, MouseEvent = 300, KeyboardEvent = 301, FocusEvent = 302 } export declare enum FilterType { Blur = 0, DropShadow = 1, ColorMatrix = 2 } /** * Dictates how color transforms are encoded. The majority of color transforms are * either identity or only modify the alpha multiplier, so we can encode these more * efficiently. */ export declare const enum ColorTransformEncoding { /** * Identity, no need to serialize all the fields. */ Identity = 0, /** * Identity w/ AlphaMultiplier, only the alpha multiplier is serialized. */ AlphaMultiplierOnly = 1, /** * Offsets w/ AlphaMultiplier. */ AlphaMultiplierWithOffsets = 2, /** * All fields are serialized. */ All = 3 } /** * Dictates how matrices are encoded. */ export declare const enum MatrixEncoding { /** * Translation only. */ TranslationOnly = 0, /** * Scale and translation only. */ ScaleAndTranslationOnly = 1, /** * Uniform scale in the x and y direction and translation only. */ UniformScaleAndTranslationOnly = 2, /** * All fields are serialized. */ All = 3 } export declare const enum VideoPlaybackEvent { Initialized = 0, Metadata = 1, PlayStart = 2, PlayStop = 3, BufferEmpty = 4, BufferFull = 5, Pause = 6, Unpause = 7, Seeking = 8, Seeked = 9, Progress = 10, Error = 11 } export declare const enum VideoControlEvent { Init = 1, Pause = 2, Seek = 3, GetTime = 4, GetBufferLength = 5, SetSoundLevels = 6, GetBytesLoaded = 7, GetBytesTotal = 8, EnsurePlaying = 9 } export declare const enum StageScaleMode { ShowAll = 0, ExactFit = 1, NoBorder = 2, NoScale = 4 } export declare const enum StageAlignFlags { None = 0, Top = 1, Bottom = 2, Left = 4, Right = 8, TopLeft = 5, BottomLeft = 6, BottomRight = 10, TopRight = 9 } export declare var MouseEventNames: string[]; export declare var KeyboardEventNames: string[]; export declare const enum KeyboardEventFlags { CtrlKey = 1, AltKey = 2, ShiftKey = 4 } export declare const enum FocusEventType { DocumentHidden = 0, DocumentVisible = 1, WindowBlur = 2, WindowFocus = 3 } export interface DisplayParameters { stageWidth: number; stageHeight: number; pixelRatio: number; screenWidth: number; screenHeight: number; } export interface IGFXServiceObserver { displayParameters(displayParameters: DisplayParameters): any; focusEvent(data: any): any; keyboardEvent(data: any): any; mouseEvent(data: any): any; videoEvent(id: number, eventType: VideoPlaybackEvent, data: any): any; } export interface IGFXService { addObserver(observer: IGFXServiceObserver): any; removeObserver(observer: IGFXServiceObserver): any; update(updates: DataBuffer, assets: Array): void; updateAndGet(updates: DataBuffer, assets: Array): any; frame(): void; videoControl(id: number, eventType: VideoControlEvent, data: any): any; registerFont(syncId: number, data: Uint8Array): Promise; registerImage(syncId: number, symbolId: number, imageType: ImageType, data: Uint8Array, alphaData: Uint8Array): Promise; fscommand(command: string, args: string): void; } /** * Messaging peer for sending data synchronously and asynchronously. Currently * used by GFX and Player iframes. */ export interface ITransportPeer { onAsyncMessage: (msg: any) => void; onSyncMessage: (msg: any) => any; postAsyncMessage(msg: any, transfers?: any[]): void; sendSyncMessage(msg: any, transfers?: any[]): any; } /** * Implementation of ITransportPeer that uses standard DOM postMessage and * events to exchange data between messaging peers. */ export declare class WindowTransportPeer implements ITransportPeer { window: Window; target: Window; set onAsyncMessage(callback: (msg: any) => void); set onSyncMessage(callback: (msg: any) => any); constructor(window: Window, target: Window); postAsyncMessage(msg: any, transfers?: any[]): void; sendSyncMessage(msg: any, transfers?: any[]): any; } /** * Implementation of ITransportPeer that uses ShumwayCom API to exchange data * between messaging peers. */ export declare class ShumwayComTransportPeer implements ITransportPeer { set onAsyncMessage(callback: (msg: any) => void); set onSyncMessage(callback: (msg: any) => any); postAsyncMessage(msg: any, transfers?: any[]): void; sendSyncMessage(msg: any, transfers?: any[]): any; }