Class ArtNode
- Direct Known Subclasses:
AdjustmentNode, GroupNode, RasterNode, ShapeNode, TextNode
One element of an artwork: a group, shape, text, image or adjustment layer.
Every node has its own transform (from its space to its parent's), opacity, blend mode, an optional clip path and mask, and a list of effects applied in order.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ArtNodecopy()A deep copy.protected ArtNodeCopies the shared properties intonand returns it.getAttribute(String key) A source attribute the reader kept, or null.Every source attribute, in the order they were set; read only.The blend mode.double[]Bounds in the parent's space, asx, y, w, h; null when empty.A clip path in this node's space, or null.The effects, applied in order.getId()The node's id, unique within a document when set.abstract double[]The bounds of this node's own content in its own space asx, y, w, h, without effects; null when it has none.getMask()A node whose alpha (or luminance) masks this one, in this node's space; or null.getName()The display name, as a layers panel shows it.floatOpacity, 0 to 1.The transform from this node's space to its parent's.booleanTrue when the node knocks out what is below it in its group, Photoshop's shallow knockout: where the node is opaque, the layers under it in the same group are erased before it is drawn, so the group's backdrop shows through.booleanisLocked()True keeps the editor from selecting the node.booleanTrue when the mask works by luminance.booleanFalse hides the node and everything in it.voidsetAttribute(String key, String value) Sets a source attribute; null removes it.voidsetBlendMode(BlendMode blendMode) Sets the blend mode.voidsetClipPath(GeneralPath clipPath) Sets the clip path.voidSets the id.voidsetKnockout(boolean knockout) Sets the knockout.voidsetLocked(boolean locked) Locks or unlocks the node.voidSets the mask.voidSets the name.voidsetOpacity(float opacity) Sets the opacity.voidsetTransform(Matrix transform) Sets the transform.voidsetVisible(boolean visible) Shows or hides the node.
-
Constructor Details
-
ArtNode
public ArtNode()
-
-
Method Details
-
getAttribute
A source attribute the reader kept, or null.
Readers keep facts the rendering model has no field for, so that tools reading the document as a design can still see them: Figma's auto-layout (
layoutMode,itemSpacing,paddingLeft...), resizing constraints (constraints.horizontal), component instances (componentId), and the source's own node type (sourceType). Rendering never reads them.Parameters
key: the attribute name
-
setAttribute
-
getAttributes
-
getId
The node's id, unique within a document when set. -
setId
Sets the id.
Parameters
id: the id
-
getName
The display name, as a layers panel shows it. -
setName
Sets the name.
Parameters
name: the name
-
isVisible
public boolean isVisible()False hides the node and everything in it. -
setVisible
public void setVisible(boolean visible) Shows or hides the node.
Parameters
visible: true to show it
-
isLocked
public boolean isLocked()True keeps the editor from selecting the node. -
setLocked
public void setLocked(boolean locked) Locks or unlocks the node.
Parameters
locked: true to lock
-
getOpacity
public float getOpacity()Opacity, 0 to 1. -
setOpacity
public void setOpacity(float opacity) Sets the opacity.
Parameters
opacity: 0 to 1
-
getBlendMode
The blend mode. -
setBlendMode
Sets the blend mode.
Parameters
blendMode: the mode
-
getTransform
The transform from this node's space to its parent's. -
setTransform
Sets the transform.
Parameters
transform: the new transform
-
getClipPath
A clip path in this node's space, or null. -
setClipPath
Sets the clip path.
Parameters
clipPath: the clip; null for none
-
getMask
A node whose alpha (or luminance) masks this one, in this node's space; or null. -
setMask
Sets the mask.
Parameters
mask: the mask node; null for noneluminance: true to mask by luminance (SVG), false by alpha
-
isKnockout
public boolean isKnockout()True when the node knocks out what is below it in its group, Photoshop's shallow knockout: where the node is opaque, the layers under it in the same group are erased before it is drawn, so the group's backdrop shows through. -
setKnockout
public void setKnockout(boolean knockout) Sets the knockout.
Parameters
knockout: true to knock out the layers below in the group
-
isLuminanceMask
public boolean isLuminanceMask()True when the mask works by luminance. -
getEffects
-
getLocalBounds
public abstract double[] getLocalBounds()The bounds of this node's own content in its own space asx, y, w, h, without effects; null when it has none. -
copy
A deep copy. -
copyBase
-
getBounds
public double[] getBounds()Bounds in the parent's space, asx, y, w, h; null when empty.
-