/** * Painter * * Core texture painting and drawing system. * Provides pixel-level texture editing capabilities. */ import { Texture } from './texture'; export interface ColorRGBA { r: number; g: number; b: number; a: number; } export interface BrushOptions { size?: number; softness?: number; opacity?: number; shape?: 'circle' | 'square'; color?: ColorRGBA; erase?: boolean; lockAlpha?: boolean; } export interface PaintContext { texture: Texture; canvas: HTMLCanvasElement; ctx: CanvasRenderingContext2D; offset: [number, number]; element?: any; face?: string; x?: number; y?: number; } export interface PixelEditCallback { (px: number, py: number, currentColor: ColorRGBA, localOpacity: number): ColorRGBA; } /** * Core Painter class for texture painting */ export declare class Painter { private static currentPixel; private static brushChanges; private static current; private static selection; private static mirrorPainting; private static lockAlpha; private static eraseMode; /** * Edit texture with undo support */ static edit(texture: Texture, callback: (canvas: HTMLCanvasElement, context: PaintContext) => void, options?: { no_undo?: boolean; no_undo_init?: boolean; no_undo_finish?: boolean; edit_name?: string; use_cache?: boolean; no_update?: boolean; }): void; /** * Get pixel color at coordinates */ static getPixelColor(ctx: CanvasRenderingContext2D, x: number, y: number): ColorRGBA | null; /** * Modify a section of canvas */ static modifyCanvasSection(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, offset: [number, number] | undefined, callback: (editPixel: (px: number, py: number, editPx: (color: ColorRGBA) => ColorRGBA) => void) => void): void; /** * Edit circle area */ static editCircle(ctx: CanvasRenderingContext2D, x: number, y: number, radius: number, softness: number, editPx: PixelEditCallback): void; /** * Edit square area */ static editSquare(ctx: CanvasRenderingContext2D, x: number, y: number, size: number, softness: number, editPx: PixelEditCallback): void; /** * Combine colors with opacity */ static combineColors(baseColor: ColorRGBA, newColor: ColorRGBA, opacity: number): ColorRGBA; /** * Blend colors using different blend modes */ static blendColors(baseColor: ColorRGBA, newColor: ColorRGBA, opacity: number, mode: 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion'): ColorRGBA; /** * Paint with brush */ static paintBrush(ctx: CanvasRenderingContext2D, x: number, y: number, options: BrushOptions, editPx: PixelEditCallback): void; /** * Get blend mode composite operation for canvas */ static getBlendModeCompositeOperation(mode: string): GlobalCompositeOperation; /** * Scan canvas pixels */ static scanCanvas(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, callback: (px: number, py: number, pixelData: Uint8ClampedArray) => void): void; } //# sourceMappingURL=painter.d.ts.map