Adobe Photoshop CS5 Object Library JS: Layer

Photoshop CS5

Class

Layer

 

A layer object.

Superclass of ArtLayer, LayerSet

Layers may contain nested layers, which are called sublayers in the user interface. The layer object contains all of the page items in the specific layer as elements. Your script can access page items as elements of either the layer object or the document object.

QuickLinks

duplicate, link, move, moveToEnd, remove, removeAll, resize, rotate, translate, unlink

Hierarchy

Object
Layer
ArtLayer | LayerSet

Properties

PropertyTypeAccessDescription
allLockedbool r/wIf true, the layer's contents and settings are locked.
blendModeBlendMode:
BlendMode.PASSTHROUGH
BlendMode.NORMAL
BlendMode.DISSOLVE
BlendMode.DARKEN
BlendMode.MULTIPLY
BlendMode.COLORBURN
BlendMode.LINEARBURN
BlendMode.LIGHTEN
BlendMode.SCREEN
BlendMode.COLORDODGE
BlendMode.LINEARDODGE
BlendMode.OVERLAY
BlendMode.SOFTLIGHT
BlendMode.HARDLIGHT
BlendMode.VIVIDLIGHT
BlendMode.LINEARLIGHT
BlendMode.PINLIGHT
BlendMode.DIFFERENCE
BlendMode.EXCLUSION
BlendMode.HUE
BlendMode.SATURATION
BlendMode.COLORBLEND
BlendMode.LUMINOSITY
BlendMode.HARDMIX
BlendMode.LIGHTERCOLOR
BlendMode.DARKERCOLOR
r/wThe mode to use when compositing an object.
boundsUnitRect readonlyBounding rectangle of the Layer.
linkedLayers Array of Layer readonlyThe layers linked to this layer.
namestring r/wThe name of the layer.
opacitynumber (range: 0 - 100) r/wThe layer's master opacity (as a percentage). Range: 0.0 to 100.0.
parentObject readonlyThe object's container.
typenamestring readonlyThe class name of the object.
visiblebool r/wIf true, the layer is visible.
xmpMetadataXMPMetadata readonlyThe XMP properties of the document. The Camera RAW settings are stored here.

Methods

Instances

Layer duplicate ([relativeObject: Object][, insertionLocation: ElementPlacement])
Duplicate this object.

ParameterTypeDescription
relativeObjectObject (Optional)
insertionLocationElementPlacement:
ElementPlacement.PLACEAFTER
ElementPlacement.PLACEBEFORE
ElementPlacement.PLACEATEND
(Optional)

void link (with: Layer)
Links the layer with the specified layer.

ParameterTypeDescription
withLayerThe layer to link to.

Layer move (relativeObject: Object, insertionLocation: ElementPlacement)
Move the object.

ParameterTypeDescription
relativeObjectObject
insertionLocationElementPlacement:
ElementPlacement.PLACEAFTER
ElementPlacement.PLACEBEFORE
ElementPlacement.PLACEATEND

void moveToEnd ([layerSet: LayerSet])
...

ParameterTypeDescription
layerSetLayerSet (Optional)

void remove ()
Deletes this object.

void removeAll ()
Deletes all elements.

void resize ([horizontal: number=100][, vertical: number=100][, anchor: AnchorPosition=AnchorPosition.MIDDLECENTER])
Scales the object.

ParameterTypeDescription
horizontalnumberThe amount to scale the object horizontally (as a percentage). (default: 100) (Optional)
verticalnumberThe amount to scale the object vertically (as a percentage). (default: 100) (Optional)
anchorAnchorPosition:
AnchorPosition.TOPLEFT
AnchorPosition.TOPCENTER
AnchorPosition.TOPRIGHT
AnchorPosition.MIDDLELEFT
AnchorPosition.MIDDLECENTER
AnchorPosition.MIDDLERIGHT
AnchorPosition.BOTTOMLEFT
AnchorPosition.BOTTOMCENTER
AnchorPosition.BOTTOMRIGHT
The point to resize about. (default: AnchorPosition.MIDDLECENTER) (Optional)

void rotate (angle: number[, anchor: AnchorPosition=AnchorPosition.MIDDLECENTER])
Rotates the object.

ParameterTypeDescription
anglenumberThe number of degrees to rotate the object.
anchorAnchorPosition:
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 translate ([deltaX: UnitValue][, deltaY: UnitValue])
Moves the object relative to its current position.

ParameterTypeDescription
deltaXUnitValueThe amount to move the object horizontally. (Optional)
deltaYUnitValueThe amount to move the object vertically. (Optional)

void unlink ()
Unlinks the layer.

Element of

Document.activeLayer

Layer.linkedLayers

Used in:

void Layer.link (with: Layer)

Return

Layer Layer.duplicate ([relativeObject: Object][, insertionLocation: ElementPlacement])

Layer Layer.move (relativeObject: Object, insertionLocation: ElementPlacement)

Layer Layers.[] (index: uint)

Layer Layers.getByName (name: string)

Jongware, 28-Aug-2012 v3.0.3iContents :: Index