Class ArtNode

java.lang.Object
com.codename1.art.ArtNode
Direct Known Subclasses:
AdjustmentNode, GroupNode, RasterNode, ShapeNode, TextNode

public abstract class ArtNode extends Object

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 Details

    • ArtNode

      public ArtNode()
  • Method Details

    • getId

      public String getId()
      The node's id, unique within a document when set.
    • setId

      public void setId(String id)

      Sets the id.

      Parameters
      • id: the id
    • getName

      public String getName()
      The display name, as a layers panel shows it.
    • setName

      public void setName(String name)

      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

      public BlendMode getBlendMode()
      The blend mode.
    • setBlendMode

      public void setBlendMode(BlendMode blendMode)

      Sets the blend mode.

      Parameters
      • blendMode: the mode
    • getTransform

      public Matrix getTransform()
      The transform from this node's space to its parent's.
    • setTransform

      public void setTransform(Matrix transform)

      Sets the transform.

      Parameters
      • transform: the new transform
    • getClipPath

      public GeneralPath getClipPath()
      A clip path in this node's space, or null.
    • setClipPath

      public void setClipPath(GeneralPath clipPath)

      Sets the clip path.

      Parameters
      • clipPath: the clip; null for none
    • getMask

      public ArtNode getMask()
      A node whose alpha (or luminance) masks this one, in this node's space; or null.
    • setMask

      public void setMask(ArtNode mask, boolean luminance)

      Sets the mask.

      Parameters
      • mask: the mask node; null for none
      • luminance: 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

      public List<Effect> getEffects()
      The effects, applied in order. The list is live.
    • getLocalBounds

      public abstract double[] getLocalBounds()
      The bounds of this node's own content in its own space as x, y, w, h, without effects; null when it has none.
    • copy

      public abstract ArtNode copy()
      A deep copy.
    • copyBase

      protected ArtNode copyBase(ArtNode n)
      Copies the shared properties into n and returns it.
    • getBounds

      public double[] getBounds()
      Bounds in the parent's space, as x, y, w, h; null when empty.