UNPKG

modern-canvas

Version:

A JavaScript WebGL rendering engine. only the ESM.

59 lines (58 loc) 2.68 kB
import type { Batchable2D, GlBlendMode, GlRenderer } from '../../core'; import type { Texture2D } from '../resources'; import type { CanvasBatchable } from './CanvasContext'; import type { Node } from './Node'; import type { TimelineNodeEvents, TimelineNodeProperties } from './TimelineNode'; import { CanvasContext } from './CanvasContext'; import { TimelineNode } from './TimelineNode'; export interface CanvasItemProperties extends TimelineNodeProperties { blendMode: GlBlendMode; } export interface CanvasItemEvents extends TimelineNodeEvents { draw: []; } export interface CanvasItem { on: <K extends keyof CanvasItemEvents & string>(event: K, listener: (...args: CanvasItemEvents[K]) => void) => this; once: <K extends keyof CanvasItemEvents & string>(event: K, listener: (...args: CanvasItemEvents[K]) => void) => this; off: <K extends keyof CanvasItemEvents & string>(event: K, listener: (...args: CanvasItemEvents[K]) => void) => this; emit: <K extends keyof CanvasItemEvents & string>(event: K, ...args: CanvasItemEvents[K]) => this; } export declare class CanvasItem extends TimelineNode { blendMode: GlBlendMode | undefined; visible: boolean; opacity: number; protected _parentGlobalVisible?: boolean; protected _globalVisible?: boolean; get globalVisible(): boolean; protected _parentGlobalOpacity?: number; protected _globalOpacity?: number; get globalOpacity(): number; context: CanvasContext; protected _resetContext: boolean; needsDraw: boolean; needsLayout: boolean; needsPaint: boolean; protected _drawBatchables: CanvasBatchable[]; protected _layoutBatchables: CanvasBatchable[]; protected _batchables: CanvasBatchable[]; constructor(properties?: Partial<CanvasItemProperties>, nodes?: Node[]); protected _updateProperty(key: string, value: any, oldValue: any): void; show(): void; hide(): void; isVisibleInTree(): boolean; updateRenderable(): void; requestDraw(): void; requestLayout(): void; requestPaint(): void; protected _updateGlobalVisible(): void; protected _updateGlobalOpacity(): void; protected _draw(): void; protected _transformUvs(batchable: CanvasBatchable): Float32Array | undefined; protected _redraw(): CanvasBatchable[]; protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[]; protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[]; protected _process(delta: number): void; protected _updateBatchables(): void; protected _handleViewportTexture(batchable: Batchable2D): Texture2D | undefined; protected _render(renderer: GlRenderer): void; }