import { Property } from "../util/property"; export interface TextureLayerData { name?: string; in_limbo?: boolean; offset?: ArrayVector2; scale?: ArrayVector2; width?: number; height?: number; opacity?: number; visible?: boolean; blend_mode?: LayerBlendMode; image_data?: ImageData; data_url?: string; } export type LayerBlendMode = 'default' | 'set_opacity' | 'color' | 'multiply' | 'add' | 'darken' | 'lighten' | 'screen' | 'overlay' | 'difference' | 'alpha_mask'; /** * Abstract parent class for texture layers and layer groups. In the future can be expanded for things like text or fx layers */ export declare abstract class TextureLayerItem { texture: Texture; name: string; uuid: UUID; parent_uuid: string | UUID; multi_selected: boolean; visible: boolean; type: string; menu?: Menu; constructor(data: TextureLayerData, texture?: Texture, uuid?: UUID); get selected(): boolean; get parent(): TextureLayerGroup | null; set parent(parent: TextureLayerGroup); getDepth(): number; extend(data: any): void; getSaveCopy(arg: any): any; getUndoCopy(arg: any): any; /** * Selects the layer */ select(multi_select?: boolean): void; clickSelect(event: MouseEvent): void; showContextMenu(event: MouseEvent): void; /** * Add the layer to the associated texture above the previously selected layer, select this layer, and scroll the layer panel list to it */ addForEditing(): this; /** * Scroll the layer panel list to */ scrollTo(): this; /** * Remove the layer * @param undo Create an undo point and update the texture */ remove(undo?: boolean): void; /** * Open the properties dialog */ propertiesDialog(): void; /** * Util function to update the order of layers of a texture to support the hierarchy. * Returns a new array with the result */ static solveLayerOrder(list: TextureLayerItem[]): TextureLayerItem[]; static types: Record; static registerType(id: string, constructor: any): void; static previous_selected: TextureLayerItem | null; } /** * Texture layers always belong to a texture and represent the layers of the texture. Each layer has its own HTML canvas and canvas context */ export declare class TextureLayer extends TextureLayerItem { canvas: HTMLCanvasElement; ctx: CanvasRenderingContext2D; in_limbo: boolean; img: HTMLImageElement; menu?: Menu; /** * Layer offset from the top left corner of the texture to the top left corner of the layer */ offset: ArrayVector2; /** * Layer scale. This is only used by the layer transform tool and should be applied and reset to 1x1 before doing further changes */ scale: ArrayVector2; opacity: number; blend_mode: LayerBlendMode; type: string; static properties: Record>; constructor(data: TextureLayerData, texture?: Texture, uuid?: UUID); get width(): number; get height(): number; get scaled_width(): number; get scaled_height(): number; get size(): number[]; extend(data: TextureLayerData): void; /** * Selects the layer */ select(multi_select?: boolean): void; getUndoCopy(image_data: boolean): any; getSaveCopy(): any; /** * Set the layer into a limbo state, where clicking Place or clicking next to the layer will place it on the layer below */ setLimbo(): void; /** * Resolves the limbo state by turning the limbo layer into a full layer, or merging it into the layer below * @param keep_separate If true, the layer is kept as a separate layer */ resolveLimbo(keep_separate: boolean): void; /** * Set the layer size. This resizes the canvas, which discards the layer content */ setSize(width: number, height: number): this; /** * Toggle layer visibility. This creates an undo point */ toggleVisibility(): this; /** * Merge this texture onto the texture below * @param undo Create an undo entry */ mergeDown(undo?: boolean): void; /** * Expand the layer to include the listed pixels * @param points */ expandTo(...points: ArrayVector2[]): void; /** * Flip the texture along an axis * @param axis Flip axis, where 0 is X and 1 is Y * @param undo Create an undo entry */ flip(axis: 0 | 1, undo: boolean): void; /** * Rotate the layer around itself in 90 degree steps * @param angle Angle in degrees * @param undo Create an undo entry */ rotate(angle: number, undo: boolean): void; /** * Centers the layer on the texture */ center(): void; /** * Open the properties dialog */ propertiesDialog(): void; /** * Get all layers of the active texture */ static all: TextureLayer[]; /** * Get the selected layer */ static selected: TextureLayer | null; } export interface TextureLayerGroupData { name?: string; folded?: boolean; } export type TextureLayerHierarchy = (TextureLayerGroupData | string)[]; export declare class TextureLayerGroup extends TextureLayerItem { folded: boolean; type: string; static properties: Record>; constructor(data: TextureLayerGroupData, texture?: Texture, uuid?: UUID); get children(): TextureLayerItem[]; extend(data: TextureLayerGroupData): void; getUndoCopy(): TextureLayerGroupData; getSaveCopy(): TextureLayerGroupData; getAllChildren(): TextureLayerItem[]; /** * Selects the layer */ select(multi_select?: boolean): void; /** * Toggle layer groupvisibility. This creates an undo point */ toggleVisibility(): this; /** * Open the properties dialog */ propertiesDialog(): void; } declare const global: { TextureLayer: typeof import("./layers").TextureLayer; TextureLayerGroup: typeof import("./layers").TextureLayerGroup; TextureLayerItem: typeof import("./layers").TextureLayerItem; }; declare global { const TextureLayer: typeof global.TextureLayer; type TextureLayer = import('./layers').TextureLayer; const TextureLayerGroup: typeof global.TextureLayerGroup; type TextureLayerGroup = import('./layers').TextureLayerGroup; const TextureLayerItem: typeof global.TextureLayerItem; type TextureLayerItem = import('./layers').TextureLayerItem; interface BarItemRegistry { layer_opacity: NumSlider; layer_blend_mode: BarSelect; selection_tool: Tool; create_empty_layer: Action; import_layer: Action; enable_texture_layers: Action; disable_texture_layers: Action; layer_to_texture_size: Action; merge_layer_down: Action; crop_layer_to_selection: Action; } } export {};