@pixerate/editor 0.81.0 → 0.82.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/dist/agent/index.cjs +36 -7
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +5 -3
- package/dist/agent/index.d.ts +5 -3
- package/dist/agent/index.js +43 -14
- package/dist/agent/index.js.map +1 -1
- package/dist/animation-editor/index.d.cts +1 -1
- package/dist/animation-editor/index.d.ts +1 -1
- package/dist/bridge/index.d.cts +3 -3
- package/dist/bridge/index.d.ts +3 -3
- package/dist/{bridge-client-C5dRjrz5.d.ts → bridge-client-CMGfnjTl.d.ts} +1 -1
- package/dist/{bridge-client-C5OziCRK.d.cts → bridge-client-VpnICVxP.d.cts} +1 -1
- package/dist/canvas/index.cjs +235 -104
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +59 -1
- package/dist/canvas/index.d.ts +59 -1
- package/dist/canvas/index.js +234 -103
- package/dist/canvas/index.js.map +1 -1
- package/dist/capture-DFEMFmVt.d.cts +133 -0
- package/dist/capture-wwNGaW05.d.ts +133 -0
- package/dist/chart/index.d.cts +1 -1
- package/dist/chart/index.d.ts +1 -1
- package/dist/{chunk-K73CKYUM.cjs → chunk-EI2MOVQ3.cjs} +198 -3
- package/dist/chunk-EI2MOVQ3.cjs.map +1 -0
- package/dist/chunk-FURT6ZFZ.cjs +1 -0
- package/dist/chunk-FURT6ZFZ.cjs.map +1 -0
- package/dist/{chunk-GPWNYQ7R.js → chunk-O2W2SP3C.js} +197 -2
- package/dist/chunk-O2W2SP3C.js.map +1 -0
- package/dist/chunk-REOJJIY3.js +201 -0
- package/dist/chunk-REOJJIY3.js.map +1 -0
- package/dist/chunk-RJ2BFKEN.js +1 -0
- package/dist/chunk-RJ2BFKEN.js.map +1 -0
- package/dist/chunk-VJUVNERT.cjs +201 -0
- package/dist/chunk-VJUVNERT.cjs.map +1 -0
- package/dist/commands/index.d.cts +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/diagram/index.d.cts +1 -1
- package/dist/diagram/index.d.ts +1 -1
- package/dist/dom-capture-7Wvf6Tyg.d.ts +59 -0
- package/dist/dom-capture-GyYuE-zq.d.cts +59 -0
- package/dist/generation/index.d.cts +2 -2
- package/dist/generation/index.d.ts +2 -2
- package/dist/image-editor/index.cjs +97 -1
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +24 -2
- package/dist/image-editor/index.d.ts +24 -2
- package/dist/image-editor/index.js +96 -0
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{registry-DIpIaCkH.d.cts → registry-BqA1AZt0.d.cts} +1 -1
- package/dist/{registry-7AZFuand.d.ts → registry-D-4fit9C.d.ts} +1 -1
- package/dist/tools/index.cjs +33 -4
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.cts +4 -2
- package/dist/tools/index.d.ts +4 -2
- package/dist/tools/index.js +43 -14
- package/dist/video-editor/index.d.cts +1 -1
- package/dist/video-editor/index.d.ts +1 -1
- package/package.json +1 -1
- package/skills/pixerate-canvas/SKILL.md +1 -0
- package/skills/pixerate-image-editor/SKILL.md +1 -0
- package/dist/chunk-GPWNYQ7R.js.map +0 -1
- package/dist/chunk-K73CKYUM.cjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { b as LoadReport, J as JsonObject, f as MigrationStep } from '../migrate-iTlm3a8h.cjs';
|
|
2
|
-
import {
|
|
2
|
+
import { a as AgentToolProvider, A as AgentTool } from '../registry-BqA1AZt0.cjs';
|
|
3
|
+
import { b as CaptureSurface } from '../capture-DFEMFmVt.cjs';
|
|
3
4
|
import '../schema-Di0CS6Pe.cjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -1330,6 +1331,16 @@ declare class ImageEditorController {
|
|
|
1330
1331
|
setComparing(comparing: boolean): void;
|
|
1331
1332
|
render(targetCanvas: HTMLCanvasElement, options?: RenderOptions): Promise<void>;
|
|
1332
1333
|
renderExport(options?: ExportOptions): Promise<HTMLCanvasElement>;
|
|
1334
|
+
/**
|
|
1335
|
+
* Renders the edited image (adjustments, layers and, by default, annotations) in the
|
|
1336
|
+
* source image's own orientation and frame, ignoring crop, rotation and flips, so it lines
|
|
1337
|
+
* up with natural-pixel coordinates (selections, `select_region`). `scale` ≤ 1 shrinks it.
|
|
1338
|
+
* Returns `null` when no image is loaded.
|
|
1339
|
+
*/
|
|
1340
|
+
renderSourceView(options?: {
|
|
1341
|
+
scale?: number;
|
|
1342
|
+
includeAnnotations?: boolean;
|
|
1343
|
+
}): Promise<HTMLCanvasElement | null>;
|
|
1333
1344
|
toDataURL(options?: ExportOptions): Promise<string>;
|
|
1334
1345
|
toBlob(options?: ExportOptions): Promise<Blob>;
|
|
1335
1346
|
renderMask(options?: {
|
|
@@ -1638,6 +1649,8 @@ interface ImageEditorToolProviderOptions {
|
|
|
1638
1649
|
* control ranges and the applied values are echoed.
|
|
1639
1650
|
* - `add_adjustment_layer {kind, params?, opacity?, blend?, name?}`.
|
|
1640
1651
|
* - `render_preview {maxSide}`: the rendered image as a PNG, longest side at most `maxSide`.
|
|
1652
|
+
* - `capture_view {region, rect?, ...}`: a screenshot of the whole image, the selection or a rect in
|
|
1653
|
+
* natural pixels (up to 8× for close inspection), optionally with the selection shaded.
|
|
1641
1654
|
* - Selections and masks: `get_selection`, `select_region`, `select_by_color`, `modify_selection`,
|
|
1642
1655
|
* `refine_selection`, `apply_selection_as_mask` (see `createImageSelectionTools`).
|
|
1643
1656
|
* - Layers, geometry and history: `get_image_info`, `get_histogram`, `update_adjustment_layer`,
|
|
@@ -1820,4 +1833,13 @@ declare function applyRegionMosaic<T extends MosaicImageDataLike>(imageData: T,
|
|
|
1820
1833
|
*/
|
|
1821
1834
|
declare function applyRegionBlur<T extends MosaicImageDataLike>(imageData: T, regions: MosaicRegion[], radius?: number): T;
|
|
1822
1835
|
|
|
1823
|
-
|
|
1836
|
+
/**
|
|
1837
|
+
* The image editor as a capture surface. Units are natural pixels of the source image,
|
|
1838
|
+
* the same space as `get_selection` and `select_region`: crop, rotation and flips are not
|
|
1839
|
+
* applied (use `render_preview` for the final framing), adjustments, layers and annotations
|
|
1840
|
+
* are. Regions: the whole image, the selection's bounds, or a rect. Small regions are
|
|
1841
|
+
* enlarged up to 8× with hard pixel edges for close inspection.
|
|
1842
|
+
*/
|
|
1843
|
+
declare function createImageCaptureSurface(controller: ImageEditorController): CaptureSurface;
|
|
1844
|
+
|
|
1845
|
+
export { ADJUSTMENT_KINDS, ADJUSTMENT_LAYER_CONTROLS, ADJUSTMENT_LAYER_OPACITY_CONTROL, ADJUSTMENT_LUT_SIZE, AS_SHOT_KELVIN, type AdjustmentKind, type AdjustmentKindInfo, type AdjustmentLayer, type AdjustmentLayerBase, type AdjustmentLayerInit, type AdjustmentLayerMask, type AdjustmentLayerOf, type AdjustmentLayerUpdate, type AdjustmentParamsMap, type Annotation, type AnnotationType, type ArrowAnnotation, type AspectRatio, BLEND_MODES, type BaseAnnotation, type BlackWhiteParams, type BlendMode, type BlendModeInfo, type Chromaticity, type CircleAnnotation, type ColorBalanceParams, type ColorBalanceTone, type ColorDistance, type ColorRangeOptions, type ColorRangeSample, type ControlSection, type ControlSpec, type ControlTrack, type CreateAnnotationPayload, type CropBox, type CropHandle, type CurvePoint, type CurvesParams, D65, DEFAULT_ADJUSTMENTS, DEFAULT_DEPTH_MASK, DEFAULT_REFINE_EDGE_PARAMS, DEFAULT_SELECTION_TOOL_OPTIONS, DEFAULT_TRANSFORM, DIRECT_GAUSSIAN_MAX_SIGMA, type DepthMaskOptions, EMPTY_DISTANCE, type ExportOptions, GUIDED_FILTER_EPS, type GestureModifiers, HISTOGRAM_BINS, HUE_RANGE_LABELS, type HistogramChannel, type HueRange, type HueSaturationParams, IDENTITY_MATRIX3, IMAGE_ADJUSTMENT_CONTROLS, IMAGE_EDITOR_SCHEMA_VERSION, IMAGE_EDITOR_STATE_VERSION, type ImageAdjustments, type ImageAnnotation, type ImageDimensions, type ImageEditorAIHooks, ImageEditorController, type ImageEditorDocumentLoad, type ImageEditorOptions, ImageEditorRenderer, type ImageEditorState, type ImageEditorTool, type ImageEditorToolProviderOptions, type ImageHistogram, type ImagePoint, type ImageProcessVersion, type ImageProjection, type ImageTransform, type InpaintHook, type InpaintOptions, type InvertParams, LATEST_PROCESS_VERSION, LEGACY_PROCESS_VERSION, LUMA_709, type LayerMaskProps, type LevelsChannel, type LevelsParams, type LineAnnotation, MAX_KELVIN, MIN_KELVIN, MIRED_PER_TEMPERATURE_UNIT, type MagicWandOptions, type Matrix3, type MosaicImageDataLike, type MosaicRegion, type PenAnnotation, type PhotoFilterParams, type PixelBuffer, type PixelOp, type PosterizeParams, type QuickMaskStyle, REFINE_EDGE_CONTROLS, type RectAnnotation, type RefineEdgeControl, type RefineEdgeParams, type RemoveBackgroundHook, type RemoveBackgroundOptions, type RenderOptions, type Rgb$1 as Rgb, type Rgba, SELECTION_MODES, SELECTION_MODE_LABELS, SELECTION_MODIFY_OPS, SELECTION_TOOLS, type SampleOptions, type SelectionChannel, type SelectionCommandOptions, SelectionGesture, type SelectionMask, type SelectionMode, type SelectionModifyOp, type SelectionToolKind, type SelectionToolOptions, type SerializedImageEditorState, type SerializedSelection, type ShapeSelectionOptions, TINT_SCALE, TONE_LUT_SIZE, TONE_RANGE_PRESETS, type TextAnnotation, type ThresholdParams, type ToneRangePreset, type UnitLevels, VIBRANCE_GREY, type VibranceParams, type ViewportMetrics, activeAdjustmentLayers, adjustmentKindLabel, adjustmentLayersKey, applyAdjustmentLayers, applyAdjustments, applyDepthMask, applyImageProjectionToContext, applyLegacyAdjustments, applyMatrix3, applyProcess2Adjustments, applyRegionBlur, applyRegionMosaic, blackWhiteGray, blendChannel, blendImageData, blendLum, blendPixel, blendRgb, borderCoverage, boxMean, boxToCurvePoint, bradfordAdaptation, buildLayerMaskPlanes, buildToneLut, calculateCropDrag, canvasCompositeOperation, canvasToImagePoint, clampControlValue, clampCropToImage, colorBalanceChannel, colorRange, combineSelections, compileAdjustmentLayer, computeHistogram, computeSelectionBounds, contractCoverage, controlPosition, controlTrackBackground, coverageToByte, createAdjustmentLayer, createImageCaptureSurface, createImageEditTools, createImageEditorToolProvider, createImageSelectionTools, createSelectionMask, curveLut, curveLutFromLevels, curvePointToBox, curveSvgPath, decodeLayerMask, decodeSelectionRle, defaultAdjustmentParams, describeSelection, deserializeSelection, distanceTransform, edgeWidth, ellipsePoints, ellipseSelection, encodeSelectionRle, evaluateAdjustmentLayers, expandCoverage, featherCoverage, findAdjustmentControl, findLayerControl, formatControlValue, fullSelection, gaussianBlur, getAnnotationBounds, getControlPath, getCropCursor, getRotatedSize, getViewportMetrics, getViewportProjection, globalImageCache, greyMorphology, guidePlanes, guidedFilterColor, hashMaskContent, hexToRgb, histogramPath, hitTestAnnotation, hitTestCrop, hitTestCurvePoint, hslToRgb, hueRange, hueRangeTables, hueRangeWeight, hueSaturation, identityCurve, identityLevels, imageEditorStateMigrations, imageToCanvasPoint, insertCurvePoint, invertMatrix3, invertSelection, isAdjustmentKind, isBlendMode, isQuarterTurnSwapped, isSelectionEmpty, isSelectionMode, isSeparableBlendMode, kelvinToTemperature, layerMaskCoverage, layerMaskFromSelection, layerMaskKey, levelsValue, linearSrgbToXy, linearToSrgb, loadImageEditorDocument, magicWand, mapCropHandle, migrateSerializedImageEditorState, modifySelection, moveCurvePoint, mulMatrix3, neutralHueRange, normalizeAdjustmentLayer, normalizeAdjustmentLayers, normalizeAngle, normalizeBlendMode, normalizeLayerMask, normalizeProcessVersion, normalizeRect, normalizeRefineEdgeParams, normalizeStoredAdjustments, parseSelectionMode, photoFilterMatrix, polygonCoverage, polygonSelection, posterizeValue, projectImagePoint, projectImageRect, projectMaskCoverage, quickMaskPixels, rangeLightness, readAdjustmentControls, rectSelection, refineCoverage, refineEdgeHalo, refineSelection, removeAlpha, removeCurvePoint, resizeSelection, resolveMosaicRegionBounds, rgbToGray, rgbToHsl, sampleLut, sampleToneLut, selectionArea, selectionFromCoverage, selectionFromPixels, selectionModeFromModifiers, selectionOutline, selectionToCoverage, selectionToPixels, selectionValueAt, serializeSelection, setControlPath, setLum, shiftCoverage, smoothCoverage, srgb8ToLab, srgbToLinear, tempTintToXy, temperatureToKelvin, toneCurve, toneLuts, toneRange, unprojectCanvasPoint, updateLayerMaskProps, uvToXy, vibranceLinear, vibrancePixel, wbMatrix, whiteBalanceFromSample, whiteBalanceMatrix, xyToTempTint, xyToUv };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { b as LoadReport, J as JsonObject, f as MigrationStep } from '../migrate-iTlm3a8h.js';
|
|
2
|
-
import {
|
|
2
|
+
import { a as AgentToolProvider, A as AgentTool } from '../registry-D-4fit9C.js';
|
|
3
|
+
import { b as CaptureSurface } from '../capture-wwNGaW05.js';
|
|
3
4
|
import '../schema-Di0CS6Pe.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -1330,6 +1331,16 @@ declare class ImageEditorController {
|
|
|
1330
1331
|
setComparing(comparing: boolean): void;
|
|
1331
1332
|
render(targetCanvas: HTMLCanvasElement, options?: RenderOptions): Promise<void>;
|
|
1332
1333
|
renderExport(options?: ExportOptions): Promise<HTMLCanvasElement>;
|
|
1334
|
+
/**
|
|
1335
|
+
* Renders the edited image (adjustments, layers and, by default, annotations) in the
|
|
1336
|
+
* source image's own orientation and frame, ignoring crop, rotation and flips, so it lines
|
|
1337
|
+
* up with natural-pixel coordinates (selections, `select_region`). `scale` ≤ 1 shrinks it.
|
|
1338
|
+
* Returns `null` when no image is loaded.
|
|
1339
|
+
*/
|
|
1340
|
+
renderSourceView(options?: {
|
|
1341
|
+
scale?: number;
|
|
1342
|
+
includeAnnotations?: boolean;
|
|
1343
|
+
}): Promise<HTMLCanvasElement | null>;
|
|
1333
1344
|
toDataURL(options?: ExportOptions): Promise<string>;
|
|
1334
1345
|
toBlob(options?: ExportOptions): Promise<Blob>;
|
|
1335
1346
|
renderMask(options?: {
|
|
@@ -1638,6 +1649,8 @@ interface ImageEditorToolProviderOptions {
|
|
|
1638
1649
|
* control ranges and the applied values are echoed.
|
|
1639
1650
|
* - `add_adjustment_layer {kind, params?, opacity?, blend?, name?}`.
|
|
1640
1651
|
* - `render_preview {maxSide}`: the rendered image as a PNG, longest side at most `maxSide`.
|
|
1652
|
+
* - `capture_view {region, rect?, ...}`: a screenshot of the whole image, the selection or a rect in
|
|
1653
|
+
* natural pixels (up to 8× for close inspection), optionally with the selection shaded.
|
|
1641
1654
|
* - Selections and masks: `get_selection`, `select_region`, `select_by_color`, `modify_selection`,
|
|
1642
1655
|
* `refine_selection`, `apply_selection_as_mask` (see `createImageSelectionTools`).
|
|
1643
1656
|
* - Layers, geometry and history: `get_image_info`, `get_histogram`, `update_adjustment_layer`,
|
|
@@ -1820,4 +1833,13 @@ declare function applyRegionMosaic<T extends MosaicImageDataLike>(imageData: T,
|
|
|
1820
1833
|
*/
|
|
1821
1834
|
declare function applyRegionBlur<T extends MosaicImageDataLike>(imageData: T, regions: MosaicRegion[], radius?: number): T;
|
|
1822
1835
|
|
|
1823
|
-
|
|
1836
|
+
/**
|
|
1837
|
+
* The image editor as a capture surface. Units are natural pixels of the source image,
|
|
1838
|
+
* the same space as `get_selection` and `select_region`: crop, rotation and flips are not
|
|
1839
|
+
* applied (use `render_preview` for the final framing), adjustments, layers and annotations
|
|
1840
|
+
* are. Regions: the whole image, the selection's bounds, or a rect. Small regions are
|
|
1841
|
+
* enlarged up to 8× with hard pixel edges for close inspection.
|
|
1842
|
+
*/
|
|
1843
|
+
declare function createImageCaptureSurface(controller: ImageEditorController): CaptureSurface;
|
|
1844
|
+
|
|
1845
|
+
export { ADJUSTMENT_KINDS, ADJUSTMENT_LAYER_CONTROLS, ADJUSTMENT_LAYER_OPACITY_CONTROL, ADJUSTMENT_LUT_SIZE, AS_SHOT_KELVIN, type AdjustmentKind, type AdjustmentKindInfo, type AdjustmentLayer, type AdjustmentLayerBase, type AdjustmentLayerInit, type AdjustmentLayerMask, type AdjustmentLayerOf, type AdjustmentLayerUpdate, type AdjustmentParamsMap, type Annotation, type AnnotationType, type ArrowAnnotation, type AspectRatio, BLEND_MODES, type BaseAnnotation, type BlackWhiteParams, type BlendMode, type BlendModeInfo, type Chromaticity, type CircleAnnotation, type ColorBalanceParams, type ColorBalanceTone, type ColorDistance, type ColorRangeOptions, type ColorRangeSample, type ControlSection, type ControlSpec, type ControlTrack, type CreateAnnotationPayload, type CropBox, type CropHandle, type CurvePoint, type CurvesParams, D65, DEFAULT_ADJUSTMENTS, DEFAULT_DEPTH_MASK, DEFAULT_REFINE_EDGE_PARAMS, DEFAULT_SELECTION_TOOL_OPTIONS, DEFAULT_TRANSFORM, DIRECT_GAUSSIAN_MAX_SIGMA, type DepthMaskOptions, EMPTY_DISTANCE, type ExportOptions, GUIDED_FILTER_EPS, type GestureModifiers, HISTOGRAM_BINS, HUE_RANGE_LABELS, type HistogramChannel, type HueRange, type HueSaturationParams, IDENTITY_MATRIX3, IMAGE_ADJUSTMENT_CONTROLS, IMAGE_EDITOR_SCHEMA_VERSION, IMAGE_EDITOR_STATE_VERSION, type ImageAdjustments, type ImageAnnotation, type ImageDimensions, type ImageEditorAIHooks, ImageEditorController, type ImageEditorDocumentLoad, type ImageEditorOptions, ImageEditorRenderer, type ImageEditorState, type ImageEditorTool, type ImageEditorToolProviderOptions, type ImageHistogram, type ImagePoint, type ImageProcessVersion, type ImageProjection, type ImageTransform, type InpaintHook, type InpaintOptions, type InvertParams, LATEST_PROCESS_VERSION, LEGACY_PROCESS_VERSION, LUMA_709, type LayerMaskProps, type LevelsChannel, type LevelsParams, type LineAnnotation, MAX_KELVIN, MIN_KELVIN, MIRED_PER_TEMPERATURE_UNIT, type MagicWandOptions, type Matrix3, type MosaicImageDataLike, type MosaicRegion, type PenAnnotation, type PhotoFilterParams, type PixelBuffer, type PixelOp, type PosterizeParams, type QuickMaskStyle, REFINE_EDGE_CONTROLS, type RectAnnotation, type RefineEdgeControl, type RefineEdgeParams, type RemoveBackgroundHook, type RemoveBackgroundOptions, type RenderOptions, type Rgb$1 as Rgb, type Rgba, SELECTION_MODES, SELECTION_MODE_LABELS, SELECTION_MODIFY_OPS, SELECTION_TOOLS, type SampleOptions, type SelectionChannel, type SelectionCommandOptions, SelectionGesture, type SelectionMask, type SelectionMode, type SelectionModifyOp, type SelectionToolKind, type SelectionToolOptions, type SerializedImageEditorState, type SerializedSelection, type ShapeSelectionOptions, TINT_SCALE, TONE_LUT_SIZE, TONE_RANGE_PRESETS, type TextAnnotation, type ThresholdParams, type ToneRangePreset, type UnitLevels, VIBRANCE_GREY, type VibranceParams, type ViewportMetrics, activeAdjustmentLayers, adjustmentKindLabel, adjustmentLayersKey, applyAdjustmentLayers, applyAdjustments, applyDepthMask, applyImageProjectionToContext, applyLegacyAdjustments, applyMatrix3, applyProcess2Adjustments, applyRegionBlur, applyRegionMosaic, blackWhiteGray, blendChannel, blendImageData, blendLum, blendPixel, blendRgb, borderCoverage, boxMean, boxToCurvePoint, bradfordAdaptation, buildLayerMaskPlanes, buildToneLut, calculateCropDrag, canvasCompositeOperation, canvasToImagePoint, clampControlValue, clampCropToImage, colorBalanceChannel, colorRange, combineSelections, compileAdjustmentLayer, computeHistogram, computeSelectionBounds, contractCoverage, controlPosition, controlTrackBackground, coverageToByte, createAdjustmentLayer, createImageCaptureSurface, createImageEditTools, createImageEditorToolProvider, createImageSelectionTools, createSelectionMask, curveLut, curveLutFromLevels, curvePointToBox, curveSvgPath, decodeLayerMask, decodeSelectionRle, defaultAdjustmentParams, describeSelection, deserializeSelection, distanceTransform, edgeWidth, ellipsePoints, ellipseSelection, encodeSelectionRle, evaluateAdjustmentLayers, expandCoverage, featherCoverage, findAdjustmentControl, findLayerControl, formatControlValue, fullSelection, gaussianBlur, getAnnotationBounds, getControlPath, getCropCursor, getRotatedSize, getViewportMetrics, getViewportProjection, globalImageCache, greyMorphology, guidePlanes, guidedFilterColor, hashMaskContent, hexToRgb, histogramPath, hitTestAnnotation, hitTestCrop, hitTestCurvePoint, hslToRgb, hueRange, hueRangeTables, hueRangeWeight, hueSaturation, identityCurve, identityLevels, imageEditorStateMigrations, imageToCanvasPoint, insertCurvePoint, invertMatrix3, invertSelection, isAdjustmentKind, isBlendMode, isQuarterTurnSwapped, isSelectionEmpty, isSelectionMode, isSeparableBlendMode, kelvinToTemperature, layerMaskCoverage, layerMaskFromSelection, layerMaskKey, levelsValue, linearSrgbToXy, linearToSrgb, loadImageEditorDocument, magicWand, mapCropHandle, migrateSerializedImageEditorState, modifySelection, moveCurvePoint, mulMatrix3, neutralHueRange, normalizeAdjustmentLayer, normalizeAdjustmentLayers, normalizeAngle, normalizeBlendMode, normalizeLayerMask, normalizeProcessVersion, normalizeRect, normalizeRefineEdgeParams, normalizeStoredAdjustments, parseSelectionMode, photoFilterMatrix, polygonCoverage, polygonSelection, posterizeValue, projectImagePoint, projectImageRect, projectMaskCoverage, quickMaskPixels, rangeLightness, readAdjustmentControls, rectSelection, refineCoverage, refineEdgeHalo, refineSelection, removeAlpha, removeCurvePoint, resizeSelection, resolveMosaicRegionBounds, rgbToGray, rgbToHsl, sampleLut, sampleToneLut, selectionArea, selectionFromCoverage, selectionFromPixels, selectionModeFromModifiers, selectionOutline, selectionToCoverage, selectionToPixels, selectionValueAt, serializeSelection, setControlPath, setLum, shiftCoverage, smoothCoverage, srgb8ToLab, srgbToLinear, tempTintToXy, temperatureToKelvin, toneCurve, toneLuts, toneRange, unprojectCanvasPoint, updateLayerMaskProps, uvToXy, vibranceLinear, vibrancePixel, wbMatrix, whiteBalanceFromSample, whiteBalanceMatrix, xyToTempTint, xyToUv };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCaptureTool
|
|
3
|
+
} from "../chunk-REOJJIY3.js";
|
|
1
4
|
import {
|
|
2
5
|
loadDocument
|
|
3
6
|
} from "../chunk-U5HZSFCS.js";
|
|
@@ -4610,6 +4613,27 @@ var ImageEditorController = class {
|
|
|
4610
4613
|
}
|
|
4611
4614
|
return this.renderer.renderExport(source, this.state, options);
|
|
4612
4615
|
}
|
|
4616
|
+
/**
|
|
4617
|
+
* Renders the edited image (adjustments, layers and, by default, annotations) in the
|
|
4618
|
+
* source image's own orientation and frame, ignoring crop, rotation and flips, so it lines
|
|
4619
|
+
* up with natural-pixel coordinates (selections, `select_region`). `scale` ≤ 1 shrinks it.
|
|
4620
|
+
* Returns `null` when no image is loaded.
|
|
4621
|
+
*/
|
|
4622
|
+
async renderSourceView(options = {}) {
|
|
4623
|
+
const source = this.imageElement || this.state.sourceUrl;
|
|
4624
|
+
if (!source) return null;
|
|
4625
|
+
const { width, height } = this.state.imageDimensions;
|
|
4626
|
+
const k = Math.min(1, Math.max(0, options.scale ?? 1));
|
|
4627
|
+
return this.renderer.renderExport(
|
|
4628
|
+
source,
|
|
4629
|
+
{ ...this.state, crop: null, transform: { rotate: 0, flipH: false, flipV: false } },
|
|
4630
|
+
{
|
|
4631
|
+
width: Math.max(1, Math.round(width * k)),
|
|
4632
|
+
height: Math.max(1, Math.round(height * k)),
|
|
4633
|
+
includeAnnotations: options.includeAnnotations
|
|
4634
|
+
}
|
|
4635
|
+
);
|
|
4636
|
+
}
|
|
4613
4637
|
async toDataURL(options = {}) {
|
|
4614
4638
|
const canvas = await this.renderExport(options);
|
|
4615
4639
|
const format = options.format || "image/png";
|
|
@@ -5357,6 +5381,76 @@ function createImageSelectionTools(controller) {
|
|
|
5357
5381
|
return [getSelection, selectRegion, selectByColor, modify, refine, applyMask];
|
|
5358
5382
|
}
|
|
5359
5383
|
|
|
5384
|
+
// src/image-editor/capture.ts
|
|
5385
|
+
var NO_CANVAS = "Rendering is not available in this environment.";
|
|
5386
|
+
function selectionShade(selection, doc) {
|
|
5387
|
+
const canvas = doc.createElement("canvas");
|
|
5388
|
+
canvas.width = selection.width;
|
|
5389
|
+
canvas.height = selection.height;
|
|
5390
|
+
const context = canvas.getContext("2d");
|
|
5391
|
+
if (!context) return null;
|
|
5392
|
+
const pixels = context.createImageData(selection.width, selection.height);
|
|
5393
|
+
for (let i = 0; i < selection.data.length; i++) {
|
|
5394
|
+
pixels.data[i * 4 + 3] = Math.round(150 * (1 - selection.data[i] / 255));
|
|
5395
|
+
}
|
|
5396
|
+
context.putImageData(pixels, 0, 0);
|
|
5397
|
+
return canvas;
|
|
5398
|
+
}
|
|
5399
|
+
async function renderImageRegion(controller, request) {
|
|
5400
|
+
const state = controller.getState();
|
|
5401
|
+
const k = Math.min(1, request.scale);
|
|
5402
|
+
const view = await controller.renderSourceView({ scale: k });
|
|
5403
|
+
if (!view) throw new Error("No image is loaded, so there is nothing to capture.");
|
|
5404
|
+
if (typeof document === "undefined") throw new Error(NO_CANVAS);
|
|
5405
|
+
const out = document.createElement("canvas");
|
|
5406
|
+
out.width = request.width;
|
|
5407
|
+
out.height = request.height;
|
|
5408
|
+
const context = out.getContext("2d");
|
|
5409
|
+
if (!context) throw new Error(NO_CANVAS);
|
|
5410
|
+
const { rect } = request;
|
|
5411
|
+
context.imageSmoothingEnabled = request.scale < 1;
|
|
5412
|
+
if (request.format === "jpeg") {
|
|
5413
|
+
context.fillStyle = "#ffffff";
|
|
5414
|
+
context.fillRect(0, 0, out.width, out.height);
|
|
5415
|
+
}
|
|
5416
|
+
const kx = view.width / state.imageDimensions.width;
|
|
5417
|
+
const ky = view.height / state.imageDimensions.height;
|
|
5418
|
+
context.drawImage(view, rect.x * kx, rect.y * ky, rect.width * kx, rect.height * ky, 0, 0, out.width, out.height);
|
|
5419
|
+
if (request.includeOverlays) {
|
|
5420
|
+
const s = request.scale;
|
|
5421
|
+
const selection = state.selection;
|
|
5422
|
+
if (selection?.bounds && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
|
|
5423
|
+
const shade = selectionShade(selection, document);
|
|
5424
|
+
if (shade) context.drawImage(shade, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
|
|
5425
|
+
}
|
|
5426
|
+
if (state.crop) {
|
|
5427
|
+
context.save();
|
|
5428
|
+
context.strokeStyle = "#ffd400";
|
|
5429
|
+
context.lineWidth = 2;
|
|
5430
|
+
context.setLineDash([6, 4]);
|
|
5431
|
+
context.strokeRect((state.crop.x - rect.x) * s, (state.crop.y - rect.y) * s, state.crop.width * s, state.crop.height * s);
|
|
5432
|
+
context.restore();
|
|
5433
|
+
}
|
|
5434
|
+
}
|
|
5435
|
+
const url = out.toDataURL(request.format === "jpeg" ? "image/jpeg" : "image/png", request.quality);
|
|
5436
|
+
if (!url.startsWith("data:image/") || url.indexOf(",") === url.length - 1) throw new Error(NO_CANVAS);
|
|
5437
|
+
return url;
|
|
5438
|
+
}
|
|
5439
|
+
function createImageCaptureSurface(controller) {
|
|
5440
|
+
const whole = () => {
|
|
5441
|
+
const { width, height } = controller.getState().imageDimensions;
|
|
5442
|
+
return width > 0 && height > 0 ? { x: 0, y: 0, width, height } : null;
|
|
5443
|
+
};
|
|
5444
|
+
return {
|
|
5445
|
+
units: "image pixels",
|
|
5446
|
+
content: whole,
|
|
5447
|
+
selection: () => ({ rect: controller.getState().selection?.bounds ?? null }),
|
|
5448
|
+
overlays: "a shade over unselected pixels and the crop box outline",
|
|
5449
|
+
maxScale: 8,
|
|
5450
|
+
render: (request) => renderImageRegion(controller, request)
|
|
5451
|
+
};
|
|
5452
|
+
}
|
|
5453
|
+
|
|
5360
5454
|
// src/image-editor/edit-tools.ts
|
|
5361
5455
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
5362
5456
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
@@ -5835,6 +5929,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
5835
5929
|
setAdjustments,
|
|
5836
5930
|
addLayer,
|
|
5837
5931
|
renderPreview,
|
|
5932
|
+
createCaptureTool(createImageCaptureSurface(controller), { subject: "the image (source orientation, before crop and rotation)", defaultPadding: 0 }),
|
|
5838
5933
|
...createImageSelectionTools(controller),
|
|
5839
5934
|
...createImageEditTools(controller)
|
|
5840
5935
|
]
|
|
@@ -6213,6 +6308,7 @@ export {
|
|
|
6213
6308
|
controlTrackBackground,
|
|
6214
6309
|
coverageToByte,
|
|
6215
6310
|
createAdjustmentLayer,
|
|
6311
|
+
createImageCaptureSurface,
|
|
6216
6312
|
createImageEditTools,
|
|
6217
6313
|
createImageEditorToolProvider,
|
|
6218
6314
|
createImageSelectionTools,
|