Adobe Photoshop CS5 Object Library JS: Selection
From Photoshop CS5
Selection
The selected area of the document or layer.QuickLinks
clear, contract, copy, cut, deselect, expand, feather, fill, grow, invert, load, makeWorkPath, resize, resizeBoundary, rotate, rotateBoundary, select, selectAll, selectBorder, similar, smooth, store, stroke, translate, translateBoundaryHierarchy
Properties
Methods
Instances
void clear ()
Clears the selection and does not copy it to the clipboard.
void contract (by:
UnitValue)
Contracts the selection.
| Parameter | Type | Description |
|---|---|---|
| by | UnitValue | The amount to contract the selection. |
void copy ([merge:
bool])
Copies the selection to the clipboard.
| Parameter | Type | Description |
|---|---|---|
| merge | bool | If true the copy includes all visible layers. If false, copies only from the current layer. (Optional) |
void cut ()
Cuts the current selection to the clipboard.
void deselect ()
Deselects the current selection.
void expand (by:
UnitValue)
Expands the selection.
| Parameter | Type | Description |
|---|---|---|
| by | UnitValue | The amount to expand the selection. |
void feather (by:
UnitValue)
Feathers the edges of the selection.
| Parameter | Type | Description |
|---|---|---|
| by | UnitValue | The amount to feather the edge. |
void fill (fillType:
any[, mode:
ColorBlendMode=ColorBlendMode.NORMAL][, opacity:
int=100][, preserveTransparency:
bool])
Fills the selection.
| Parameter | Type | Description |
|---|---|---|
| fillType | any | The color or history state with which to fill the object. |
| mode | ColorBlendMode: ColorBlendMode.NORMAL ColorBlendMode.DISSOLVE ColorBlendMode.BEHIND ColorBlendMode.CLEAR ColorBlendMode.DARKEN ColorBlendMode.MULTIPLY ColorBlendMode.COLORBURN ColorBlendMode.LINEARBURN ColorBlendMode.LIGHTEN ColorBlendMode.SCREEN ColorBlendMode.COLORDODGE ColorBlendMode.LINEARDODGE ColorBlendMode.OVERLAY ColorBlendMode.SOFTLIGHT ColorBlendMode.HARDLIGHT ColorBlendMode.VIVIDLIGHT ColorBlendMode.LINEARLIGHT ColorBlendMode.PINLIGHT ColorBlendMode.DIFFERENCE ColorBlendMode.EXCLUSION ColorBlendMode.HUE ColorBlendMode.SATURATION ColorBlendMode.COLOR ColorBlendMode.LUMINOSITY ColorBlendMode.HARDMIXBLEND | The color blend mode. (default: ColorBlendMode.NORMAL) (Optional) |
| opacity | int | The opacity as a percentage. Range: 1 to 100. (default: 100) (Optional) |
| preserveTransparency | bool | If true, perserves transparencies. (Optional) |
void grow (tolerance:
int, antiAlias:
bool)
Grows the selection to include all adjacent pixels falling within the specified tolerance range.
| Parameter | Type | Description |
|---|---|---|
| tolerance | int (range: 0 - 255) | The tolerance range. Range: 0 to 255. |
| antiAlias | bool | If true, anti-aliasing is used. |
void invert ()
Inverts the selection.
void load (from:
Channel[, combination:
SelectionType=SelectionType.REPLACE][, inverting:
bool=false])
Loads the selection from the specified channel.
| Parameter | Type | Description |
|---|---|---|
| from | Channel | The channel to load the selection from. |
| combination | SelectionType: SelectionType.REPLACE SelectionType.EXTEND SelectionType.DIMINISH SelectionType.INTERSECT | How to combine the channel contents with the existing selection. (default: SelectionType.REPLACE) (Optional) |
| inverting | bool | If true, selects the inverse of the channel contents. (default: false) (Optional) |
void makeWorkPath ([tolerance:
number])
Makes this selection item the workpath for this document.
| Parameter | Type | Description |
|---|---|---|
| tolerance | number | The tolerance in pixels. (Optional) |
void resize ([horizontal:
number=100][, vertical:
number=100][, anchor:
AnchorPosition=AnchorPosition.MIDDLECENTER])
Resizes the selected area to the specified dimensions and anchor position.
| Parameter | Type | Description |
|---|---|---|
| horizontal | number | The amount to scale the selection horizontally (as a percentage). (default: 100) (Optional) |
| vertical | number | The amount to scale the selection vertically (as a percentage). (default: 100) (Optional) |
| anchor | AnchorPosition: AnchorPosition.TOPLEFT AnchorPosition.TOPCENTER AnchorPosition.TOPRIGHT AnchorPosition.MIDDLELEFT AnchorPosition.MIDDLECENTER AnchorPosition.MIDDLERIGHT AnchorPosition.BOTTOMLEFT AnchorPosition.BOTTOMCENTER AnchorPosition.BOTTOMRIGHT | The point to scale around. (default: AnchorPosition.MIDDLECENTER) (Optional) |
void resizeBoundary ([horizontal:
number=100][, vertical:
number=100][, anchor:
AnchorPosition=AnchorPosition.MIDDLECENTER])
Scales the boundary of the selection.
| Parameter | Type | Description |
|---|---|---|
| horizontal | number | The amount to scale the object horizontally (as a percentage). (default: 100) (Optional) |
| vertical | number | The amount to scale the object vertically (as a percentage). (default: 100) (Optional) |
| anchor | AnchorPosition: AnchorPosition.TOPLEFT AnchorPosition.TOPCENTER AnchorPosition.TOPRIGHT AnchorPosition.MIDDLELEFT AnchorPosition.MIDDLECENTER AnchorPosition.MIDDLERIGHT AnchorPosition.BOTTOMLEFT AnchorPosition.BOTTOMCENTER AnchorPosition.BOTTOMRIGHT | The point to scale around. (default: AnchorPosition.MIDDLECENTER) (Optional) |
void rotate (angle:
number[, anchor:
AnchorPosition=AnchorPosition.MIDDLECENTER])
Rotates the object.
| Parameter | Type | Description |
|---|---|---|
| angle | number | The number of degrees to rotate the object. |
| anchor | AnchorPosition: AnchorPosition.TOPLEFT AnchorPosition.TOPCENTER AnchorPosition.TOPRIGHT AnchorPosition.MIDDLELEFT AnchorPosition.MIDDLECENTER AnchorPosition.MIDDLERIGHT AnchorPosition.BOTTOMLEFT AnchorPosition.BOTTOMCENTER AnchorPosition.BOTTOMRIGHT | The point to rotate about. (default: AnchorPosition.MIDDLECENTER) (Optional) |
void rotateBoundary (angle:
number[, anchor:
AnchorPosition=AnchorPosition.MIDDLECENTER])
Rotates the boundary of the selection.
| Parameter | Type | Description |
|---|---|---|
| angle | number | The rotation angle (in degrees) |
| anchor | AnchorPosition: AnchorPosition.TOPLEFT AnchorPosition.TOPCENTER AnchorPosition.TOPRIGHT AnchorPosition.MIDDLELEFT AnchorPosition.MIDDLECENTER AnchorPosition.MIDDLERIGHT AnchorPosition.BOTTOMLEFT AnchorPosition.BOTTOMCENTER AnchorPosition.BOTTOMRIGHT | The point to rotate about. (default: AnchorPosition.MIDDLECENTER) (Optional) |
void select (region:
Array
of any[, type:
SelectionType=SelectionType.REPLACE][, feather:
number=0][, antiAlias:
bool=true])
Selects the specified region.
| Parameter | Type | Description |
|---|---|---|
| region | Array of any | Array of x and y coordinates that describe the corners of the selection, in the format [[x1, y1], [x2,y2],[x3, y3], [x4,y4]] |
| type | SelectionType: SelectionType.REPLACE SelectionType.EXTEND SelectionType.DIMINISH SelectionType.INTERSECT | The method for combining the new selection with the existing selection. (default: SelectionType.REPLACE) (Optional) |
| feather | number | The feather amount. (default: 0) (Optional) |
| antiAlias | bool | If true, anti-aliasing is used. (default: true) (Optional) |
void selectAll ()
Selects the entire layer.
void selectBorder (width:
UnitValue)
Selects the selection border only (in the specified width); subsequent actions do not affect the selected area within the borders.
| Parameter | Type | Description |
|---|---|---|
| width | UnitValue | The width of the border selection. |
void similar (tolerance:
int, antiAlias:
bool)
Grows the selection to include pixels throughout the image falling within the tolerance range.
| Parameter | Type | Description |
|---|---|---|
| tolerance | int | The tolerance range. Range: 0 to 255. |
| antiAlias | bool | If true, anti-aliasing is used. |
void smooth (radius:
int)
Cleans up stray pixels left inside or outside a color-based selection (within the radius specified in pixels).
| Parameter | Type | Description |
|---|---|---|
| radius | int (range: 0 - 100) | The sample radius in pixels. Range: 0 to 100. |
void store (into:
Channel[, combination:
SelectionType=SelectionType.REPLACE])
Saves the selection as a channel.
| Parameter | Type | Description |
|---|---|---|
| into | Channel | The channel to save the selection to. |
| combination | SelectionType: SelectionType.REPLACE SelectionType.EXTEND SelectionType.DIMINISH SelectionType.INTERSECT | How to add the selection to the existing contents of the channel. (default: SelectionType.REPLACE) (Optional) |
void stroke (strokeColor:
any, width:
int[, location:
StrokeLocation=StrokeLocation.CENTER][, mode:
ColorBlendMode=ColorBlendMode.NORMAL][, opacity:
int=100][, preserveTransparency:
bool])
Strokes the selection.
| Parameter | Type | Description |
|---|---|---|
| strokeColor | any | The color to stroke the selection with. |
| width | int | The stroke width. |
| location | StrokeLocation: StrokeLocation.INSIDE StrokeLocation.CENTER StrokeLocation.OUTSIDE | The stroke location. (default: StrokeLocation.CENTER) (Optional) |
| mode | ColorBlendMode: ColorBlendMode.NORMAL ColorBlendMode.DISSOLVE ColorBlendMode.BEHIND ColorBlendMode.CLEAR ColorBlendMode.DARKEN ColorBlendMode.MULTIPLY ColorBlendMode.COLORBURN ColorBlendMode.LINEARBURN ColorBlendMode.LIGHTEN ColorBlendMode.SCREEN ColorBlendMode.COLORDODGE ColorBlendMode.LINEARDODGE ColorBlendMode.OVERLAY ColorBlendMode.SOFTLIGHT ColorBlendMode.HARDLIGHT ColorBlendMode.VIVIDLIGHT ColorBlendMode.LINEARLIGHT ColorBlendMode.PINLIGHT ColorBlendMode.DIFFERENCE ColorBlendMode.EXCLUSION ColorBlendMode.HUE ColorBlendMode.SATURATION ColorBlendMode.COLOR ColorBlendMode.LUMINOSITY ColorBlendMode.HARDMIXBLEND | The color blend mode. (default: ColorBlendMode.NORMAL) (Optional) |
| opacity | int | The opacity of the stroke color as a percentage. Range: 1 to 100. (default: 100) (Optional) |
| preserveTransparency | bool | If true, preserves transparency. (Optional) |
void translate ([deltaX:
UnitValue][, deltaY:
UnitValue])
Moves the object relative to its current position.
| Parameter | Type | Description |
|---|---|---|
| deltaX | UnitValue | The amount to move the object horizontally. (Optional) |
| deltaY | UnitValue | The amount to move the object vertically. (Optional) |
void translateBoundary ([deltaX:
UnitValue][, deltaY:
UnitValue])
Moves the boundary of selection relative to its current position.
| Parameter | Type | Description |
|---|---|---|
| deltaX | UnitValue | The amount to move the object horizontally. (Optional) |
| deltaY | UnitValue | The amount to move the object vertically. (Optional) |
Element of
Document.selection
| Jongware, 28-Aug-2012 v3.0.3i | Contents :: Index |