react-native-image-editor-skia 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +202 -0
- package/lib/commonjs/ImageEditor.js +141 -0
- package/lib/commonjs/ImageEditor.js.map +1 -0
- package/lib/commonjs/annotations/AnnotationView.js +42 -0
- package/lib/commonjs/annotations/AnnotationView.js.map +1 -0
- package/lib/commonjs/annotations/ArrowAnnotation.js +29 -0
- package/lib/commonjs/annotations/ArrowAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/CircleAnnotation.js +31 -0
- package/lib/commonjs/annotations/CircleAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/FreehandAnnotation.js +29 -0
- package/lib/commonjs/annotations/FreehandAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/MarkerAnnotation.js +27 -0
- package/lib/commonjs/annotations/MarkerAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/RotatedGroup.js +34 -0
- package/lib/commonjs/annotations/RotatedGroup.js.map +1 -0
- package/lib/commonjs/annotations/TextAnnotation.js +40 -0
- package/lib/commonjs/annotations/TextAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/geometry.js +73 -0
- package/lib/commonjs/annotations/geometry.js.map +1 -0
- package/lib/commonjs/annotations/geometryPure.js +104 -0
- package/lib/commonjs/annotations/geometryPure.js.map +1 -0
- package/lib/commonjs/canvas/AnnotationLayer.js +58 -0
- package/lib/commonjs/canvas/AnnotationLayer.js.map +1 -0
- package/lib/commonjs/canvas/BaseImageLayer.js +27 -0
- package/lib/commonjs/canvas/BaseImageLayer.js.map +1 -0
- package/lib/commonjs/canvas/CropOverlay.js +135 -0
- package/lib/commonjs/canvas/CropOverlay.js.map +1 -0
- package/lib/commonjs/canvas/EditorCanvas.js +91 -0
- package/lib/commonjs/canvas/EditorCanvas.js.map +1 -0
- package/lib/commonjs/canvas/InFlightLayer.js +152 -0
- package/lib/commonjs/canvas/InFlightLayer.js.map +1 -0
- package/lib/commonjs/canvas/SelectionOverlay.js +90 -0
- package/lib/commonjs/canvas/SelectionOverlay.js.map +1 -0
- package/lib/commonjs/constants.js +56 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context/EditorContext.js +132 -0
- package/lib/commonjs/context/EditorContext.js.map +1 -0
- package/lib/commonjs/export/drawScene.js +97 -0
- package/lib/commonjs/export/drawScene.js.map +1 -0
- package/lib/commonjs/export/exportImage.js +92 -0
- package/lib/commonjs/export/exportImage.js.map +1 -0
- package/lib/commonjs/gestures/applyTransform.js +79 -0
- package/lib/commonjs/gestures/applyTransform.js.map +1 -0
- package/lib/commonjs/gestures/createAnnotation.js +73 -0
- package/lib/commonjs/gestures/createAnnotation.js.map +1 -0
- package/lib/commonjs/gestures/handles.js +53 -0
- package/lib/commonjs/gestures/handles.js.map +1 -0
- package/lib/commonjs/gestures/hitTest.js +72 -0
- package/lib/commonjs/gestures/hitTest.js.map +1 -0
- package/lib/commonjs/gestures/useCropGesture.js +149 -0
- package/lib/commonjs/gestures/useCropGesture.js.map +1 -0
- package/lib/commonjs/gestures/useEditorGestures.js +289 -0
- package/lib/commonjs/gestures/useEditorGestures.js.map +1 -0
- package/lib/commonjs/image/disposeRegistry.js +63 -0
- package/lib/commonjs/image/disposeRegistry.js.map +1 -0
- package/lib/commonjs/image/useLoadedImage.js +121 -0
- package/lib/commonjs/image/useLoadedImage.js.map +1 -0
- package/lib/commonjs/index.js +52 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/state/history.js +85 -0
- package/lib/commonjs/state/history.js.map +1 -0
- package/lib/commonjs/state/selectors.js +19 -0
- package/lib/commonjs/state/selectors.js.map +1 -0
- package/lib/commonjs/state/useEditorReducer.js +83 -0
- package/lib/commonjs/state/useEditorReducer.js.map +1 -0
- package/lib/commonjs/toolbar/ColorPicker.js +84 -0
- package/lib/commonjs/toolbar/ColorPicker.js.map +1 -0
- package/lib/commonjs/toolbar/CropControls.js +65 -0
- package/lib/commonjs/toolbar/CropControls.js.map +1 -0
- package/lib/commonjs/toolbar/RotationSlider.js +73 -0
- package/lib/commonjs/toolbar/RotationSlider.js.map +1 -0
- package/lib/commonjs/toolbar/TextInputOverlay.js +108 -0
- package/lib/commonjs/toolbar/TextInputOverlay.js.map +1 -0
- package/lib/commonjs/toolbar/ToolButton.js +56 -0
- package/lib/commonjs/toolbar/ToolButton.js.map +1 -0
- package/lib/commonjs/toolbar/Toolbar.js +137 -0
- package/lib/commonjs/toolbar/Toolbar.js.map +1 -0
- package/lib/commonjs/types.js +47 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/color.js +37 -0
- package/lib/commonjs/utils/color.js.map +1 -0
- package/lib/commonjs/utils/id.js +14 -0
- package/lib/commonjs/utils/id.js.map +1 -0
- package/lib/commonjs/utils/math.js +277 -0
- package/lib/commonjs/utils/math.js.map +1 -0
- package/lib/module/ImageEditor.js +138 -0
- package/lib/module/ImageEditor.js.map +1 -0
- package/lib/module/annotations/AnnotationView.js +39 -0
- package/lib/module/annotations/AnnotationView.js.map +1 -0
- package/lib/module/annotations/ArrowAnnotation.js +26 -0
- package/lib/module/annotations/ArrowAnnotation.js.map +1 -0
- package/lib/module/annotations/CircleAnnotation.js +27 -0
- package/lib/module/annotations/CircleAnnotation.js.map +1 -0
- package/lib/module/annotations/FreehandAnnotation.js +25 -0
- package/lib/module/annotations/FreehandAnnotation.js.map +1 -0
- package/lib/module/annotations/MarkerAnnotation.js +23 -0
- package/lib/module/annotations/MarkerAnnotation.js.map +1 -0
- package/lib/module/annotations/RotatedGroup.js +29 -0
- package/lib/module/annotations/RotatedGroup.js.map +1 -0
- package/lib/module/annotations/TextAnnotation.js +37 -0
- package/lib/module/annotations/TextAnnotation.js.map +1 -0
- package/lib/module/annotations/geometry.js +56 -0
- package/lib/module/annotations/geometry.js.map +1 -0
- package/lib/module/annotations/geometryPure.js +100 -0
- package/lib/module/annotations/geometryPure.js.map +1 -0
- package/lib/module/canvas/AnnotationLayer.js +55 -0
- package/lib/module/canvas/AnnotationLayer.js.map +1 -0
- package/lib/module/canvas/BaseImageLayer.js +23 -0
- package/lib/module/canvas/BaseImageLayer.js.map +1 -0
- package/lib/module/canvas/CropOverlay.js +131 -0
- package/lib/module/canvas/CropOverlay.js.map +1 -0
- package/lib/module/canvas/EditorCanvas.js +88 -0
- package/lib/module/canvas/EditorCanvas.js.map +1 -0
- package/lib/module/canvas/InFlightLayer.js +149 -0
- package/lib/module/canvas/InFlightLayer.js.map +1 -0
- package/lib/module/canvas/SelectionOverlay.js +85 -0
- package/lib/module/canvas/SelectionOverlay.js.map +1 -0
- package/lib/module/constants.js +52 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context/EditorContext.js +126 -0
- package/lib/module/context/EditorContext.js.map +1 -0
- package/lib/module/export/drawScene.js +93 -0
- package/lib/module/export/drawScene.js.map +1 -0
- package/lib/module/export/exportImage.js +88 -0
- package/lib/module/export/exportImage.js.map +1 -0
- package/lib/module/gestures/applyTransform.js +75 -0
- package/lib/module/gestures/applyTransform.js.map +1 -0
- package/lib/module/gestures/createAnnotation.js +65 -0
- package/lib/module/gestures/createAnnotation.js.map +1 -0
- package/lib/module/gestures/handles.js +49 -0
- package/lib/module/gestures/handles.js.map +1 -0
- package/lib/module/gestures/hitTest.js +69 -0
- package/lib/module/gestures/hitTest.js.map +1 -0
- package/lib/module/gestures/useCropGesture.js +145 -0
- package/lib/module/gestures/useCropGesture.js.map +1 -0
- package/lib/module/gestures/useEditorGestures.js +285 -0
- package/lib/module/gestures/useEditorGestures.js.map +1 -0
- package/lib/module/image/disposeRegistry.js +57 -0
- package/lib/module/image/disposeRegistry.js.map +1 -0
- package/lib/module/image/useLoadedImage.js +117 -0
- package/lib/module/image/useLoadedImage.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/state/history.js +76 -0
- package/lib/module/state/history.js.map +1 -0
- package/lib/module/state/selectors.js +14 -0
- package/lib/module/state/selectors.js.map +1 -0
- package/lib/module/state/useEditorReducer.js +79 -0
- package/lib/module/state/useEditorReducer.js.map +1 -0
- package/lib/module/toolbar/ColorPicker.js +80 -0
- package/lib/module/toolbar/ColorPicker.js.map +1 -0
- package/lib/module/toolbar/CropControls.js +62 -0
- package/lib/module/toolbar/CropControls.js.map +1 -0
- package/lib/module/toolbar/RotationSlider.js +69 -0
- package/lib/module/toolbar/RotationSlider.js.map +1 -0
- package/lib/module/toolbar/TextInputOverlay.js +105 -0
- package/lib/module/toolbar/TextInputOverlay.js.map +1 -0
- package/lib/module/toolbar/ToolButton.js +52 -0
- package/lib/module/toolbar/ToolButton.js.map +1 -0
- package/lib/module/toolbar/Toolbar.js +133 -0
- package/lib/module/toolbar/Toolbar.js.map +1 -0
- package/lib/module/types.js +43 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/color.js +33 -0
- package/lib/module/utils/color.js.map +1 -0
- package/lib/module/utils/id.js +10 -0
- package/lib/module/utils/id.js.map +1 -0
- package/lib/module/utils/math.js +258 -0
- package/lib/module/utils/math.js.map +1 -0
- package/lib/typescript/src/ImageEditor.d.ts +9 -0
- package/lib/typescript/src/ImageEditor.d.ts.map +1 -0
- package/lib/typescript/src/annotations/AnnotationView.d.ts +6 -0
- package/lib/typescript/src/annotations/AnnotationView.d.ts.map +1 -0
- package/lib/typescript/src/annotations/ArrowAnnotation.d.ts +5 -0
- package/lib/typescript/src/annotations/ArrowAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/CircleAnnotation.d.ts +5 -0
- package/lib/typescript/src/annotations/CircleAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/FreehandAnnotation.d.ts +5 -0
- package/lib/typescript/src/annotations/FreehandAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/MarkerAnnotation.d.ts +5 -0
- package/lib/typescript/src/annotations/MarkerAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/RotatedGroup.d.ts +13 -0
- package/lib/typescript/src/annotations/RotatedGroup.d.ts.map +1 -0
- package/lib/typescript/src/annotations/TextAnnotation.d.ts +10 -0
- package/lib/typescript/src/annotations/TextAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/geometry.d.ts +11 -0
- package/lib/typescript/src/annotations/geometry.d.ts.map +1 -0
- package/lib/typescript/src/annotations/geometryPure.d.ts +14 -0
- package/lib/typescript/src/annotations/geometryPure.d.ts.map +1 -0
- package/lib/typescript/src/canvas/AnnotationLayer.d.ts +11 -0
- package/lib/typescript/src/canvas/AnnotationLayer.d.ts.map +1 -0
- package/lib/typescript/src/canvas/BaseImageLayer.d.ts +12 -0
- package/lib/typescript/src/canvas/BaseImageLayer.d.ts.map +1 -0
- package/lib/typescript/src/canvas/CropOverlay.d.ts +10 -0
- package/lib/typescript/src/canvas/CropOverlay.d.ts.map +1 -0
- package/lib/typescript/src/canvas/EditorCanvas.d.ts +18 -0
- package/lib/typescript/src/canvas/EditorCanvas.d.ts.map +1 -0
- package/lib/typescript/src/canvas/InFlightLayer.d.ts +12 -0
- package/lib/typescript/src/canvas/InFlightLayer.d.ts.map +1 -0
- package/lib/typescript/src/canvas/SelectionOverlay.d.ts +11 -0
- package/lib/typescript/src/canvas/SelectionOverlay.d.ts.map +1 -0
- package/lib/typescript/src/constants.d.ts +25 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/context/EditorContext.d.ts +66 -0
- package/lib/typescript/src/context/EditorContext.d.ts.map +1 -0
- package/lib/typescript/src/export/drawScene.d.ts +10 -0
- package/lib/typescript/src/export/drawScene.d.ts.map +1 -0
- package/lib/typescript/src/export/exportImage.d.ts +23 -0
- package/lib/typescript/src/export/exportImage.d.ts.map +1 -0
- package/lib/typescript/src/gestures/applyTransform.d.ts +17 -0
- package/lib/typescript/src/gestures/applyTransform.d.ts.map +1 -0
- package/lib/typescript/src/gestures/createAnnotation.d.ts +11 -0
- package/lib/typescript/src/gestures/createAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/gestures/handles.d.ts +17 -0
- package/lib/typescript/src/gestures/handles.d.ts.map +1 -0
- package/lib/typescript/src/gestures/hitTest.d.ts +9 -0
- package/lib/typescript/src/gestures/hitTest.d.ts.map +1 -0
- package/lib/typescript/src/gestures/useCropGesture.d.ts +7 -0
- package/lib/typescript/src/gestures/useCropGesture.d.ts.map +1 -0
- package/lib/typescript/src/gestures/useEditorGestures.d.ts +8 -0
- package/lib/typescript/src/gestures/useEditorGestures.d.ts.map +1 -0
- package/lib/typescript/src/image/disposeRegistry.d.ts +25 -0
- package/lib/typescript/src/image/disposeRegistry.d.ts.map +1 -0
- package/lib/typescript/src/image/useLoadedImage.d.ts +23 -0
- package/lib/typescript/src/image/useLoadedImage.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/state/history.d.ts +23 -0
- package/lib/typescript/src/state/history.d.ts.map +1 -0
- package/lib/typescript/src/state/selectors.d.ts +5 -0
- package/lib/typescript/src/state/selectors.d.ts.map +1 -0
- package/lib/typescript/src/state/useEditorReducer.d.ts +32 -0
- package/lib/typescript/src/state/useEditorReducer.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/ColorPicker.d.ts +7 -0
- package/lib/typescript/src/toolbar/ColorPicker.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/CropControls.d.ts +3 -0
- package/lib/typescript/src/toolbar/CropControls.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/RotationSlider.d.ts +8 -0
- package/lib/typescript/src/toolbar/RotationSlider.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/TextInputOverlay.d.ts +9 -0
- package/lib/typescript/src/toolbar/TextInputOverlay.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/ToolButton.d.ts +7 -0
- package/lib/typescript/src/toolbar/ToolButton.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/Toolbar.d.ts +4 -0
- package/lib/typescript/src/toolbar/Toolbar.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +170 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/color.d.ts +8 -0
- package/lib/typescript/src/utils/color.d.ts.map +1 -0
- package/lib/typescript/src/utils/id.d.ts +3 -0
- package/lib/typescript/src/utils/id.d.ts.map +1 -0
- package/lib/typescript/src/utils/math.d.ts +68 -0
- package/lib/typescript/src/utils/math.d.ts.map +1 -0
- package/package.json +90 -0
- package/src/ImageEditor.tsx +133 -0
- package/src/annotations/AnnotationView.tsx +24 -0
- package/src/annotations/ArrowAnnotation.tsx +26 -0
- package/src/annotations/CircleAnnotation.tsx +22 -0
- package/src/annotations/FreehandAnnotation.tsx +22 -0
- package/src/annotations/MarkerAnnotation.tsx +20 -0
- package/src/annotations/RotatedGroup.tsx +28 -0
- package/src/annotations/TextAnnotation.tsx +42 -0
- package/src/annotations/geometry.ts +62 -0
- package/src/annotations/geometryPure.ts +73 -0
- package/src/canvas/AnnotationLayer.tsx +43 -0
- package/src/canvas/BaseImageLayer.tsx +28 -0
- package/src/canvas/CropOverlay.tsx +92 -0
- package/src/canvas/EditorCanvas.tsx +70 -0
- package/src/canvas/InFlightLayer.tsx +140 -0
- package/src/canvas/SelectionOverlay.tsx +92 -0
- package/src/constants.ts +46 -0
- package/src/context/EditorContext.tsx +229 -0
- package/src/export/drawScene.ts +120 -0
- package/src/export/exportImage.ts +111 -0
- package/src/gestures/applyTransform.ts +76 -0
- package/src/gestures/createAnnotation.ts +92 -0
- package/src/gestures/handles.ts +50 -0
- package/src/gestures/hitTest.ts +79 -0
- package/src/gestures/useCropGesture.ts +123 -0
- package/src/gestures/useEditorGestures.ts +308 -0
- package/src/image/disposeRegistry.ts +59 -0
- package/src/image/useLoadedImage.ts +131 -0
- package/src/index.ts +32 -0
- package/src/state/history.ts +71 -0
- package/src/state/selectors.ts +16 -0
- package/src/state/useEditorReducer.ts +93 -0
- package/src/toolbar/ColorPicker.tsx +72 -0
- package/src/toolbar/CropControls.tsx +46 -0
- package/src/toolbar/RotationSlider.tsx +56 -0
- package/src/toolbar/TextInputOverlay.tsx +104 -0
- package/src/toolbar/ToolButton.tsx +46 -0
- package/src/toolbar/Toolbar.tsx +110 -0
- package/src/types.ts +203 -0
- package/src/utils/color.ts +34 -0
- package/src/utils/id.ts +7 -0
- package/src/utils/math.ts +222 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Public + internal types for the Skia image editor.
|
|
5
|
+
*
|
|
6
|
+
* COORDINATE-SPACE CONTRACT (read this first):
|
|
7
|
+
* Every annotation's geometry is stored in **image space** — the base image's
|
|
8
|
+
* full-resolution pixel coordinate system (0..imageWidth, 0..imageHeight).
|
|
9
|
+
* It is NEVER stored in screen space. A single `imageToScreen` affine matrix
|
|
10
|
+
* maps image space onto the on-screen canvas; its inverse maps touches back.
|
|
11
|
+
* Because of this, export can render the exact same numbers off-screen at native
|
|
12
|
+
* resolution with no rescaling. See `utils/math.ts`.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Colors are stored as CSS-style strings ("#RRGGBB" / "#RRGGBBAA" / named).
|
|
17
|
+
* Skia accepts these directly, and they are trivially serializable for history.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Non-destructive image transforms. Nothing is baked into pixels until export,
|
|
22
|
+
* so all of these are undoable.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export const IDENTITY_SCENE = {
|
|
26
|
+
rotation: 0,
|
|
27
|
+
scale: 1,
|
|
28
|
+
cropRect: null
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** The serializable editor document — everything undo/redo tracks. */
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Callback that persists an encoded image to disk. The library has no
|
|
35
|
+
* filesystem access of its own, so the consumer supplies this using whatever fs
|
|
36
|
+
* module they already have (react-native-fs, expo-file-system, etc.). It
|
|
37
|
+
* receives the destination path and the RAW base64 payload (no data-URI prefix).
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/** Imperative handle exposed via `ref`. */
|
|
41
|
+
|
|
42
|
+
/** Source image: a base64 string (raw or data-URI) or a file/remote URI. */
|
|
43
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["IDENTITY_SCENE","rotation","scale","cropRect"],"sourceRoot":"..\\..\\src","sources":["types.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA;AACA;AACA;AACA;;AAkEA;AACA;AACA;AACA;;AAUA,OAAO,MAAMA,cAA8B,GAAG;EAC5CC,QAAQ,EAAE,CAAC;EACXC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAE;AACZ,CAAC;;AAED;;AAQA;AACA;AACA;AACA;AACA;AACA;;AA4BA;;AAeA","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Apply an opacity (0..1) to a hex color string, returning an 8-digit hex
|
|
5
|
+
* ("#RRGGBBAA"). Used by the marker/highlighter which draws semi-transparently.
|
|
6
|
+
* Non-hex inputs (named colors, rgba(...)) are returned unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export function withOpacity(color, opacity) {
|
|
9
|
+
const clamped = Math.max(0, Math.min(1, opacity));
|
|
10
|
+
const hex = color.trim();
|
|
11
|
+
if (!hex.startsWith('#')) {
|
|
12
|
+
return hex;
|
|
13
|
+
}
|
|
14
|
+
let r;
|
|
15
|
+
let g;
|
|
16
|
+
let b;
|
|
17
|
+
if (hex.length === 4) {
|
|
18
|
+
// #RGB
|
|
19
|
+
r = hex[1] + hex[1];
|
|
20
|
+
g = hex[2] + hex[2];
|
|
21
|
+
b = hex[3] + hex[3];
|
|
22
|
+
} else if (hex.length === 7 || hex.length === 9) {
|
|
23
|
+
// #RRGGBB or #RRGGBBAA (ignore existing alpha)
|
|
24
|
+
r = hex.slice(1, 3);
|
|
25
|
+
g = hex.slice(3, 5);
|
|
26
|
+
b = hex.slice(5, 7);
|
|
27
|
+
} else {
|
|
28
|
+
return hex;
|
|
29
|
+
}
|
|
30
|
+
const a = Math.round(clamped * 255).toString(16).padStart(2, '0');
|
|
31
|
+
return `#${r}${g}${b}${a}`;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withOpacity","color","opacity","clamped","Math","max","min","hex","trim","startsWith","r","g","b","length","slice","a","round","toString","padStart"],"sourceRoot":"..\\..\\..\\src","sources":["utils/color.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,WAAWA,CAACC,KAAkB,EAAEC,OAAe,EAAe;EAC5E,MAAMC,OAAO,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,GAAG,CAAC,CAAC,EAAEJ,OAAO,CAAC,CAAC;EACjD,MAAMK,GAAG,GAAGN,KAAK,CAACO,IAAI,CAAC,CAAC;EACxB,IAAI,CAACD,GAAG,CAACE,UAAU,CAAC,GAAG,CAAC,EAAE;IACxB,OAAOF,GAAG;EACZ;EACA,IAAIG,CAAS;EACb,IAAIC,CAAS;EACb,IAAIC,CAAS;EACb,IAAIL,GAAG,CAACM,MAAM,KAAK,CAAC,EAAE;IACpB;IACAH,CAAC,GAAGH,GAAG,CAAC,CAAC,CAAC,GAAIA,GAAG,CAAC,CAAC,CAAE;IACrBI,CAAC,GAAGJ,GAAG,CAAC,CAAC,CAAC,GAAIA,GAAG,CAAC,CAAC,CAAE;IACrBK,CAAC,GAAGL,GAAG,CAAC,CAAC,CAAC,GAAIA,GAAG,CAAC,CAAC,CAAE;EACvB,CAAC,MAAM,IAAIA,GAAG,CAACM,MAAM,KAAK,CAAC,IAAIN,GAAG,CAACM,MAAM,KAAK,CAAC,EAAE;IAC/C;IACAH,CAAC,GAAGH,GAAG,CAACO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACnBH,CAAC,GAAGJ,GAAG,CAACO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACnBF,CAAC,GAAGL,GAAG,CAACO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;EACrB,CAAC,MAAM;IACL,OAAOP,GAAG;EACZ;EACA,MAAMQ,CAAC,GAAGX,IAAI,CAACY,KAAK,CAACb,OAAO,GAAG,GAAG,CAAC,CAChCc,QAAQ,CAAC,EAAE,CAAC,CACZC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EACnB,OAAO,IAAIR,CAAC,GAAGC,CAAC,GAAGC,CAAC,GAAGG,CAAC,EAAE;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
let counter = 0;
|
|
4
|
+
|
|
5
|
+
/** Small unique id generator (JS thread only — avoids a nanoid dependency). */
|
|
6
|
+
export function genId(prefix = 'a') {
|
|
7
|
+
counter += 1;
|
|
8
|
+
return `${prefix}_${Date.now().toString(36)}_${counter.toString(36)}`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["counter","genId","prefix","Date","now","toString"],"sourceRoot":"..\\..\\..\\src","sources":["utils/id.ts"],"mappings":";;AAAA,IAAIA,OAAO,GAAG,CAAC;;AAEf;AACA,OAAO,SAASC,KAAKA,CAACC,MAAM,GAAG,GAAG,EAAU;EAC1CF,OAAO,IAAI,CAAC;EACZ,OAAO,GAAGE,MAAM,IAAIC,IAAI,CAACC,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,IAAIL,OAAO,CAACK,QAAQ,CAAC,EAAE,CAAC,EAAE;AACvE","ignoreList":[]}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pure 2D affine-matrix math. Every function is marked `worklet` so it can run
|
|
5
|
+
* on the UI thread inside gesture handlers as well as on the JS thread.
|
|
6
|
+
*
|
|
7
|
+
* A matrix `Mat` maps a point p to p' via:
|
|
8
|
+
* x' = a*x + c*y + e
|
|
9
|
+
* y' = b*x + d*y + f
|
|
10
|
+
* (the canonical CSS/canvas affine convention).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export function identity() {
|
|
14
|
+
'worklet';
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
a: 1,
|
|
18
|
+
b: 0,
|
|
19
|
+
c: 0,
|
|
20
|
+
d: 1,
|
|
21
|
+
e: 0,
|
|
22
|
+
f: 0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Returns m1 ∘ m2 (applies m2 first, then m1). */
|
|
27
|
+
export function multiply(m1, m2) {
|
|
28
|
+
'worklet';
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
a: m1.a * m2.a + m1.c * m2.b,
|
|
32
|
+
b: m1.b * m2.a + m1.d * m2.b,
|
|
33
|
+
c: m1.a * m2.c + m1.c * m2.d,
|
|
34
|
+
d: m1.b * m2.c + m1.d * m2.d,
|
|
35
|
+
e: m1.a * m2.e + m1.c * m2.f + m1.e,
|
|
36
|
+
f: m1.b * m2.e + m1.d * m2.f + m1.f
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function translation(tx, ty) {
|
|
40
|
+
'worklet';
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
a: 1,
|
|
44
|
+
b: 0,
|
|
45
|
+
c: 0,
|
|
46
|
+
d: 1,
|
|
47
|
+
e: tx,
|
|
48
|
+
f: ty
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function scaling(sx, sy) {
|
|
52
|
+
'worklet';
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
a: sx,
|
|
56
|
+
b: 0,
|
|
57
|
+
c: 0,
|
|
58
|
+
d: sy,
|
|
59
|
+
e: 0,
|
|
60
|
+
f: 0
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function rotation(theta) {
|
|
64
|
+
'worklet';
|
|
65
|
+
|
|
66
|
+
const cos = Math.cos(theta);
|
|
67
|
+
const sin = Math.sin(theta);
|
|
68
|
+
return {
|
|
69
|
+
a: cos,
|
|
70
|
+
b: sin,
|
|
71
|
+
c: -sin,
|
|
72
|
+
d: cos,
|
|
73
|
+
e: 0,
|
|
74
|
+
f: 0
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function invert(m) {
|
|
78
|
+
'worklet';
|
|
79
|
+
|
|
80
|
+
const det = m.a * m.d - m.b * m.c;
|
|
81
|
+
if (det === 0) {
|
|
82
|
+
return identity();
|
|
83
|
+
}
|
|
84
|
+
const inv = 1 / det;
|
|
85
|
+
return {
|
|
86
|
+
a: m.d * inv,
|
|
87
|
+
b: -m.b * inv,
|
|
88
|
+
c: -m.c * inv,
|
|
89
|
+
d: m.a * inv,
|
|
90
|
+
e: (m.c * m.f - m.d * m.e) * inv,
|
|
91
|
+
f: (m.b * m.e - m.a * m.f) * inv
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export function applyToPoint(m, p) {
|
|
95
|
+
'worklet';
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
x: m.a * p.x + m.c * p.y + m.e,
|
|
99
|
+
y: m.b * p.x + m.d * p.y + m.f
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Rotate point `p` by `theta` radians about `center`. */
|
|
104
|
+
export function rotatePoint(p, center, theta) {
|
|
105
|
+
'worklet';
|
|
106
|
+
|
|
107
|
+
const cos = Math.cos(theta);
|
|
108
|
+
const sin = Math.sin(theta);
|
|
109
|
+
const dx = p.x - center.x;
|
|
110
|
+
const dy = p.y - center.y;
|
|
111
|
+
return {
|
|
112
|
+
x: center.x + dx * cos - dy * sin,
|
|
113
|
+
y: center.y + dx * sin + dy * cos
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The base fit scale used to "contain" the image inside the on-screen layout,
|
|
118
|
+
* before any user scene scale is applied.
|
|
119
|
+
*/
|
|
120
|
+
export function fitScale(image, layout) {
|
|
121
|
+
'worklet';
|
|
122
|
+
|
|
123
|
+
if (image.width <= 0 || image.height <= 0) {
|
|
124
|
+
return 1;
|
|
125
|
+
}
|
|
126
|
+
return Math.min(layout.width / image.width, layout.height / image.height);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Compose the image→screen matrix:
|
|
131
|
+
* M = T(center) · R(rotation) · S(fit·userScale) · T(-imageCenter)
|
|
132
|
+
*
|
|
133
|
+
* The on-screen Skia `<Group>` uses `sceneTransforms2d` (below), built from the
|
|
134
|
+
* SAME parameters, so the preview and this matrix stay in lock-step. Gestures
|
|
135
|
+
* use `invert(M)` to map screen touches back into image space.
|
|
136
|
+
*/
|
|
137
|
+
export function imageToScreenMatrix(scene, image, layout) {
|
|
138
|
+
'worklet';
|
|
139
|
+
|
|
140
|
+
const s = fitScale(image, layout) * scene.scale;
|
|
141
|
+
const cx = layout.width / 2;
|
|
142
|
+
const cy = layout.height / 2;
|
|
143
|
+
let m = translation(cx, cy);
|
|
144
|
+
m = multiply(m, rotation(scene.rotation));
|
|
145
|
+
m = multiply(m, scaling(s, s));
|
|
146
|
+
m = multiply(m, translation(-image.width / 2, -image.height / 2));
|
|
147
|
+
return m;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Skia `Transforms2d` array for the on-screen scene `<Group>`. Applied in order,
|
|
152
|
+
* this reproduces `imageToScreenMatrix` exactly.
|
|
153
|
+
*/
|
|
154
|
+
export function sceneTransforms2d(scene, image, layout) {
|
|
155
|
+
'worklet';
|
|
156
|
+
|
|
157
|
+
const s = fitScale(image, layout) * scene.scale;
|
|
158
|
+
return [{
|
|
159
|
+
translateX: layout.width / 2
|
|
160
|
+
}, {
|
|
161
|
+
translateY: layout.height / 2
|
|
162
|
+
}, {
|
|
163
|
+
rotate: scene.rotation
|
|
164
|
+
}, {
|
|
165
|
+
scaleX: s
|
|
166
|
+
}, {
|
|
167
|
+
scaleY: s
|
|
168
|
+
}, {
|
|
169
|
+
translateX: -image.width / 2
|
|
170
|
+
}, {
|
|
171
|
+
translateY: -image.height / 2
|
|
172
|
+
}];
|
|
173
|
+
}
|
|
174
|
+
export function clampSizeToMax(width, height, maxSize) {
|
|
175
|
+
'worklet';
|
|
176
|
+
|
|
177
|
+
if (!maxSize || maxSize <= 0) {
|
|
178
|
+
return {
|
|
179
|
+
width,
|
|
180
|
+
height
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const longest = Math.max(width, height);
|
|
184
|
+
if (longest <= maxSize) {
|
|
185
|
+
return {
|
|
186
|
+
width,
|
|
187
|
+
height
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const k = maxSize / longest;
|
|
191
|
+
return {
|
|
192
|
+
width: Math.round(width * k),
|
|
193
|
+
height: Math.round(height * k)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Axis-aligned bounding box of a set of points. */
|
|
198
|
+
export function boundsOfPoints(points) {
|
|
199
|
+
'worklet';
|
|
200
|
+
|
|
201
|
+
if (points.length === 0) {
|
|
202
|
+
return {
|
|
203
|
+
x: 0,
|
|
204
|
+
y: 0,
|
|
205
|
+
width: 0,
|
|
206
|
+
height: 0
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
let minX = points[0].x;
|
|
210
|
+
let minY = points[0].y;
|
|
211
|
+
let maxX = points[0].x;
|
|
212
|
+
let maxY = points[0].y;
|
|
213
|
+
for (let i = 1; i < points.length; i++) {
|
|
214
|
+
const p = points[i];
|
|
215
|
+
if (p.x < minX) minX = p.x;
|
|
216
|
+
if (p.y < minY) minY = p.y;
|
|
217
|
+
if (p.x > maxX) maxX = p.x;
|
|
218
|
+
if (p.y > maxY) maxY = p.y;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
x: minX,
|
|
222
|
+
y: minY,
|
|
223
|
+
width: maxX - minX,
|
|
224
|
+
height: maxY - minY
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
export function rectCenter(r) {
|
|
228
|
+
'worklet';
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
x: r.x + r.width / 2,
|
|
232
|
+
y: r.y + r.height / 2
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
export function distance(a, b) {
|
|
236
|
+
'worklet';
|
|
237
|
+
|
|
238
|
+
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Shortest distance from point `p` to segment `a`→`b`. */
|
|
242
|
+
export function distanceToSegment(p, a, b) {
|
|
243
|
+
'worklet';
|
|
244
|
+
|
|
245
|
+
const dx = b.x - a.x;
|
|
246
|
+
const dy = b.y - a.y;
|
|
247
|
+
const lenSq = dx * dx + dy * dy;
|
|
248
|
+
if (lenSq === 0) {
|
|
249
|
+
return distance(p, a);
|
|
250
|
+
}
|
|
251
|
+
let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq;
|
|
252
|
+
t = Math.max(0, Math.min(1, t));
|
|
253
|
+
return distance(p, {
|
|
254
|
+
x: a.x + t * dx,
|
|
255
|
+
y: a.y + t * dy
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["identity","a","b","c","d","e","f","multiply","m1","m2","translation","tx","ty","scaling","sx","sy","rotation","theta","cos","Math","sin","invert","m","det","inv","applyToPoint","p","x","y","rotatePoint","center","dx","dy","fitScale","image","layout","width","height","min","imageToScreenMatrix","scene","s","scale","cx","cy","sceneTransforms2d","translateX","translateY","rotate","scaleX","scaleY","clampSizeToMax","maxSize","longest","max","k","round","boundsOfPoints","points","length","minX","minY","maxX","maxY","i","rectCenter","r","distance","hypot","distanceToSegment","lenSq","t"],"sourceRoot":"..\\..\\..\\src","sources":["utils/math.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,SAASA,QAAQA,CAAA,EAAQ;EAC9B,SAAS;;EACT,OAAO;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC;AAC/C;;AAEA;AACA,OAAO,SAASC,QAAQA,CAACC,EAAO,EAAEC,EAAO,EAAO;EAC9C,SAAS;;EACT,OAAO;IACLR,CAAC,EAAEO,EAAE,CAACP,CAAC,GAAGQ,EAAE,CAACR,CAAC,GAAGO,EAAE,CAACL,CAAC,GAAGM,EAAE,CAACP,CAAC;IAC5BA,CAAC,EAAEM,EAAE,CAACN,CAAC,GAAGO,EAAE,CAACR,CAAC,GAAGO,EAAE,CAACJ,CAAC,GAAGK,EAAE,CAACP,CAAC;IAC5BC,CAAC,EAAEK,EAAE,CAACP,CAAC,GAAGQ,EAAE,CAACN,CAAC,GAAGK,EAAE,CAACL,CAAC,GAAGM,EAAE,CAACL,CAAC;IAC5BA,CAAC,EAAEI,EAAE,CAACN,CAAC,GAAGO,EAAE,CAACN,CAAC,GAAGK,EAAE,CAACJ,CAAC,GAAGK,EAAE,CAACL,CAAC;IAC5BC,CAAC,EAAEG,EAAE,CAACP,CAAC,GAAGQ,EAAE,CAACJ,CAAC,GAAGG,EAAE,CAACL,CAAC,GAAGM,EAAE,CAACH,CAAC,GAAGE,EAAE,CAACH,CAAC;IACnCC,CAAC,E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ACmC,GAAG,CAAC,CAAC,EAAEnC,IAAI,CAACmB,GAAG,CAAC,CAAC,EAAEiC,CAAC,CAAC,CAAC;EAC/B,OAAOJ,QAAQ,CAACzC,CAAC,EAAE;IAAEC,CAAC,EAAE1B,CAAC,CAAC0B,CAAC,GAAG4C,CAAC,GAAGxC,EAAE;IAAEH,CAAC,EAAE3B,CAAC,CAAC2B,CAAC,GAAG2C,CAAC,GAAGvC;EAAG,CAAC,CAAC;AAC1D","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImageEditorProps, ImageEditorRef } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Interactive Skia image editor. Loads a base64/URI image, lets the user draw
|
|
4
|
+
* circles/arrows/markers/freehand/text, crop, free-rotate and resize, then
|
|
5
|
+
* exports full-resolution base64 (via ref `export()` or the built-in Done
|
|
6
|
+
* button + `onExport`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const ImageEditor: import("react").ForwardRefExoticComponent<ImageEditorProps & import("react").RefAttributes<ImageEditorRef>>;
|
|
9
|
+
//# sourceMappingURL=ImageEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageEditor.d.ts","sourceRoot":"","sources":["../../../src/ImageEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQ/E;;;;;GAKG;AACH,eAAO,MAAM,WAAW,6GAwCvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationView.d.ts","sourceRoot":"","sources":["../../../../src/annotations/AnnotationView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAO3C,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE;IAAE,CAAC,EAAE,UAAU,CAAA;CAAE,sCAetD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrowAnnotation.d.ts","sourceRoot":"","sources":["../../../../src/annotations/ArrowAnnotation.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAKvE,wBAAgB,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE;IAAE,CAAC,EAAE,mBAAmB,CAAA;CAAE,+BAiBpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CircleAnnotation.d.ts","sourceRoot":"","sources":["../../../../src/annotations/CircleAnnotation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGzE,wBAAgB,oBAAoB,CAAC,EAAE,CAAC,EAAE,EAAE;IAAE,CAAC,EAAE,oBAAoB,CAAA;CAAE,+BAgBtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FreehandAnnotation.d.ts","sourceRoot":"","sources":["../../../../src/annotations/FreehandAnnotation.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,IAAI,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAI7E,wBAAgB,sBAAsB,CAAC,EAAE,CAAC,EAAE,EAAE;IAAE,CAAC,EAAE,sBAAsB,CAAA;CAAE,+BAc1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkerAnnotation.d.ts","sourceRoot":"","sources":["../../../../src/annotations/MarkerAnnotation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKzE,wBAAgB,oBAAoB,CAAC,EAAE,CAAC,EAAE,EAAE;IAAE,CAAC,EAAE,oBAAoB,CAAA;CAAE,+BAYtE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Vec2 } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps children in a Skia Group rotated by `rotation` radians about `center`.
|
|
5
|
+
* Every annotation renderer uses this so its stored `rotation` is applied
|
|
6
|
+
* consistently (and identically in the off-screen export path).
|
|
7
|
+
*/
|
|
8
|
+
export declare function RotatedGroup({ center, rotation, children, }: {
|
|
9
|
+
center: Vec2;
|
|
10
|
+
rotation: number;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
//# sourceMappingURL=RotatedGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RotatedGroup.d.ts","sourceRoot":"","sources":["../../../../src/annotations/RotatedGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,IAAI,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBASA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TextAnnotation as TextAnnotationType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Renders text using a system font via `matchFont` (no bundled font file
|
|
4
|
+
* required). Honors explicit newlines; automatic width-wrapping is intentionally
|
|
5
|
+
* out of scope for v1 (would require SkParagraph + a shared FontMgr).
|
|
6
|
+
*/
|
|
7
|
+
export declare function TextAnnotationView({ a }: {
|
|
8
|
+
a: TextAnnotationType;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=TextAnnotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAnnotation.d.ts","sourceRoot":"","sources":["../../../../src/annotations/TextAnnotation.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIrE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE;IAAE,CAAC,EAAE,kBAAkB,CAAA;CAAE,+BA6BlE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SkPath } from '@shopify/react-native-skia';
|
|
2
|
+
import type { Vec2 } from '../types';
|
|
3
|
+
export { annotationCenter, annotationBounds } from './geometryPure';
|
|
4
|
+
/**
|
|
5
|
+
* Build a Skia path for an arrow (shaft + two arrowhead barbs).
|
|
6
|
+
* Not a worklet — it allocates an `SkPath` (a Skia object) on the JS thread.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildArrowPath(start: Vec2, end: Vec2, headSize: number): SkPath;
|
|
9
|
+
/** Build a smoothed (quadratic) path through freehand points. */
|
|
10
|
+
export declare function buildFreehandPath(points: Vec2[]): SkPath;
|
|
11
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../src/annotations/geometry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIrC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,EACT,QAAQ,EAAE,MAAM,GACf,MAAM,CAoBR;AAED,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAqBxD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure annotation geometry (no Skia imports) so it is safe to use from worklets
|
|
3
|
+
* AND from plain unit tests without loading the native Skia module.
|
|
4
|
+
*/
|
|
5
|
+
import type { Annotation, Rect, Vec2 } from '../types';
|
|
6
|
+
/** Center of an annotation in image space (used as rotation/scale origin). */
|
|
7
|
+
export declare function annotationCenter(a: Annotation): Vec2;
|
|
8
|
+
/**
|
|
9
|
+
* Axis-aligned bounding box of an annotation in its LOCAL (unrotated) frame.
|
|
10
|
+
* The selection overlay rotates this box by `annotation.rotation` about the
|
|
11
|
+
* center when drawing handles.
|
|
12
|
+
*/
|
|
13
|
+
export declare function annotationBounds(a: Annotation): Rect;
|
|
14
|
+
//# sourceMappingURL=geometryPure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryPure.d.ts","sourceRoot":"","sources":["../../../../src/annotations/geometryPure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGvD,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAmBpD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAsCpD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EditorContextValue } from '../context/EditorContext';
|
|
2
|
+
/**
|
|
3
|
+
* Renders all committed annotations in paint order. The selected annotation is
|
|
4
|
+
* wrapped in a Group whose transform is driven by the `live` shared values, so
|
|
5
|
+
* move/resize/rotate previews run on the UI thread with zero React re-renders.
|
|
6
|
+
* When idle the live transform is identity, so this is a no-op visually.
|
|
7
|
+
*/
|
|
8
|
+
export declare function AnnotationLayer({ editor }: {
|
|
9
|
+
editor: EditorContextValue;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=AnnotationLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationLayer.d.ts","sourceRoot":"","sources":["../../../../src/canvas/AnnotationLayer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAInE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,+BA6BzE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SkImage } from '@shopify/react-native-skia';
|
|
2
|
+
import type { Size } from '../context/EditorContext';
|
|
3
|
+
/**
|
|
4
|
+
* Draws the base image in IMAGE space (x=0,y=0, native width/height). The parent
|
|
5
|
+
* scene `<Group>` maps it onto the screen, so this same layer renders identically
|
|
6
|
+
* off-screen at full resolution during export.
|
|
7
|
+
*/
|
|
8
|
+
export declare function BaseImageLayer({ image, size, }: {
|
|
9
|
+
image: SkImage;
|
|
10
|
+
size: Size;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=BaseImageLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseImageLayer.d.ts","sourceRoot":"","sources":["../../../../src/canvas/BaseImageLayer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;CACZ,+BAWA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EditorContextValue } from '../context/EditorContext';
|
|
2
|
+
/**
|
|
3
|
+
* Crop UI drawn in screen space: a dimmed full-screen scrim plus the crop
|
|
4
|
+
* rectangle's border and corner handles, which follow `cropRectSV` on the UI
|
|
5
|
+
* thread (works even when the scene is rotated, since the border is a quad).
|
|
6
|
+
*/
|
|
7
|
+
export declare function CropOverlay({ editor }: {
|
|
8
|
+
editor: EditorContextValue;
|
|
9
|
+
}): import("react").JSX.Element | null;
|
|
10
|
+
//# sourceMappingURL=CropOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CropOverlay.d.ts","sourceRoot":"","sources":["../../../../src/canvas/CropOverlay.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAKnE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,sCA6ErE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SkImage } from '@shopify/react-native-skia';
|
|
2
|
+
/**
|
|
3
|
+
* The Skia canvas host. Layers, under one scene `<Group>` transform:
|
|
4
|
+
* base image → committed annotations → in-flight draft
|
|
5
|
+
* plus screen-space overlays (selection handles, crop UI). A single composed
|
|
6
|
+
* gesture drives all editing.
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: React Context does NOT cross the Skia `<Canvas>` boundary — Skia
|
|
9
|
+
* renders Canvas children with its own reconciler, so a Provider mounted outside
|
|
10
|
+
* the Canvas is invisible inside it. Every Canvas child therefore receives the
|
|
11
|
+
* whole editor value via an `editor` PROP instead of calling `useEditor()`.
|
|
12
|
+
* Also, `<Canvas onLayout>` is unsupported on the New Architecture, so we measure
|
|
13
|
+
* on a wrapping `<View>`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function EditorCanvas({ image }: {
|
|
16
|
+
image: SkImage;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=EditorCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/EditorCanvas.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAa1D;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,+BAmCzD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EditorContextValue } from '../context/EditorContext';
|
|
2
|
+
/**
|
|
3
|
+
* Renders the shape currently being drawn, bound to the `draw` shared values so
|
|
4
|
+
* it updates on the UI thread. The active tool is fixed for the duration of a
|
|
5
|
+
* draw, so switching on it here is safe. Opacity is 0 when not drawing.
|
|
6
|
+
*
|
|
7
|
+
* Receives `editor` as a prop (context does not cross the Skia Canvas boundary).
|
|
8
|
+
*/
|
|
9
|
+
export declare function InFlightLayer({ editor }: {
|
|
10
|
+
editor: EditorContextValue;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=InFlightLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InFlightLayer.d.ts","sourceRoot":"","sources":["../../../../src/canvas/InFlightLayer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,+BAmBvE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorContextValue } from '../context/EditorContext';
|
|
3
|
+
/**
|
|
4
|
+
* Draws the selection bounding box + resize corners + rotate handle in SCREEN
|
|
5
|
+
* space (outside the scene transform, so handle size is zoom-independent). The
|
|
6
|
+
* overlay hides itself during an active live transform to avoid a stale double.
|
|
7
|
+
*/
|
|
8
|
+
export declare function SelectionOverlay({ editor }: {
|
|
9
|
+
editor: EditorContextValue;
|
|
10
|
+
}): React.JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=SelectionOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionOverlay.d.ts","sourceRoot":"","sources":["../../../../src/canvas/SelectionOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAWvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAOnE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,4BAoE1E"}
|