Edit in GitHubLog an issue

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:

NameTypeDescription
merge?booleanCopy 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:

NameTypeDescription
amount?numberPixels to expand by

feather

feather(amount?: number): Promise‹void›

Feathers the selection by a pixel amount

Parameters:

NameTypeDescription
amount?numberPixels 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 clipboard
1// nudge the selection to the left by 200px
2await selection.nudge(-200, 0)

Parameters:

NameTypeDescription
horizontalnumber | PercentValue | PixelValueNumeric value to offset selection content by in pixels
verticalnumber | PercentValue | PixelValueNumeric 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 clipboard
1// 'into the distance' effect
2await selection.perspectiveTransform(0, -0.05)

Parameters:

NameTypeDescription
percentHnumber | PercentValueDistortion factor in the horizontal axis (percent)
percentVnumber | PercentValueDistortion factor in the vertical axis (percent)
interpolation?InterpolationMethodInterpolation 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 clipboard
1// rotate 90 deg counter clockwise
2await selection.rotate(-90)

Parameters:

NameTypeDescription
anglenumber | AngleValueAngle to rotate the selection content by in degrees
interpolation?InterpolationMethodInterpolation 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 clipboard
await selection.scale(120, 120)

Parameters:

NameTypeDescription
widthnumber | PercentValueNumeric percentage to scale selection content horizontally
heightnumber | PercentValueNumeric percentage to scale selection content vertically
interpolation?InterpolationMethodInterpolation 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 clipboard
1// parellelogram shape
2await selection.skew(-15, 0)

Parameters:

NameTypeDescription
angleHnumber | AngleValueHorizontal angle to skew by
angleVnumber | AngleValueVertical angle to skew by
interpolation?InterpolationMethodInterpolation method to use when resampling the image @default InterpolationMethod.bilinear

translate

translate(deltaX: number, deltaY: number): Promise‹void›

Translate the entire selection.

Parameters:

NameTypeDescription
deltaXnumberAmount to move selection to the right, in pixels
deltaYnumberAmount 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 clipboard
1// perform a fisheye warp
2await selection.warp({ style: BuiltinWarpStyle.warpFisheye, value: 70 })
3
4// warp selection content using a user provided 4x4 warp grid of points
5var bounds = await selection.bounds
6var grid = myWarpEngine.generateUniformXYPoints(bounds, 16)
7var warp = myWarpEngine.applyWarp(grid)
8await selection.warp({ meshPoints: warp })

Parameters:

NameTypeDescription
warpBuiltinWarp | CustomWarp4X4Warp definition
interpolation?InterpolationMethodInterpolation method to use when resampling the image @default InterpolationMethod.bilinear
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.