Selection

The selected area of the document or layer.

Methods:

clear, copy, cut, selectBorder, contract, fill, stroke, selectAll, deselect, select, expand, feather, grow, invert, similar, smooth, store, load, translate, translateBoundary, rotate, rotateBoundary, resize, resizeBoundary, makeWorkPath

Objects:

Boolean, String,

Property Listing

Property

Type

Access

Description

bounds

UnitRect

readonly

The bounding rectangle of the entire selection.

parent

 

readonly

The object's container.

solid

Boolean

readonly

If true, the bounding rectangle a solid rectangle.

typename

String

readonly

The class name of the object.

Method Listing

undefined clear ()

Clears the selection and does not copy it to the clipboard.

undefined contract (by:UnitValue)

Contracts the selection.

Parameter

Type

Description

by

UnitValue

The amount to contract the selection.

undefined copy ([merge:Boolean])

Copies the selection to the clipboard.

Parameter

Type

Description

merge

Boolean

If true the copy includes all visible layers. If false, copies only from the current layer.

undefined cut ()

Cuts the current selection to the clipboard.

undefined deselect ()

Deselects the current selection.

undefined expand (by:UnitValue)

Expands the selection.

Parameter

Type

Description

by

UnitValue

The amount to expand the selection.

undefined feather (by:UnitValue)

Feathers the edges of the selection.

Parameter

Type

Description

by

UnitValue

The amount to feather the edge.

undefined fill (fillType:Varies, [mode:ColorBlendMode=ColorBlendMode], [opacity:Int=Int], [preserveTransparency:Boolean])

Fills the selection.

Parameter

Type

Description

fillType

Varies

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.SUBTRACT

ColorBlendMode.DIVIDE

ColorBlendMode.HUE

ColorBlendMode.SATURATION

ColorBlendMode.COLOR

ColorBlendMode.LUMINOSITY

ColorBlendMode.HARDMIX

ColorBlendMode.LIGHTERCOLOR

ColorBlendMode.DARKERCOLOR

The color blend mode.

(default: ColorBlendMode.NORMAL)

opacity

Int (range 1 - 100)

The opacity as a percentage. Range: 1 to 100.

(default: 100)

preserveTransparency

Boolean

If true, perserves transparencies.

undefined grow (tolerance:Int, antiAlias:Boolean)

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

Boolean

If true, anti-aliasing is used.

undefined invert ()

Inverts the selection.

undefined load (from:Channel, [combination:SelectionType=SelectionType], [inverting:Boolean=Boolean])

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)

inverting

Boolean

If true, selects the inverse of the channel contents.

(default: false)

undefined makeWorkPath ([tolerance:Number])

Makes this selection item the workpath for this document.

Parameter

Type

Description

tolerance

Number

The tolerance in pixels.

undefined resize ([horizontal:Number=Number], [vertical:Number=Number], [anchor:AnchorPosition=AnchorPosition])

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)

vertical

Number

The amount to scale the selection vertically (as a percentage).

(default: 100)

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)

undefined resizeBoundary ([horizontal:Number=Number], [vertical:Number=Number], [anchor:AnchorPosition=AnchorPosition])

Scales the boundary of the selection.

Parameter

Type

Description

horizontal

Number

The amount to scale the object horizontally (as a percentage).

(default: 100)

vertical

Number

The amount to scale the object vertically (as a percentage).

(default: 100)

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)

undefined rotate (angle:Number, [anchor:AnchorPosition=AnchorPosition])

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)

undefined rotateBoundary (angle:Number, [anchor:AnchorPosition=AnchorPosition])

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)

undefined select (region:Array of Varies, [type:SelectionType=SelectionType], [feather:Number=Number], [antiAlias:Boolean=Boolean])

Selects the specified region.

Parameter

Type

Description

region

Array of Varies

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)

feather

Number

The feather amount.

(default: 0)

antiAlias

Boolean

If true, anti-aliasing is used.

(default: true)

undefined selectAll ()

Selects the entire layer.

undefined 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.

undefined similar (tolerance:Int, antiAlias:Boolean)

Grows the selection to include pixels throughout the image falling within the tolerance range.

Parameter

Type

Description

tolerance

Int (range 0 - 255)

The tolerance range. Range: 0 to 255.

antiAlias

Boolean

If true, anti-aliasing is used.

undefined 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.

undefined store (into:Channel, [combination:SelectionType=SelectionType])

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)

undefined stroke (strokeColor:Varies, width:Int, [location:StrokeLocation=StrokeLocation], [mode:ColorBlendMode=ColorBlendMode], [opacity:Int=Int], [preserveTransparency:Boolean])

Strokes the selection.

Parameter

Type

Description

strokeColor

Varies

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)

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.SUBTRACT

ColorBlendMode.DIVIDE

ColorBlendMode.HUE

ColorBlendMode.SATURATION

ColorBlendMode.COLOR

ColorBlendMode.LUMINOSITY

ColorBlendMode.HARDMIX

ColorBlendMode.LIGHTERCOLOR

ColorBlendMode.DARKERCOLOR

The color blend mode.

(default: ColorBlendMode.NORMAL)

opacity

Int (range 1 - 100)

The opacity of the stroke color as a percentage. Range: 1 to 100.

(default: 100)

preserveTransparency

Boolean

If true, preserves transparency.

undefined 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.

deltaY

UnitValue

The amount to move the object vertically.

undefined 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.

deltaY

UnitValue

The amount to move the object vertically.

Object of

Document.selection