@bubblydoo/photoshop-mcp 0.0.2
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/README.md +138 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7049 -0
- package/dist/index.js.map +1 -0
- package/dist-readmes/README.md +383 -0
- package/dist-runtime/runtime-code.cjs +17124 -0
- package/dist-runtime/runtime-code.d.cts +9 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/index.d.ts +16 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/all-types.d.ts +65 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Actions.d.ts +230 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Channel.d.ts +120 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/ColorSampler.d.ts +105 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Constants.d.ts +1648 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/CoreModules.d.ts +922 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/CountItem.d.ts +86 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Document.d.ts +931 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Guide.d.ts +105 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/HistoryState.d.ts +74 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/ImagingModule.d.ts +559 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Layer.d.ts +1073 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/LayerComp.d.ts +219 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Objects.d.ts +7 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/PathItem.d.ts +243 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/PathPoint.d.ts +78 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Photoshop.d.ts +317 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Selection.d.ts +557 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/SubPathItem.d.ts +69 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/TextItem.d.ts +213 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Channels.d.ts +81 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/ColorSamplers.d.ts +97 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/CountItems.d.ts +130 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Documents.d.ts +95 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Guides.d.ts +76 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/HistoryStates.d.ts +56 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/LayerComps.d.ts +92 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Layers.d.ts +68 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/PathItems.d.ts +65 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/PathPoints.d.ts +50 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/SubPathItems.d.ts +50 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/TextFonts.d.ts +43 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/Colors.d.ts +225 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/ConversionOptions.d.ts +213 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/ImagingBounds.d.ts +53 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/PathPointInfo.d.ts +84 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SaveOptions.d.ts +376 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SolidColor.d.ts +118 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SubPathInfo.d.ts +47 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/TextFont.d.ts +49 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/Tool.d.ts +23 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/Preferences.d.ts +121 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesBase.d.ts +9 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesCursors.d.ts +37 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesFileHandling.d.ts +58 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesGeneral.d.ts +77 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesGuidesGridsAndSlices.d.ts +51 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesHistory.d.ts +69 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesInterface.d.ts +46 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesPerformance.d.ts +42 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesTools.d.ts +44 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesTransparencyAndGamut.d.ts +38 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesType.d.ts +44 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesUnitsAndRulers.d.ts +44 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/CharacterStyle.d.ts +254 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/ParagraphStyle.d.ts +114 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/TextWarpStyle.d.ts +48 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/ApplyImageTypes.d.ts +107 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/CalculationsTypes.d.ts +119 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/DocumentTypes.d.ts +80 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/LayerCompTypes.d.ts +91 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/LayerTypes.d.ts +153 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/SharedTypes.d.ts +6 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/TextTypes.d.ts +218 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/util/colorTypes.d.ts +61 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/util/unit.d.ts +45 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/index.d.ts +21 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/all-types.d.ts +3 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/dialog.d.ts +26 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/entrypoints.d.ts +385 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/host.d.ts +28 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/os.d.ts +56 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/other.d.ts +7 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/shell.d.ts +54 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/storage.d.ts +1216 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/versions.d.ts +18 -0
- package/dist-schemas/@bubblydoo/uxp-toolkit/dist/commands-library/index.d.ts +109 -0
- package/dist-schemas/@bubblydoo/uxp-toolkit/dist/index.d.ts +153 -0
- package/dist-schemas/@bubblydoo/uxp-toolkit/dist/psLayerRef-BJKcxKbm.d.ts +66 -0
- package/package.json +51 -0
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
import type { Channel } from './Channel';
|
|
2
|
+
import type * as Constants from './Constants';
|
|
3
|
+
import type { Document } from './Document';
|
|
4
|
+
import type { Layer } from './Layer';
|
|
5
|
+
import type { ImagingBounds } from './objects/ImagingBounds';
|
|
6
|
+
import type { PathItem } from './PathItem';
|
|
7
|
+
import type { Bounds as SelectionBounds } from './types/SharedTypes';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a selected area or areas in the document. If there is no active selection,
|
|
10
|
+
* the `bounds` will return `null`. The selection is pixel-based, though 8-bit transparency is possible.
|
|
11
|
+
*
|
|
12
|
+
* Pixel selection targets where pixel filters are applied, or from where the histogram measurement is sourced.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/}
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```javascript
|
|
18
|
+
* const { app, constants } = require("photoshop");
|
|
19
|
+
* const doc = app.activeDocument;
|
|
20
|
+
*
|
|
21
|
+
* await doc.selection.selectRectangle(
|
|
22
|
+
* {top: 50, left: 50, bottom: 100, right: 100},
|
|
23
|
+
* constants.SelectionType.REPLACE
|
|
24
|
+
* );
|
|
25
|
+
* doc.selection.bounds; // {{top: 50, left: 50, bottom: 100, right: 100}
|
|
26
|
+
* doc.selection.solid; // true
|
|
27
|
+
*
|
|
28
|
+
* await doc.selection.selectEllipse(
|
|
29
|
+
* {top: 50, left: 70, bottom: 140, right: 100},
|
|
30
|
+
* constants.SelectionType.EXTEND
|
|
31
|
+
* );
|
|
32
|
+
* doc.selection.bounds; // {{top: 50, left: 50, bottom: 140, right: 100}
|
|
33
|
+
* doc.selection.solid; // false
|
|
34
|
+
*
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* **Pixel selection while in Quick Mask Mode**:
|
|
38
|
+
* When a user switches into Quick Mask Mode, the selection is temporarily shown as a channel
|
|
39
|
+
* instead of the "marching ants" border.
|
|
40
|
+
* While in Quick Mask Mode, new pixel selections can be made via Scripting. However, upon exiting
|
|
41
|
+
* Quick Mask Mode, the Quick Mask Channel will become the active selection.
|
|
42
|
+
*
|
|
43
|
+
* @minVersion 25.0
|
|
44
|
+
*/
|
|
45
|
+
export class Selection {
|
|
46
|
+
/**
|
|
47
|
+
* @ignore
|
|
48
|
+
*/
|
|
49
|
+
constructor(docId: number);
|
|
50
|
+
/**
|
|
51
|
+
* The class name of the referenced object: *"Selection"*.
|
|
52
|
+
*
|
|
53
|
+
* @minVersion 25.0
|
|
54
|
+
*/
|
|
55
|
+
get typename(): 'Selection';
|
|
56
|
+
/**
|
|
57
|
+
* The ID of the document of this Selection.
|
|
58
|
+
*
|
|
59
|
+
* @minVersion 25.0
|
|
60
|
+
*/
|
|
61
|
+
get docId(): number;
|
|
62
|
+
/**
|
|
63
|
+
* Owner document of this Selection.
|
|
64
|
+
*
|
|
65
|
+
* @minVersion 25.0
|
|
66
|
+
*/
|
|
67
|
+
get parent(): Document;
|
|
68
|
+
/**
|
|
69
|
+
* The bounding rectangle of the entire selection. It can exceed the bounds of the canvas.
|
|
70
|
+
*
|
|
71
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#bounds}
|
|
72
|
+
* @minVersion 25.0
|
|
73
|
+
*/
|
|
74
|
+
get bounds(): ImagingBounds | null;
|
|
75
|
+
/**
|
|
76
|
+
* True if the selection itself is a rectangle with all fully selected pixels.
|
|
77
|
+
* Viewed as a channel, for example via Quick Mask Mode, the selection will
|
|
78
|
+
* appear as a completely white rectangle. In that way, it is solid within its bounds.
|
|
79
|
+
*
|
|
80
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#solid}
|
|
81
|
+
* @minVersion 25.0
|
|
82
|
+
*/
|
|
83
|
+
get solid(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Contract (shrink) the selection by the specified amount.
|
|
86
|
+
*
|
|
87
|
+
* If the contraction amount is greater than the selected area radius, the
|
|
88
|
+
* selected area will disappear entirely. If there are no other active selected areas,
|
|
89
|
+
* then there will be no active selection altogether.
|
|
90
|
+
*
|
|
91
|
+
* UI Location: Select > Modify > Contract
|
|
92
|
+
*
|
|
93
|
+
* @param by The amount to contract the selection (integer in the range 1..500).
|
|
94
|
+
* @param applyEffectAtCanvasBounds By default this is false, meaning that any part of the selection
|
|
95
|
+
* that touches the bounds of the canvas will not be affected by the contraction.
|
|
96
|
+
*
|
|
97
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#contract}
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```js
|
|
101
|
+
* await doc.selection.contract(8);
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @async
|
|
105
|
+
* @minVersion 25.0
|
|
106
|
+
*/
|
|
107
|
+
contract(by: number, applyEffectAtCanvasBounds?: boolean): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Cancel the current selection. The `bounds` value will then be `null`.
|
|
110
|
+
*
|
|
111
|
+
* UI Location: Select > Deselect
|
|
112
|
+
*
|
|
113
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#deselect}
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```js
|
|
117
|
+
* await doc.selection.deselect();
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @async
|
|
121
|
+
* @minVersion 25.0
|
|
122
|
+
*/
|
|
123
|
+
deselect(): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Expand the selection outward by the specified number of pixels.
|
|
126
|
+
*
|
|
127
|
+
* UI Location: Select > Modify > Expand
|
|
128
|
+
*
|
|
129
|
+
* @param by The amount to expand the selection (integer in the range 1..500).
|
|
130
|
+
* @param applyEffectAtCanvasBounds By default this is false, meaning that any part of the selection
|
|
131
|
+
* that touches the bounds of the canvas will not be affected by the expansion.
|
|
132
|
+
*
|
|
133
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#expand}
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```js
|
|
137
|
+
* await doc.selection.expand(42);
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @async
|
|
141
|
+
* @minVersion 25.0
|
|
142
|
+
*/
|
|
143
|
+
expand(by: number, applyEffectAtCanvasBounds?: boolean): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Feather the edges of the selection by the specified amount. This softening
|
|
146
|
+
* of the selection strength is best viewed as a channel via Quick Mask Mode.
|
|
147
|
+
* Large values might make the selection disappear entirely (`.bounds` would return `null`).
|
|
148
|
+
*
|
|
149
|
+
* UI Location: Select > Modify > Feather
|
|
150
|
+
*
|
|
151
|
+
* @param by The amount to feather the selection with (decimal in the range 0.1..1000).
|
|
152
|
+
* @param applyEffectAtCanvasBounds By default this is false, meaning that any part of the selection
|
|
153
|
+
* that touches the bounds of the canvas will not be affected by the feathering.
|
|
154
|
+
*
|
|
155
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#feather}
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```js
|
|
159
|
+
* await doc.selection.feather(16);
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @async
|
|
163
|
+
* @minVersion 25.0
|
|
164
|
+
*/
|
|
165
|
+
feather(by: number, applyEffectAtCanvasBounds?: boolean): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Grow the selection to include all adjacent pixels falling
|
|
168
|
+
* within the specified tolerance range.
|
|
169
|
+
*
|
|
170
|
+
* Unsupported modes: Bitmap, RGB 32 bits, Grayscale 32 bits
|
|
171
|
+
*
|
|
172
|
+
* UI Location: Select > Grow
|
|
173
|
+
*
|
|
174
|
+
* @param tolerance The tolerance range (integer in the range 0..255)
|
|
175
|
+
* @param antiAlias Whether to use anti-aliasing (default: true)
|
|
176
|
+
*
|
|
177
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#grow}
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```js
|
|
181
|
+
* await doc.selection.grow(32);
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* @async
|
|
185
|
+
* @minVersion 25.0
|
|
186
|
+
*/
|
|
187
|
+
grow(tolerance: number, antiAlias?: boolean): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Set the active selection to the inverse of the current selection.
|
|
190
|
+
* The new active selection will be cropped to the canvas bounds.
|
|
191
|
+
* If the canvas area is fully selected, `inverse` will result in no active selection.
|
|
192
|
+
* Note also that Artboard bounds are not respected.
|
|
193
|
+
*
|
|
194
|
+
* UI Location: Select > Inverse
|
|
195
|
+
*
|
|
196
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#inverse}
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```js
|
|
200
|
+
* await doc.selection.inverse();
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* @async
|
|
204
|
+
* @minVersion 25.0
|
|
205
|
+
*/
|
|
206
|
+
inverse(): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Load the selection from the specified {@link Channel} or {@link Layer}. A Layer's pixels' transparency
|
|
209
|
+
* will be used as the selection values. Full opaque pixels yield fully selected pixels.
|
|
210
|
+
*
|
|
211
|
+
* UI Locations:
|
|
212
|
+
* - Select > Load Selection...
|
|
213
|
+
* - control/command + click on layer thumbnail
|
|
214
|
+
* - control/command + click on channel thumbnail
|
|
215
|
+
*
|
|
216
|
+
* For selecting a path please use {@link PathItem.makeSelection}
|
|
217
|
+
*
|
|
218
|
+
* @param from The Channel or Layer to load the selection from. Can be located in different document.
|
|
219
|
+
* @param mode The selection behavior when a selection already exists. Default: SelectionType.REPLACE
|
|
220
|
+
* @param invert True to invert the selection (default: false)
|
|
221
|
+
*
|
|
222
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#load}
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```js
|
|
226
|
+
* // Load from first alpha channel in RGB document
|
|
227
|
+
* await doc.selection.load(doc.channels[3]);
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @async
|
|
231
|
+
* @minVersion 25.0
|
|
232
|
+
*/
|
|
233
|
+
load(from: Channel | Layer, mode?: Constants.SelectionType, invert?: boolean): Promise<void>;
|
|
234
|
+
/**
|
|
235
|
+
* Create a work path from the active selection.
|
|
236
|
+
*
|
|
237
|
+
* UI Location: Paths panel > Make work path icon
|
|
238
|
+
*
|
|
239
|
+
* @param tolerance The tolerance (lower values, higher precision), decimal in the range 0.5..10 (default: 2)
|
|
240
|
+
*
|
|
241
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#makeworkpath}
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```js
|
|
245
|
+
* await doc.selection.makeWorkPath();
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* @async
|
|
249
|
+
* @minVersion 25.0
|
|
250
|
+
*/
|
|
251
|
+
makeWorkPath(tolerance?: number): Promise<PathItem>;
|
|
252
|
+
/**
|
|
253
|
+
* Select the entire canvas.
|
|
254
|
+
*
|
|
255
|
+
* If the document has artboards, all the pixels of the artboard that contain the active layer
|
|
256
|
+
* will be selected.
|
|
257
|
+
*
|
|
258
|
+
* If layers across multiple artboards are active, a single rectangular selection will be made,
|
|
259
|
+
* with bounds wrapping them.
|
|
260
|
+
*
|
|
261
|
+
* If no artboard is active, all artboards will be selected in the same manner.
|
|
262
|
+
* (The resulting selection might be smaller than the canvas bounds.)
|
|
263
|
+
*
|
|
264
|
+
* UI Location: Select > All
|
|
265
|
+
*
|
|
266
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#selectall}
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```js
|
|
270
|
+
* await doc.selection.selectAll();
|
|
271
|
+
* ```
|
|
272
|
+
*
|
|
273
|
+
* @async
|
|
274
|
+
* @minVersion 25.0
|
|
275
|
+
*/
|
|
276
|
+
selectAll(): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Make a rectangular selection.
|
|
279
|
+
*
|
|
280
|
+
* UI Location: Toolbar > Rectangular Marquee Tool
|
|
281
|
+
*
|
|
282
|
+
* @param bounds The bounds of the selection, as an object with {top, left, bottom, right} properties.
|
|
283
|
+
* @param mode The selection behavior when a selection already exists. Default: SelectionType.REPLACE
|
|
284
|
+
* @param feather The amount of feathering in pixels to apply to the selection (decimal in the range 0..1000, default: 0)
|
|
285
|
+
* @param antiAlias If true, anti-aliasing is applied to the selection (default: true)
|
|
286
|
+
*
|
|
287
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#selectrectangle}
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```js
|
|
291
|
+
* await doc.selection.selectRectangle(
|
|
292
|
+
* {top: 0, left: 0, bottom: 100, right: 100},
|
|
293
|
+
* Constants.SelectionType.REPLACE,
|
|
294
|
+
* 10
|
|
295
|
+
* );
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* @async
|
|
299
|
+
* @minVersion 25.0
|
|
300
|
+
*/
|
|
301
|
+
selectRectangle(
|
|
302
|
+
bounds: SelectionBounds,
|
|
303
|
+
mode?: Constants.SelectionType,
|
|
304
|
+
feather?: number,
|
|
305
|
+
antiAlias?: boolean,
|
|
306
|
+
): Promise<void>;
|
|
307
|
+
/**
|
|
308
|
+
* Make an elliptical selection.
|
|
309
|
+
*
|
|
310
|
+
* UI Location: Toolbar > Elliptical Marquee Tool
|
|
311
|
+
*
|
|
312
|
+
* @param bounds The bounds of the selection, as an object with {top, left, bottom, right} properties.
|
|
313
|
+
* @param mode The selection behavior when a selection already exists. Default: SelectionType.REPLACE
|
|
314
|
+
* @param feather The amount of feathering in pixels to apply to the selection (decimal in the range 0..1000, default: 0)
|
|
315
|
+
* @param antiAlias If true, anti-aliasing is applied to the selection (default: true)
|
|
316
|
+
*
|
|
317
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#selectellipse}
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```js
|
|
321
|
+
* await doc.selection.selectEllipse({top: 0, left: 0, bottom: 100, right: 100});
|
|
322
|
+
* ```
|
|
323
|
+
*
|
|
324
|
+
* @async
|
|
325
|
+
* @minVersion 25.0
|
|
326
|
+
*/
|
|
327
|
+
selectEllipse(
|
|
328
|
+
bounds: SelectionBounds,
|
|
329
|
+
mode?: Constants.SelectionType,
|
|
330
|
+
feather?: number,
|
|
331
|
+
antiAlias?: boolean,
|
|
332
|
+
): Promise<void>;
|
|
333
|
+
/**
|
|
334
|
+
* Make a polygonal selection.
|
|
335
|
+
*
|
|
336
|
+
* UI Location: Toolbar > Polygonal Lasso Tool
|
|
337
|
+
*
|
|
338
|
+
* @param points The points to select as an array of objects with {x, y} properties.
|
|
339
|
+
* @param mode The selection behavior when a selection already exists. Default: SelectionType.REPLACE
|
|
340
|
+
* @param feather The amount of feathering in pixels to apply to the selection (decimal in the range 0..1000, default: 0)
|
|
341
|
+
* @param antiAlias If true, anti-aliasing is applied to the selection (default: true)
|
|
342
|
+
*
|
|
343
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#selectpolygon}
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```js
|
|
347
|
+
* await doc.selection.selectPolygon([
|
|
348
|
+
* {x: 50, y: 10},
|
|
349
|
+
* {x: 100, y: 90},
|
|
350
|
+
* {x: 10, y: 40}
|
|
351
|
+
* ]);
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* @async
|
|
355
|
+
* @minVersion 25.0
|
|
356
|
+
*/
|
|
357
|
+
selectPolygon(
|
|
358
|
+
points: Array<{
|
|
359
|
+
x: number;
|
|
360
|
+
y: number;
|
|
361
|
+
}>,
|
|
362
|
+
mode?: Constants.SelectionType,
|
|
363
|
+
feather?: number,
|
|
364
|
+
antiAlias?: boolean,
|
|
365
|
+
): Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Select a single row of pixels.
|
|
368
|
+
*
|
|
369
|
+
* UI Location: Toolbar > Single Row Marquee Tool
|
|
370
|
+
*
|
|
371
|
+
* @param y The y coordinate in pixels of the row to select (integer).
|
|
372
|
+
* The range should be within the document height.
|
|
373
|
+
* @param mode The selection behavior when a selection already exists. Default: SelectionType.REPLACE
|
|
374
|
+
*
|
|
375
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#selectrow}
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```js
|
|
379
|
+
* await doc.selection.selectRow(10);
|
|
380
|
+
* ```
|
|
381
|
+
*
|
|
382
|
+
* @async
|
|
383
|
+
* @minVersion 25.0
|
|
384
|
+
*/
|
|
385
|
+
selectRow(y: number, mode?: Constants.SelectionType): Promise<void>;
|
|
386
|
+
/**
|
|
387
|
+
* Select a single column of pixels.
|
|
388
|
+
*
|
|
389
|
+
* UI Location: Toolbar > Single Column Marquee Tool
|
|
390
|
+
*
|
|
391
|
+
* @param x The x coordinate in pixels of the column to select (integer).
|
|
392
|
+
* The range should be within the document width.
|
|
393
|
+
* @param mode The selection behavior when a selection already exists. Default: SelectionType.REPLACE
|
|
394
|
+
*
|
|
395
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#selectcolumn}
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```js
|
|
399
|
+
* await doc.selection.selectColumn(90);
|
|
400
|
+
* ```
|
|
401
|
+
*
|
|
402
|
+
* @async
|
|
403
|
+
* @minVersion 25.0
|
|
404
|
+
*/
|
|
405
|
+
selectColumn(x: number, mode?: Constants.SelectionType): Promise<void>;
|
|
406
|
+
/**
|
|
407
|
+
* Save the selection in a new Alpha Channel.
|
|
408
|
+
*
|
|
409
|
+
* UI Location: Select > Save Selection...
|
|
410
|
+
*
|
|
411
|
+
* @param channelName The name of the new channel to create (Default: "Alpha 1", "Alpha 2", etc.)
|
|
412
|
+
*
|
|
413
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#save}
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```js
|
|
417
|
+
* await doc.selection.save("My Selection");
|
|
418
|
+
* ```
|
|
419
|
+
*
|
|
420
|
+
* @async
|
|
421
|
+
* @minVersion 25.0
|
|
422
|
+
*/
|
|
423
|
+
save(channelName?: string): Promise<void>;
|
|
424
|
+
/**
|
|
425
|
+
* Save the selection in an existing Alpha Channel (Component Channels are not supported targets).
|
|
426
|
+
*
|
|
427
|
+
* @param channel The targeted Alpha channel for the save operation.
|
|
428
|
+
* @param mode The selection behavior when a selection already exists. Default: SelectionType.REPLACE
|
|
429
|
+
*
|
|
430
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#saveto}
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```js
|
|
434
|
+
* // Stores the current selection into an existing alpha channel in RGB document
|
|
435
|
+
* await doc.selection.saveTo(doc.channels[3]);
|
|
436
|
+
*
|
|
437
|
+
* // Performing an intersection operation on an alpha channel
|
|
438
|
+
* await doc.selection.saveTo(doc.channels[3], SelectionType.INTERSECT);
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
* @minVersion 25.0
|
|
442
|
+
*/
|
|
443
|
+
saveTo(channel: Channel, mode?: Constants.SelectionType): Promise<void>;
|
|
444
|
+
/**
|
|
445
|
+
* Create a new selection based on the border of the active selection. The new selection will be an area
|
|
446
|
+
* equivalent to a stroke of that border by the given width in pixels.
|
|
447
|
+
* The result is not limited by canvas bounds.
|
|
448
|
+
*
|
|
449
|
+
* UI Location: Select > Modify > Border...
|
|
450
|
+
*
|
|
451
|
+
* @param width The width of the border selection (integer in the range 1..200)
|
|
452
|
+
*
|
|
453
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#selectborder}
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```js
|
|
457
|
+
* await doc.selection.selectBorder(10);
|
|
458
|
+
* ```
|
|
459
|
+
*
|
|
460
|
+
* @minVersion 25.0
|
|
461
|
+
* @async
|
|
462
|
+
*/
|
|
463
|
+
selectBorder(width: number): Promise<void>;
|
|
464
|
+
/**
|
|
465
|
+
* Reduce patchiness and smooth sharp corners and jagged lines in the selection. Smooth will also remove
|
|
466
|
+
* isolated groups of pixels that are smaller than the given radius. This effect is useful for cleaning up
|
|
467
|
+
* stray pixels from color-based selections.
|
|
468
|
+
*
|
|
469
|
+
* Large values might make the selection disappear entirely (`.bounds` would return `null`).
|
|
470
|
+
*
|
|
471
|
+
* UI Location: Select > Modify > Smooth...
|
|
472
|
+
*
|
|
473
|
+
* @param radius The sample radius in pixels (integer in the range 1..500)
|
|
474
|
+
* @param applyEffectAtCanvasBounds By default this is false, meaning that any part of the selection
|
|
475
|
+
* that touches the bounds of the canvas will not be affected by the smoothing.
|
|
476
|
+
*
|
|
477
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#smooth}
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* ```js
|
|
481
|
+
* await doc.selection.smooth(32);
|
|
482
|
+
* ```
|
|
483
|
+
*
|
|
484
|
+
* @minVersion 25.0
|
|
485
|
+
* @async
|
|
486
|
+
*/
|
|
487
|
+
smooth(radius: number, applyEffectAtCanvasBounds?: boolean): Promise<void>;
|
|
488
|
+
/**
|
|
489
|
+
* Move the selection itself relative to its current position. Does not affect the active layer.
|
|
490
|
+
*
|
|
491
|
+
* UI Location: Select > Transform Selection
|
|
492
|
+
*
|
|
493
|
+
* @param deltaX The amount to move the selection horizontally (decimal).
|
|
494
|
+
* @param deltaY The amount to move the selection vertically (decimal).
|
|
495
|
+
*
|
|
496
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#translateboundary}
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```js
|
|
500
|
+
* await doc.selection.translateBoundary(100, 600);
|
|
501
|
+
* ```
|
|
502
|
+
*
|
|
503
|
+
* @minVersion 25.0
|
|
504
|
+
* @async
|
|
505
|
+
*/
|
|
506
|
+
translateBoundary(deltaX: number, deltaY: number): Promise<void>;
|
|
507
|
+
/**
|
|
508
|
+
* Scale the selection itself in percent. Does not affect the active layer.
|
|
509
|
+
*
|
|
510
|
+
* UI Location: Select > Transform Selection
|
|
511
|
+
*
|
|
512
|
+
* @param horizontal The amount to scale selection horizontally (decimal, default: 100)
|
|
513
|
+
* @param vertical The amount to scale selection vertically (decimal, default: 100)
|
|
514
|
+
* @param anchor The anchor position to scale around. Default: AnchorPosition.MIDDLECENTER
|
|
515
|
+
* @param interpolation The resampling algorithm to use. Default: InterpolationMethod.BICUBIC
|
|
516
|
+
*
|
|
517
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#resizeboundary}
|
|
518
|
+
*
|
|
519
|
+
* @example
|
|
520
|
+
* ```js
|
|
521
|
+
* await doc.selection.resizeBoundary(50, 50);
|
|
522
|
+
* ```
|
|
523
|
+
*
|
|
524
|
+
* @minVersion 25.0
|
|
525
|
+
* @async
|
|
526
|
+
*/
|
|
527
|
+
resizeBoundary(
|
|
528
|
+
horizontal?: number,
|
|
529
|
+
vertical?: number,
|
|
530
|
+
anchor?: Constants.AnchorPosition,
|
|
531
|
+
interpolation?: Constants.InterpolationMethod,
|
|
532
|
+
): Promise<void>;
|
|
533
|
+
/**
|
|
534
|
+
* Rotate the selection itself clockwise around the given anchor position. Does not affect the active layer.
|
|
535
|
+
*
|
|
536
|
+
* UI Location: Select > Transform Selection
|
|
537
|
+
*
|
|
538
|
+
* @param angle Angle to rotate the selection by in degrees (decimal in the range -180..180)
|
|
539
|
+
* @param anchor Anchor position to rotate around. Default: AnchorPosition.MIDDLECENTER
|
|
540
|
+
* @param interpolation The resampling algorithm to use. Default: InterpolationMethod.BICUBIC
|
|
541
|
+
*
|
|
542
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#rotateboundary}
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```js
|
|
546
|
+
* await doc.selection.rotateBoundary(90, constants.AnchorPosition.MIDDLECENTER);
|
|
547
|
+
* ```
|
|
548
|
+
*
|
|
549
|
+
* @minVersion 25.0
|
|
550
|
+
* @async
|
|
551
|
+
*/
|
|
552
|
+
rotateBoundary(
|
|
553
|
+
angle: number,
|
|
554
|
+
anchor?: Constants.AnchorPosition,
|
|
555
|
+
interpolation?: Constants.InterpolationMethod,
|
|
556
|
+
): Promise<void>;
|
|
557
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PathPoints } from './collections/PathPoints';
|
|
2
|
+
import type * as Constants from './Constants';
|
|
3
|
+
import type { PathItem } from './PathItem';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a subpath; a collection of subpaths make up a {@link PathItem}.
|
|
6
|
+
*
|
|
7
|
+
* Create these objects by passing {@link SubPathInfo} objects to {@link PathItems.add}() method. This method creates a
|
|
8
|
+
* `SubPathItem` object for each {@link SubPathInfo} object, and creates and then returns a new {@link PathItem} object for the
|
|
9
|
+
* path represented by all of the subpaths. Access these objects in the {@link PathItem.subPathItems} collection.
|
|
10
|
+
*
|
|
11
|
+
* - Use the {@link SubPathItem} object to retrieve information about existing subpaths. The properties are read-only.
|
|
12
|
+
* - Use {@link SubPathInfo} to create subpaths; the properties are read-write.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/subpathitem/}
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```javascript
|
|
18
|
+
* // Access subpaths from a path
|
|
19
|
+
* const path = app.activeDocument.pathItems[0];
|
|
20
|
+
* path.subPathItems.forEach(subPath => {
|
|
21
|
+
* console.log(`SubPath closed: ${subPath.closed}, operation: ${subPath.operation}`);
|
|
22
|
+
* console.log(`Points count: ${subPath.pathPoints.length}`);
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Added in Photoshop 23.3*
|
|
27
|
+
*/
|
|
28
|
+
export class SubPathItem {
|
|
29
|
+
/**
|
|
30
|
+
* @ignore
|
|
31
|
+
*/
|
|
32
|
+
constructor(index: number, pathId: number, docId: number);
|
|
33
|
+
/**
|
|
34
|
+
* The class name of the referenced object: *"SubPathItem"*.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/subpathitem/#typename}
|
|
37
|
+
* @minVersion 23.3
|
|
38
|
+
*/
|
|
39
|
+
get typename(): 'SubPathItem';
|
|
40
|
+
/**
|
|
41
|
+
* The path that contains this subpath.
|
|
42
|
+
*
|
|
43
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/subpathitem/#parent}
|
|
44
|
+
* @minVersion 23.3
|
|
45
|
+
*/
|
|
46
|
+
get parent(): PathItem;
|
|
47
|
+
/**
|
|
48
|
+
* How this `SubPathItem` behaves when it intersects another. Specifies how to combine the shapes
|
|
49
|
+
* if the destination path already has a selection.
|
|
50
|
+
*
|
|
51
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/subpathitem/#operation}
|
|
52
|
+
* @minVersion 23.3
|
|
53
|
+
*/
|
|
54
|
+
get operation(): Constants.ShapeOperation;
|
|
55
|
+
/**
|
|
56
|
+
* True if the path is closed.
|
|
57
|
+
*
|
|
58
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/subpathitem/#closed}
|
|
59
|
+
* @minVersion 23.3
|
|
60
|
+
*/
|
|
61
|
+
get closed(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The collection of the {@link PathPoint}s on this `SubPathItem`.
|
|
64
|
+
*
|
|
65
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/subpathitem/#pathpoints}
|
|
66
|
+
* @minVersion 23.3
|
|
67
|
+
*/
|
|
68
|
+
get pathPoints(): PathPoints;
|
|
69
|
+
}
|