Class Transform

java.lang.Object
nl.colorize.multimedialib.stage.Transform
All Implemented Interfaces:
Transformable

public final class Transform extends Object implements Transformable
Defines the list of transformation properties that should be applied to graphics when displaying them. The table below shows all available properties, along with the graphics types that support them:

 | Property          | Defined as                                 | Supported by       |
 |-------------------|--------------------------------------------|--------------------|
 | Visible           | true/false                                 | All graphics types |
 | Position          | X/Y relative to the graphic's center       | All graphics types |
 | Rotation          | Degrees, clockwise                         | Sprite             |
 | Scale             | Percentage, 100% indicates original size   | Sprite             |
 | Flip horizontally | true/false                                 | Sprite             |
 | Flip vertically   | true/false                                 | Sprite             |
 | Alpha             | Percentage, 100% indicates opaque          | Sprite, Primitive  |
 | Mask color        | Replaces non-transparent pixels with color | Sprite             |
 

Transform instances represent a local transforms, with their properties interpreted relative to their parent. In contrast, global transforms are interpreted relative to the stage. Changing a property in a local transform will automatically propagate to the attached global transform.

  • Constructor Details

    • Transform

      public Transform()
  • Method Details

    • setVisible

      public void setVisible(boolean visible)
    • setPosition

      public void setPosition(Point2D position)
    • setPosition

      public void setPosition(float x, float y)
    • setX

      public void setX(float x)
    • setY

      public void setY(float y)
    • addPosition

      public void addPosition(float deltaX, float deltaY)
    • getX

      public float getX()
      Specified by:
      getX in interface Transformable
    • getY

      public float getY()
      Specified by:
      getY in interface Transformable
    • setRotation

      public void setRotation(Angle rotation)
    • setRotation

      public void setRotation(float degrees)
    • addRotation

      public void addRotation(float degrees)
    • setScale

      public void setScale(float scale)
    • setScaleX

      public void setScaleX(float scaleX)
    • getScaleX

      public float getScaleX()
      Specified by:
      getScaleX in interface Transformable
    • setScaleY

      public void setScaleY(float scaleY)
    • getScaleY

      public float getScaleY()
      Specified by:
      getScaleY in interface Transformable
    • setFlipHorizontal

      public void setFlipHorizontal(boolean flipHorizontal)
    • setFlipVertical

      public void setFlipVertical(boolean flipVertical)
    • setAlpha

      public void setAlpha(float alpha)
    • setMaskColor

      public void setMaskColor(ColorRGB maskColor)
    • set

      public void set(Transform other)
      Replaces all transformation properties in this Transform with the values from the specified other Transform.
    • combine

      public void combine(Transform other)
      Updates this Transform, by combining all properties with those of the specified other Transform.
    • isVisible

      public boolean isVisible()
      Specified by:
      isVisible in interface Transformable
    • getPosition

      public Point2D getPosition()
      Specified by:
      getPosition in interface Transformable
    • getRotation

      public Angle getRotation()
      Specified by:
      getRotation in interface Transformable
    • isFlipHorizontal

      public boolean isFlipHorizontal()
      Specified by:
      isFlipHorizontal in interface Transformable
    • isFlipVertical

      public boolean isFlipVertical()
      Specified by:
      isFlipVertical in interface Transformable
    • getAlpha

      public float getAlpha()
      Specified by:
      getAlpha in interface Transformable
    • getMaskColor

      public ColorRGB getMaskColor()
      Specified by:
      getMaskColor in interface Transformable