Selection
Implements
Properties
bounds
• bounds: Promise‹PsCommon.Bounds›
The selection's rectangular bounds
parent
• parent: Promise‹Document›
The document this selection belongs to
solid
• solid: Promise‹boolean›
Whether the selection is solid
Methods
copy
▸ copy(merge?
: boolean): Promise‹void›
Invoke a copy command on the selection
Parameters:
Name | Type | Description |
---|---|---|
merge? | boolean | Copy merged contents of all visible layers |
cut
▸ cut(): Promise‹void›
Invoke a cut command on the selection
expand
▸ expand(amount?
: number): Promise‹void›
Expands the selection by a pixel amount
Parameters:
Name | Type | Description |
---|---|---|
amount? | number | Pixels to expand by |
feather
▸ feather(amount?
: number): Promise‹void›
Feathers the selection by a pixel amount
Parameters:
Name | Type | Description |
---|---|---|
amount? | number | Pixels to feather by |
invert
▸ invert(): Promise‹void›
Invert the selection
nudge
▸ nudge(horizontal
: number | PercentValue | PixelValue, vertical
: number | PercentValue | PixelValue): Promise‹void›
Implementation of Transformable
Moves the selected pixels.
Copied to your clipboard1// nudge the selection to the left by 200px2await selection.nudge(-200, 0)
Parameters:
Name | Type | Description |
---|---|---|
horizontal | number | PercentValue | PixelValue | Numeric value to offset selection content by in pixels |
vertical | number | PercentValue | PixelValue | Numeric value to offset selection content by in pixels |
perspectiveTransform
▸ perspectiveTransform(percentH
: number | PercentValue, percentV
: number | PercentValue, interpolation?
: InterpolationMethod): Promise‹void›
Implementation of Transformable
Applies a distortion (perspective) to the content under the selection.
Copied to your clipboard1// 'into the distance' effect2await selection.perspectiveTransform(0, -0.05)
Parameters:
Name | Type | Description |
---|---|---|
percentH | number | PercentValue | Distortion factor in the horizontal axis (percent) |
percentV | number | PercentValue | Distortion factor in the vertical axis (percent) |
interpolation? | InterpolationMethod | Interpolation method to use when resampling the image @default InterpolationMethod.bilinear |
rotate
▸ rotate(angle
: number | AngleValue, interpolation?
: InterpolationMethod): Promise‹void›
Implementation of Transformable
Rotates the content under the selection.
Copied to your clipboard1// rotate 90 deg counter clockwise2await selection.rotate(-90)
Parameters:
Name | Type | Description |
---|---|---|
angle | number | AngleValue | Angle to rotate the selection content by in degrees |
interpolation? | InterpolationMethod | Interpolation method to use when resampling the image @default InterpolationMethod.bilinear |
scale
▸ scale(width
: number | PercentValue, height
: number | PercentValue, interpolation?
: InterpolationMethod): Promise‹void›
Implementation of Transformable
Scales the content under the selection.
Copied to your clipboardawait selection.scale(120, 120)
Parameters:
Name | Type | Description |
---|---|---|
width | number | PercentValue | Numeric percentage to scale selection content horizontally |
height | number | PercentValue | Numeric percentage to scale selection content vertically |
interpolation? | InterpolationMethod | Interpolation method to use when resampling the image @default InterpolationMethod.bilinear * > Should this default follow the user preferences? |
skew
▸ skew(angleH
: number | AngleValue, angleV
: number | AngleValue, interpolation?
: InterpolationMethod): Promise‹void›
Implementation of Transformable
Applies a skew to the content under the selection.
Copied to your clipboard1// parellelogram shape2await selection.skew(-15, 0)
Parameters:
Name | Type | Description |
---|---|---|
angleH | number | AngleValue | Horizontal angle to skew by |
angleV | number | AngleValue | Vertical angle to skew by |
interpolation? | InterpolationMethod | Interpolation method to use when resampling the image @default InterpolationMethod.bilinear |
translate
▸ translate(deltaX
: number, deltaY
: number): Promise‹void›
Translate the entire selection.
Parameters:
Name | Type | Description |
---|---|---|
deltaX | number | Amount to move selection to the right, in pixels |
deltaY | number | Amount to move selection down, in pixels |
warp
▸ warp(warp
: BuiltinWarp | CustomWarp4X4, interpolation?
: InterpolationMethod): Promise‹void›
Implementation of Transformable
Applies a warp to the content under the selection.
Copied to your clipboard1// perform a fisheye warp2await selection.warp({ style: BuiltinWarpStyle.warpFisheye, value: 70 })34// warp selection content using a user provided 4x4 warp grid of points5var bounds = await selection.bounds6var grid = myWarpEngine.generateUniformXYPoints(bounds, 16)7var warp = myWarpEngine.applyWarp(grid)8await selection.warp({ meshPoints: warp })
Parameters:
Name | Type | Description |
---|---|---|
warp | BuiltinWarp | CustomWarp4X4 | Warp definition |
interpolation? | InterpolationMethod | Interpolation method to use when resampling the image @default InterpolationMethod.bilinear |