Files
paint-ui/types/tool.ts
Sebastian Krüger 7f4d574c64 feat(tools): implement advanced brush tools - Clone Stamp, Smudge, and Dodge/Burn
Added three professional-grade image manipulation tools to complete Feature 4:

Clone Stamp Tool (Shortcut: 8)
- Sample from source location with Alt+Click
- Paint sampled content to destination
- Maintains relative offset for natural cloning
- Supports soft/hard brush with hardness setting

Smudge Tool (Shortcut: 9)
- Creates realistic paint-smearing effects
- Progressively blends colors for natural smudging
- Uses flow setting to control smudge strength
- Soft brush falloff for smooth blending

Dodge/Burn Tool (Shortcut: 0)
- Dodge mode: Lightens image areas (default)
- Burn mode: Darkens image areas (Alt key)
- Professional photography exposure adjustment
- Respects hardness setting for precise control

All tools:
- Fully integrated with tool palette and keyboard shortcuts
- Support smooth interpolation for fluid strokes
- Use existing tool settings (size, opacity, hardness, flow, spacing)
- Lazy-loaded via code splitting system
- Icons from Lucide React (Stamp, Droplet, Sun)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 16:27:02 +01:00

63 lines
1.2 KiB
TypeScript

import type { PointerState } from './canvas';
/**
* Available tool types
*/
export type ToolType =
| 'select'
| 'move'
| 'pencil'
| 'brush'
| 'eraser'
| 'fill'
| 'eyedropper'
| 'text'
| 'shape'
| 'crop'
| 'clone'
| 'smudge'
| 'dodge'
| 'blur'
| 'sharpen';
/**
* Tool settings interface
*/
export interface ToolSettings {
/** Brush/pencil size */
size: number;
/** Opacity (0-1) */
opacity: number;
/** Hardness (0-1) */
hardness: number;
/** Color */
color: string;
/** Flow rate (0-1) */
flow: number;
/** Spacing between brush stamps */
spacing: number;
}
/**
* Tool state interface
*/
export interface ToolState {
/** Currently active tool */
activeTool: ToolType;
/** Tool-specific settings */
settings: ToolSettings;
/** Custom cursor */
cursor: string;
}
/**
* Tool event handlers
*/
export interface ToolHandlers {
onPointerDown?: (pointer: PointerState, ctx: CanvasRenderingContext2D) => void;
onPointerMove?: (pointer: PointerState, ctx: CanvasRenderingContext2D) => void;
onPointerUp?: (pointer: PointerState, ctx: CanvasRenderingContext2D) => void;
onActivate?: () => void;
onDeactivate?: () => void;
}