Interface Graphic2D

All Superinterfaces:
Updatable
All Known Implementing Classes:
Container, Primitive, Sprite, Text

public interface Graphic2D extends Updatable
Shared interface for all types of 2D graphics that are part of the scene graph. It defines a common API for managing graphics. Each graphic is part of the display list, which is controlled by the renderer and determines when and how graphics should be displayed.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns this graphic's global transform, which is calculated by combining the graphic's local transform with that of its parents.
    Returns the DisplayListLocation attached to this graphic, which is used by the renderer to determine how this graphic should be drawn.
    Returns the smallest possible rectangle that can contain this graphic, based on its current position and size.
    default Transform
    Provides access to this graphic's local transform, which can be used to influence how the graphic should be displayed.
    default boolean
    Returns true if the specified stage coordinates are included within this graphic's bounds.
    default void
    setPosition(float x, float y)
    Deprecated.
    Prefer getTransform().setPosition(x, y).

    Methods inherited from interface nl.colorize.multimedialib.scene.Updatable

    update
  • Method Details

    • getLocation

      DisplayListLocation getLocation()
      Returns the DisplayListLocation attached to this graphic, which is used by the renderer to determine how this graphic should be drawn.
    • getTransform

      default Transform getTransform()
      Provides access to this graphic's local transform, which can be used to influence how the graphic should be displayed. As the "local" implies, these properties are relative to the graphic's parent. The graphic's global transform is then calculated by combining the graphic's transform properties with those of its parent.
    • getGlobalTransform

      default Transformable getGlobalTransform()
      Returns this graphic's global transform, which is calculated by combining the graphic's local transform with that of its parents.
    • setPosition

      @Deprecated default void setPosition(float x, float y)
      Deprecated.
      Prefer getTransform().setPosition(x, y).
      Convenience method of changing this graphic's position. The X and Y coordinates are relative to the graphic's local transform.
    • getStageBounds

      Rect getStageBounds()
      Returns the smallest possible rectangle that can contain this graphic, based on its current position and size. The returned coordinates are relative to the stage, not relative to the graphic's parent.
    • hitTest

      default boolean hitTest(Point2D p)
      Returns true if the specified stage coordinates are included within this graphic's bounds. The default implementation does not perform a pixel-perfect check, and instead relies on the graphic's bounding rectangle as returned by getStageBounds().