UNPKG

react-image-mask

Version:

A React component for creating image masks with drawing tools

51 lines 1.76 kB
/// <reference types="react" /> import { ImageMaskProps, ImageMaskRef } from "./types"; /** * ImageMask - A comprehensive React component for creating image masks with drawing tools * * This is the main component that combines the drawing canvas with intuitive controls. * It provides multiple drawing tools (freehand, box, polygon), eraser tools, zoom/pan * functionality, and full touch gesture support for mobile devices. * * Features: * - Multiple drawing tools (freehand, box selection, polygon selection) * - Eraser tools for precise mask editing * - Zoom and pan functionality with mouse wheel and touch gestures * - Undo/redo history with configurable depth * - Customizable brush size, opacity, and colors * - Touch gestures for iPad/mobile (pinch-to-zoom, two-finger pan) * - Apple Pencil support * - Export functionality (PNG download) * - Configurable UI controls * * @component * @example * ```tsx * // Basic usage * <ImageMask * src="https://example.com/image.jpg" * onMaskChange={(maskData) => console.log('Mask updated:', maskData)} * /> * * // Advanced usage with custom configuration * const controlsConfig = { * showDownloadButton: false, * showBrushControls: true, * showColorControls: true * }; * * <ImageMask * src="https://example.com/image.jpg" * maskColor="rgba(255, 0, 0, 1)" * opacity={0.7} * brushSize={20} * controlsConfig={controlsConfig} * onMaskChange={handleMaskChange} * onZoomChange={handleZoomChange} * onHistoryChange={handleHistoryChange} * /> * ``` */ declare const ImageMask: import("react").ForwardRefExoticComponent<ImageMaskProps & import("react").RefAttributes<ImageMaskRef>>; export default ImageMask; //# sourceMappingURL=ImageMask.d.ts.map