@nice2dev/ui-graphics 1.3.13 → 1.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +3 -3
  3. package/dist/types/core/useGamepad.d.ts +0 -16
  4. package/dist/types/core/usePointerPressure.d.ts +0 -88
  5. package/dist/types/game/AnimationPreviewPlayer.d.ts +0 -30
  6. package/dist/types/game/CollisionEditor.d.ts +0 -102
  7. package/dist/types/game/GameAssetExportPanel.d.ts +0 -20
  8. package/dist/types/game/IsometricEditor.d.ts +0 -22
  9. package/dist/types/game/IsometricTilePanel.d.ts +0 -18
  10. package/dist/types/game/gameAssetExport.d.ts +0 -160
  11. package/dist/types/game/isometricTiles.d.ts +0 -250
  12. package/dist/types/game/useAnimationPreview.d.ts +0 -63
  13. package/dist/types/game/useCollisionEditor.d.ts +0 -96
  14. package/dist/types/game/useGameAssetExport.d.ts +0 -82
  15. package/dist/types/photo/BatchProcessingPanel.d.ts +0 -13
  16. package/dist/types/photo/FaceDetectionPanel.d.ts +0 -19
  17. package/dist/types/photo/PerspectiveCorrectionPanel.d.ts +0 -17
  18. package/dist/types/photo/RawFilePanel.d.ts +0 -15
  19. package/dist/types/photo/StyleTransferPanel.d.ts +0 -16
  20. package/dist/types/photo/aiStyleTransfer.d.ts +0 -58
  21. package/dist/types/photo/batchProcessing.d.ts +0 -95
  22. package/dist/types/photo/faceDetection.d.ts +0 -103
  23. package/dist/types/photo/index.d.ts +0 -17
  24. package/dist/types/photo/perspectiveCorrection.d.ts +0 -124
  25. package/dist/types/photo/rawFileSupport.d.ts +0 -124
  26. package/dist/types/pixel/PaletteExtractorPanel.d.ts +0 -17
  27. package/dist/types/pixel/TileMapPanel.d.ts +0 -15
  28. package/dist/types/pixel/paletteExtractor.d.ts +0 -73
  29. package/dist/types/pixel/pixelAnimationPresets.d.ts +0 -79
  30. package/dist/types/pixel/pixelEffectsEngine.d.ts +0 -91
  31. package/dist/types/pixel/pixelEquipmentSystem.d.ts +0 -145
  32. package/dist/types/pixel/pixelSpriteTemplates.d.ts +0 -54
  33. package/dist/types/pixel/tileMapMode.d.ts +0 -122
  34. package/dist/types/vector/PathSimplificationPanel.d.ts +0 -16
  35. package/dist/types/vector/PdfExportPanel.d.ts +0 -20
  36. package/dist/types/vector/TextOnPathPanel.d.ts +0 -26
  37. package/dist/types/vector/VectorFilterPanel.d.ts +0 -20
  38. package/dist/types/vector/VectorPatternPanel.d.ts +0 -22
  39. package/dist/types/vector/pathSimplification.d.ts +0 -135
  40. package/dist/types/vector/pdfExport.d.ts +0 -65
  41. package/dist/types/vector/textOnPath.d.ts +0 -145
  42. package/dist/types/vector/vectorPatternFills.d.ts +0 -102
@@ -1,95 +0,0 @@
1
- /**
2
- * batchProcessing.ts
3
- * Batch image processing utilities for PhotoEditor
4
- */
5
- /** Image processing operation */
6
- export interface ProcessingOperation {
7
- type: string;
8
- params: Record<string, unknown>;
9
- }
10
- /** Single batch item */
11
- export interface BatchItem {
12
- id: string;
13
- file: File;
14
- status: 'pending' | 'processing' | 'completed' | 'error';
15
- progress: number;
16
- result?: Blob;
17
- error?: string;
18
- preview?: string;
19
- }
20
- /** Batch processing settings */
21
- export interface BatchSettings {
22
- /** Operations to apply */
23
- operations: ProcessingOperation[];
24
- /** Output format */
25
- outputFormat: 'jpeg' | 'png' | 'webp';
26
- /** Output quality (0-1) */
27
- quality: number;
28
- /** Resize settings */
29
- resize?: {
30
- enabled: boolean;
31
- width: number;
32
- height: number;
33
- maintainAspect: boolean;
34
- mode: 'fit' | 'fill' | 'stretch';
35
- };
36
- /** Naming pattern */
37
- namingPattern: string;
38
- /** Preserve metadata */
39
- preserveMetadata: boolean;
40
- }
41
- /** Processing result */
42
- export interface BatchResult {
43
- totalFiles: number;
44
- completedFiles: number;
45
- failedFiles: number;
46
- totalTime: number;
47
- results: BatchItem[];
48
- }
49
- /** Available filter types */
50
- export type FilterType = 'brightness' | 'contrast' | 'saturation' | 'hue' | 'grayscale' | 'sepia' | 'invert' | 'blur' | 'sharpen' | 'vignette' | 'exposure' | 'gamma' | 'temperature' | 'posterize' | 'noise';
51
- /** Filter presets */
52
- export interface FilterPreset {
53
- name: string;
54
- operations: ProcessingOperation[];
55
- }
56
- /**
57
- * Apply single operation to image data
58
- */
59
- export declare function applyOperation(imageData: ImageData, operation: ProcessingOperation): void;
60
- /**
61
- * Process single image file
62
- */
63
- export declare function processImage(file: File, settings: BatchSettings, onProgress?: (progress: number) => void): Promise<Blob>;
64
- /**
65
- * Process multiple images in batch
66
- */
67
- export declare function processBatch(files: File[], settings: BatchSettings, onItemProgress?: (itemId: string, progress: number) => void, onItemComplete?: (item: BatchItem) => void): Promise<BatchResult>;
68
- /**
69
- * Generate output filename
70
- */
71
- export declare function generateOutputFilename(original: string, pattern: string, index: number, format: string): string;
72
- /**
73
- * Download all batch results as ZIP
74
- */
75
- export declare function downloadBatchAsZip(result: BatchResult, settings: BatchSettings): Promise<void>;
76
- export declare const FILTER_PRESETS: FilterPreset[];
77
- export declare const DEFAULT_BATCH_SETTINGS: BatchSettings;
78
- export interface UseBatchProcessingOptions {
79
- onComplete?: (result: BatchResult) => void;
80
- }
81
- export declare function useBatchProcessing(options?: UseBatchProcessingOptions): {
82
- files: File[];
83
- items: BatchItem[];
84
- settings: BatchSettings;
85
- setSettings: import("react").Dispatch<import("react").SetStateAction<BatchSettings>>;
86
- isProcessing: boolean;
87
- result: BatchResult | null;
88
- addFiles: (newFiles: File[]) => void;
89
- removeFile: (index: number) => void;
90
- clearFiles: () => void;
91
- addOperation: (operation: ProcessingOperation) => void;
92
- removeOperation: (index: number) => void;
93
- applyPreset: (preset: FilterPreset) => void;
94
- process: () => Promise<void>;
95
- };
@@ -1,103 +0,0 @@
1
- /**
2
- * faceDetection — Face detection for auto-crop and photo analysis
3
- *
4
- * Provides face detection using:
5
- * 1. Pure JS skin-tone + edge detection heuristics (fast, no deps)
6
- * 2. Optional face-api.js integration (accurate, requires loading models)
7
- *
8
- * Features:
9
- * - Face region detection
10
- * - Face count estimation
11
- * - Auto-crop suggestions
12
- * - Face landmarks (with face-api.js)
13
- * - Expression detection (with face-api.js)
14
- */
15
- export interface FaceRegion {
16
- /** Bounding box */
17
- x: number;
18
- y: number;
19
- width: number;
20
- height: number;
21
- /** Detection confidence (0-1) */
22
- confidence: number;
23
- /** Face landmarks (if available) */
24
- landmarks?: FaceLandmarks;
25
- /** Estimated expression (if available) */
26
- expression?: FaceExpression;
27
- }
28
- export interface FaceLandmarks {
29
- leftEye: {
30
- x: number;
31
- y: number;
32
- };
33
- rightEye: {
34
- x: number;
35
- y: number;
36
- };
37
- nose: {
38
- x: number;
39
- y: number;
40
- };
41
- mouthLeft: {
42
- x: number;
43
- y: number;
44
- };
45
- mouthRight: {
46
- x: number;
47
- y: number;
48
- };
49
- jawOutline?: Array<{
50
- x: number;
51
- y: number;
52
- }>;
53
- }
54
- export type FaceExpression = 'neutral' | 'happy' | 'sad' | 'angry' | 'fearful' | 'disgusted' | 'surprised';
55
- export interface FaceDetectionOptions {
56
- /** Minimum face size (relative to image, 0-1) */
57
- minFaceSize: number;
58
- /** Maximum number of faces to detect */
59
- maxFaces: number;
60
- /** Detection quality */
61
- quality: 'fast' | 'accurate';
62
- /** Include landmarks detection */
63
- detectLandmarks: boolean;
64
- /** Include expression detection */
65
- detectExpressions: boolean;
66
- }
67
- export interface FaceDetectionResult {
68
- /** Detected faces */
69
- faces: FaceRegion[];
70
- /** Processing time in ms */
71
- processingTimeMs: number;
72
- /** Detection method used */
73
- method: 'heuristic' | 'neural';
74
- }
75
- export interface AutoCropSuggestion {
76
- /** Suggested crop rectangle */
77
- x: number;
78
- y: number;
79
- width: number;
80
- height: number;
81
- /** Aspect ratio used */
82
- aspectRatio: number;
83
- /** Crop type */
84
- type: 'portrait' | 'headshot' | 'group' | 'full';
85
- }
86
- export declare const DEFAULT_DETECTION_OPTIONS: FaceDetectionOptions;
87
- /**
88
- * Generate auto-crop suggestion based on detected faces
89
- */
90
- export declare function generateAutoCropSuggestion(faces: FaceRegion[], imageWidth: number, imageHeight: number, targetAspectRatio?: number): AutoCropSuggestion | null;
91
- /**
92
- * Generate multiple crop suggestions for common aspect ratios
93
- */
94
- export declare function generateMultipleCropSuggestions(faces: FaceRegion[], imageWidth: number, imageHeight: number): AutoCropSuggestion[];
95
- /**
96
- * Detect faces in an image
97
- */
98
- export declare function detectFaces(imageData: ImageData, options?: Partial<FaceDetectionOptions>): Promise<FaceDetectionResult>;
99
- /**
100
- * Quick face detection (always uses heuristic for speed)
101
- */
102
- export declare function detectFacesFast(imageData: ImageData, maxFaces?: number): FaceRegion[];
103
- export default detectFaces;
@@ -1,17 +0,0 @@
1
- export { default as NicePhotoEditor } from './PhotoEditor';
2
- export { usePhotoEditor } from './usePhotoEditor';
3
- export type * from './photoEditorTypes';
4
- export * from './photoFilters';
5
- export * from './photoOverlays';
6
- export * from './photoSelection';
7
- export * from './photoEditorActions';
8
- export { applyStyleTransfer, generateStylePreviews, downscaleForPreview, upscaleFromPreview, STYLE_PRESETS, DEFAULT_STYLE_OPTIONS, type StylePreset, type StyleTransferOptions, } from './aiStyleTransfer';
9
- export { StyleTransferPanel } from './StyleTransferPanel';
10
- export { loadRawFile, extractMetadata, extractPreview, isRawFile, detectFormatFromExtension, detectFormatFromHeader, RAW_EXTENSIONS, ALL_RAW_EXTENSIONS, DEFAULT_RAW_OPTIONS, type RawFormat, type RawMetadata, type RawProcessingOptions, type RawLoadResult, } from './rawFileSupport';
11
- export { RawFilePanel } from './RawFilePanel';
12
- export { detectFaces, detectFacesFast, generateAutoCropSuggestion, type FaceRegion, type FaceDetectionOptions, type AutoCropSuggestion, } from './faceDetection';
13
- export { FaceDetectionPanel } from './FaceDetectionPanel';
14
- export { applyPerspectiveTransform, computePerspectiveTransform, detectDocumentEdges, createRectQuad, getQuadBounds, isPointInQuad, getNearestCorner, moveQuadCorner, getQuadArea, identityMatrix, multiplyMatrices, invertMatrix, transformPoint, PERSPECTIVE_PRESETS, type Quad, type Matrix3x3, type PerspectiveSettings, type CornerHandle, type PerspectivePreset, type UsePerspectiveCorrectionOptions, } from './perspectiveCorrection';
15
- export { PerspectiveCorrectionPanel } from './PerspectiveCorrectionPanel';
16
- export * from './batchProcessing';
17
- export { BatchProcessingPanel } from './BatchProcessingPanel';
@@ -1,124 +0,0 @@
1
- /**
2
- * perspectiveCorrection.ts
3
- * Perspective correction and transformation utilities for PhotoEditor
4
- */
5
- /** 2D Point */
6
- export interface Point {
7
- x: number;
8
- y: number;
9
- }
10
- /** Quad defined by four corners */
11
- export interface Quad {
12
- topLeft: Point;
13
- topRight: Point;
14
- bottomRight: Point;
15
- bottomLeft: Point;
16
- }
17
- /** 3x3 Transformation matrix */
18
- export type Matrix3x3 = [number, number, number, number, number, number, number, number, number];
19
- /** Perspective correction settings */
20
- export interface PerspectiveSettings {
21
- /** Source quad corners */
22
- sourceQuad: Quad;
23
- /** Target quad corners (usually rectangle) */
24
- targetQuad: Quad;
25
- /** Interpolation method */
26
- interpolation: 'nearest' | 'bilinear' | 'bicubic';
27
- /** Maintain aspect ratio */
28
- maintainAspect: boolean;
29
- /** Output width */
30
- outputWidth: number;
31
- /** Output height */
32
- outputHeight: number;
33
- }
34
- /** Corner handle being dragged */
35
- export type CornerHandle = 'topLeft' | 'topRight' | 'bottomRight' | 'bottomLeft';
36
- /** Preset perspective correction */
37
- export interface PerspectivePreset {
38
- name: string;
39
- description: string;
40
- sourceQuad: Quad;
41
- }
42
- /**
43
- * Create identity matrix
44
- */
45
- export declare function identityMatrix(): Matrix3x3;
46
- /**
47
- * Multiply two 3x3 matrices
48
- */
49
- export declare function multiplyMatrices(a: Matrix3x3, b: Matrix3x3): Matrix3x3;
50
- /**
51
- * Invert 3x3 matrix
52
- */
53
- export declare function invertMatrix(m: Matrix3x3): Matrix3x3 | null;
54
- /**
55
- * Transform point using matrix
56
- */
57
- export declare function transformPoint(p: Point, m: Matrix3x3): Point;
58
- /**
59
- * Calculate perspective transformation matrix from quad to quad
60
- */
61
- export declare function computePerspectiveTransform(src: Quad, dst: Quad): Matrix3x3;
62
- /**
63
- * Apply perspective transform to image data
64
- */
65
- export declare function applyPerspectiveTransform(sourceData: ImageData, settings: PerspectiveSettings): ImageData;
66
- /**
67
- * Create rectangle quad
68
- */
69
- export declare function createRectQuad(x: number, y: number, width: number, height: number): Quad;
70
- /**
71
- * Calculate bounding box of quad
72
- */
73
- export declare function getQuadBounds(quad: Quad): {
74
- x: number;
75
- y: number;
76
- width: number;
77
- height: number;
78
- };
79
- /**
80
- * Check if point is inside quad
81
- */
82
- export declare function isPointInQuad(point: Point, quad: Quad): boolean;
83
- /**
84
- * Get nearest corner handle to point
85
- */
86
- export declare function getNearestCorner(point: Point, quad: Quad, threshold?: number): CornerHandle | null;
87
- /**
88
- * Move corner of quad
89
- */
90
- export declare function moveQuadCorner(quad: Quad, corner: CornerHandle, newPos: Point): Quad;
91
- /**
92
- * Calculate quad area
93
- */
94
- export declare function getQuadArea(quad: Quad): number;
95
- /**
96
- * Detect document/paper edges in image
97
- * Returns suggested quad corners
98
- */
99
- export declare function detectDocumentEdges(imageData: ImageData, options?: {
100
- edgeThreshold?: number;
101
- minArea?: number;
102
- }): Quad | null;
103
- /**
104
- * Perspective correction presets
105
- */
106
- export declare const PERSPECTIVE_PRESETS: PerspectivePreset[];
107
- export interface UsePerspectiveCorrectionOptions {
108
- imageWidth: number;
109
- imageHeight: number;
110
- }
111
- export declare function usePerspectiveCorrection(options: UsePerspectiveCorrectionOptions): {
112
- sourceQuad: Quad;
113
- setSourceQuad: import("react").Dispatch<import("react").SetStateAction<Quad>>;
114
- interpolation: "nearest" | "bilinear" | "bicubic";
115
- setInterpolation: import("react").Dispatch<import("react").SetStateAction<"nearest" | "bilinear" | "bicubic">>;
116
- maintainAspect: boolean;
117
- setMaintainAspect: import("react").Dispatch<import("react").SetStateAction<boolean>>;
118
- activeCorner: CornerHandle | null;
119
- setActiveCorner: import("react").Dispatch<import("react").SetStateAction<CornerHandle | null>>;
120
- resetQuad: () => void;
121
- moveCorner: (corner: CornerHandle, newPos: Point) => void;
122
- applyPreset: (preset: PerspectivePreset) => void;
123
- getSettings: () => PerspectiveSettings;
124
- };
@@ -1,124 +0,0 @@
1
- /**
2
- * rawFileSupport — RAW camera file support for PhotoEditor
3
- *
4
- * Provides loading and processing of RAW camera formats including:
5
- * - Canon (.CR2, .CR3, .CRW)
6
- * - Nikon (.NEF, .NRW)
7
- * - Sony (.ARW, .SRF, .SR2)
8
- * - Adobe (.DNG)
9
- * - Fujifilm (.RAF)
10
- * - Olympus (.ORF)
11
- * - Panasonic (.RW2)
12
- * - Pentax (.PEF, .DNG)
13
- * - And many more via embedded thumbnail or DCRaw emulation
14
- *
15
- * Features:
16
- * - Embedded preview extraction (fast)
17
- * - Full demosaic processing (with optional libraw.js)
18
- * - White balance adjustment
19
- * - Exposure compensation
20
- * - Highlight recovery
21
- * - Noise reduction
22
- */
23
- export type RawFormat = 'cr2' | 'cr3' | 'crw' | 'nef' | 'nrw' | 'arw' | 'srf' | 'sr2' | 'dng' | 'raf' | 'orf' | 'rw2' | 'pef' | 'raw' | '3fr' | 'fff' | 'iiq' | 'mrw' | 'x3f' | 'rwl' | 'srw' | 'unknown';
24
- export interface RawMetadata {
25
- /** Camera maker */
26
- make: string;
27
- /** Camera model */
28
- model: string;
29
- /** Image width */
30
- width: number;
31
- /** Image height */
32
- height: number;
33
- /** ISO sensitivity */
34
- iso: number;
35
- /** Shutter speed (seconds) */
36
- shutterSpeed: number;
37
- /** Aperture (f-number) */
38
- aperture: number;
39
- /** Focal length (mm) */
40
- focalLength: number;
41
- /** Capture date */
42
- dateTime: Date | null;
43
- /** Orientation (EXIF) */
44
- orientation: number;
45
- /** Color temperature (K) */
46
- colorTemperature: number;
47
- /** Detected RAW format */
48
- format: RawFormat;
49
- /** Has embedded preview */
50
- hasPreview: boolean;
51
- /** Has embedded thumbnail */
52
- hasThumbnail: boolean;
53
- }
54
- export interface RawProcessingOptions {
55
- /** Use embedded preview instead of demosaic */
56
- usePreview: boolean;
57
- /** White balance mode */
58
- whiteBalance: 'camera' | 'auto' | 'daylight' | 'cloudy' | 'shade' | 'tungsten' | 'fluorescent' | 'flash' | 'custom';
59
- /** Custom color temperature (K) */
60
- colorTemperature: number;
61
- /** Custom tint (green-magenta) */
62
- tint: number;
63
- /** Exposure compensation (EV) */
64
- exposure: number;
65
- /** Highlight recovery (0-1) */
66
- highlightRecovery: number;
67
- /** Shadow recovery (0-1) */
68
- shadowRecovery: number;
69
- /** Noise reduction level (0-1) */
70
- noiseReduction: number;
71
- /** Chromatic aberration correction */
72
- chromaticAberration: boolean;
73
- /** Output color space */
74
- colorSpace: 'sRGB' | 'AdobeRGB' | 'ProPhotoRGB';
75
- /** Output bit depth */
76
- bitDepth: 8 | 16;
77
- /** Demosaic algorithm */
78
- demosaicAlgorithm: 'bilinear' | 'VNG' | 'PPG' | 'AHD' | 'DCB';
79
- }
80
- export interface RawLoadResult {
81
- /** Processed image data */
82
- imageData: ImageData;
83
- /** Raw file metadata */
84
- metadata: RawMetadata;
85
- /** Processing info */
86
- processingInfo: {
87
- method: 'preview' | 'thumbnail' | 'demosaic';
88
- timeMs: number;
89
- originalWidth: number;
90
- originalHeight: number;
91
- };
92
- }
93
- export declare const DEFAULT_RAW_OPTIONS: RawProcessingOptions;
94
- export declare const RAW_EXTENSIONS: Record<RawFormat, string[]>;
95
- export declare const ALL_RAW_EXTENSIONS: string[];
96
- /**
97
- * Detect RAW format from file extension
98
- */
99
- export declare function detectFormatFromExtension(filename: string): RawFormat;
100
- /**
101
- * Detect RAW format from file header
102
- */
103
- export declare function detectFormatFromHeader(buffer: ArrayBuffer): RawFormat;
104
- /**
105
- * Check if file is a RAW format
106
- */
107
- export declare function isRawFile(filename: string): boolean;
108
- /**
109
- * Extract metadata from RAW file
110
- */
111
- export declare function extractMetadata(buffer: ArrayBuffer): RawMetadata;
112
- /**
113
- * Extract embedded JPEG preview from RAW file
114
- */
115
- export declare function extractPreview(buffer: ArrayBuffer): Promise<ImageData | null>;
116
- /**
117
- * Load and process RAW file
118
- */
119
- export declare function loadRawFile(buffer: ArrayBuffer, options?: Partial<RawProcessingOptions>): Promise<RawLoadResult>;
120
- /**
121
- * Quick preview load (just extract embedded preview)
122
- */
123
- export declare function loadRawPreview(buffer: ArrayBuffer): Promise<ImageData | null>;
124
- export default loadRawFile;
@@ -1,17 +0,0 @@
1
- /**
2
- * PaletteExtractorPanel — UI for extracting palettes from images
3
- */
4
- import React from 'react';
5
- export interface PaletteExtractorPanelProps {
6
- /** Current image data to extract from */
7
- imageData?: ImageData | null;
8
- /** Called when palette is extracted */
9
- onExtract?: (colors: string[]) => void;
10
- /** Called when palette is applied */
11
- onApply?: (colors: string[]) => void;
12
- /** Current palette for comparison */
13
- currentPalette?: string[];
14
- className?: string;
15
- }
16
- export declare function PaletteExtractorPanel({ imageData, onExtract, onApply, currentPalette: _currentPalette, className, }: PaletteExtractorPanelProps): React.JSX.Element;
17
- export default PaletteExtractorPanel;
@@ -1,15 +0,0 @@
1
- /**
2
- * TileMapPanel — UI panel for tile map mode settings
3
- */
4
- import React from 'react';
5
- import type { TileMapSettings } from './tileMapMode';
6
- export interface TileMapPanelProps {
7
- settings: TileMapSettings;
8
- onSettingsChange: (settings: Partial<TileMapSettings>) => void;
9
- seamScore?: number;
10
- onMakeSeamless?: () => void;
11
- onAnalyzeSeams?: () => void;
12
- className?: string;
13
- }
14
- export declare function TileMapPanel({ settings, onSettingsChange, seamScore, onMakeSeamless, onAnalyzeSeams, className, }: TileMapPanelProps): React.JSX.Element;
15
- export default TileMapPanel;
@@ -1,73 +0,0 @@
1
- /**
2
- * paletteExtractor — Extract color palettes from images
3
- *
4
- * Features:
5
- * - K-means clustering for dominant colors
6
- * - Median cut algorithm
7
- * - Octree quantization
8
- * - Color sorting options
9
- * - Palette size control
10
- * - Common palette format imports (GPL, PAL, ASE, ACO)
11
- */
12
- export interface RGB {
13
- r: number;
14
- g: number;
15
- b: number;
16
- }
17
- export interface PaletteColor extends RGB {
18
- hex: string;
19
- count: number;
20
- percentage: number;
21
- }
22
- export type ExtractionAlgorithm = 'kmeans' | 'median-cut' | 'octree' | 'frequency';
23
- export type SortOrder = 'frequency' | 'hue' | 'saturation' | 'lightness' | 'brightness' | 'none';
24
- export interface ExtractionOptions {
25
- /** Number of colors to extract */
26
- colorCount: number;
27
- /** Algorithm to use */
28
- algorithm: ExtractionAlgorithm;
29
- /** Sort order for results */
30
- sortOrder: SortOrder;
31
- /** Minimum color difference (0-255) to include similar colors */
32
- minDifference: number;
33
- /** Sample rate (1 = every pixel, 2 = every 2nd, etc.) */
34
- sampleRate: number;
35
- /** Ignore transparent pixels */
36
- ignoreTransparent: boolean;
37
- }
38
- export declare const DEFAULT_EXTRACTION_OPTIONS: ExtractionOptions;
39
- export declare function rgbToHex(r: number, g: number, b: number): string;
40
- export declare function hexToRgb(hex: string): RGB;
41
- export declare function colorDistance(c1: RGB, c2: RGB): number;
42
- export declare function rgbToHsl(r: number, g: number, b: number): {
43
- h: number;
44
- s: number;
45
- l: number;
46
- };
47
- export declare function getBrightness(r: number, g: number, b: number): number;
48
- export declare function extractPalette(imageData: ImageData, options?: Partial<ExtractionOptions>): PaletteColor[];
49
- /**
50
- * Extract palette from image/canvas element
51
- */
52
- export declare function extractPaletteFromImage(source: HTMLImageElement | HTMLCanvasElement, options?: Partial<ExtractionOptions>): PaletteColor[];
53
- /**
54
- * Parse GIMP Palette (.gpl) format
55
- */
56
- export declare function parseGplPalette(content: string): string[];
57
- /**
58
- * Parse Paint.NET/JASC Palette (.pal) format
59
- */
60
- export declare function parsePalPalette(content: string): string[];
61
- /**
62
- * Parse hex color list (one per line)
63
- */
64
- export declare function parseHexPalette(content: string): string[];
65
- /**
66
- * Export palette to GPL format
67
- */
68
- export declare function exportToGpl(colors: string[], name?: string): string;
69
- /**
70
- * Export palette to PAL format
71
- */
72
- export declare function exportToPal(colors: string[]): string;
73
- export default extractPalette;
@@ -1,79 +0,0 @@
1
- /**
2
- * pixelAnimationPresets.ts — Frame interpolation, transitions, and animation helpers.
3
- *
4
- * Features:
5
- * - Frame-to-frame interpolation (tween ImageData)
6
- * - Transition effects between frames (dissolve, slide, wipe, morph, iris)
7
- * - Default animation sequences (idle, walk, run, attack cycles)
8
- * - Onion skin rendering
9
- * - Frame timing utilities
10
- */
11
- import { type RGBA } from './pixelEditorUtils';
12
- export interface FrameTransition {
13
- id: string;
14
- name: string;
15
- category: TransitionCategory;
16
- /** Generate intermediate frames between from→to */
17
- generate: (from: ImageData, to: ImageData, steps: number) => ImageData[];
18
- }
19
- export type TransitionCategory = 'blend' | 'slide' | 'wipe' | 'special' | 'pixelate';
20
- export interface AnimationSequence {
21
- id: string;
22
- name: string;
23
- /** Description of the motion */
24
- description: string;
25
- /** Number of frames recommended */
26
- frameCount: number;
27
- /** Recommended FPS */
28
- fps: number;
29
- loop: boolean;
30
- /** Per-frame transform hints (translate/rotate sprite between frames) */
31
- frameHints: FrameHint[];
32
- }
33
- export interface FrameHint {
34
- /** Label for this frame's purpose */
35
- label: string;
36
- /** Suggested X offset from base position */
37
- offsetX: number;
38
- /** Suggested Y offset from base position */
39
- offsetY: number;
40
- /** Suggested rotation (degrees) */
41
- rotation: number;
42
- /** Suggested scale factor */
43
- scale: number;
44
- /** Frame duration multiplier (1 = normal) */
45
- durationMultiplier: number;
46
- }
47
- export interface OnionSkinConfig {
48
- enabled: boolean;
49
- /** How many frames before to show */
50
- framesBefore: number;
51
- /** How many frames after to show */
52
- framesAfter: number;
53
- /** Opacity for previous frames (0-1) */
54
- opacityBefore: number;
55
- /** Opacity for next frames (0-1) */
56
- opacityAfter: number;
57
- /** Color tint for previous frames */
58
- tintBefore: RGBA;
59
- /** Color tint for next frames */
60
- tintAfter: RGBA;
61
- /** Opacity falloff per frame */
62
- falloff: number;
63
- }
64
- /** Pixel-level crossfade between two frames */
65
- export declare function interpolateFrames(from: ImageData, to: ImageData, t: number): ImageData;
66
- /** Generate N intermediate frames between from and to */
67
- export declare function generateTweenFrames(from: ImageData, to: ImageData, count: number): ImageData[];
68
- export declare const FRAME_TRANSITIONS: FrameTransition[];
69
- export declare function getTransitionsByCategory(category: TransitionCategory): FrameTransition[];
70
- export declare function getTransitionById(id: string): FrameTransition | undefined;
71
- export declare const ANIMATION_SEQUENCES: AnimationSequence[];
72
- export declare function getSequenceById(id: string): AnimationSequence | undefined;
73
- export declare const DEFAULT_ONION_SKIN: OnionSkinConfig;
74
- /**
75
- * Render onion skin overlays. Returns an ImageData with the ghosted frames composited.
76
- */
77
- export declare function renderOnionSkin(frames: ImageData[], currentFrame: number, config: OnionSkinConfig): ImageData;
78
- export declare function computeFrameDurations(fps: number, frameCount: number, hints?: FrameHint[]): number[];
79
- export declare function totalAnimationDuration(fps: number, frameCount: number, hints?: FrameHint[]): number;