Class Primitive

java.lang.Object
nl.colorize.multimedialib.stage.Primitive
All Implemented Interfaces:
Updatable, Graphic2D

public class Primitive extends Object implements Graphic2D
Draws a graphical primitive to the screen. The on-screen position of the primitive is determined by both the coordinates in the original shape and by the primitive's position.

Primitives have a stroke property, but its value is only used if the instance describes an outline shape. The stroke property has no effect for filled shapes.

  • Constructor Details

    • Primitive

      public Primitive(Shape shape, ColorRGB color)
    • Primitive

      public Primitive(Shape shape, ColorRGB color, float alpha)
  • Method Details

    • update

      public void update(float deltaTime)
      Description copied from interface: Updatable
      Updates this object for the current frame. deltaTime indicates the elapsed time since the last frame update, in seconds.
      Specified by:
      update in interface Updatable
    • getStageBounds

      public Rect getStageBounds()
      Description copied from interface: Graphic2D
      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.
      Specified by:
      getStageBounds in interface Graphic2D
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLocation

      public DisplayListLocation getLocation()
      Description copied from interface: Graphic2D
      Returns the DisplayListLocation attached to this graphic, which is used by the renderer to determine how this graphic should be drawn.
      Specified by:
      getLocation in interface Graphic2D
    • getShape

      public Shape getShape()
    • getColor

      public ColorRGB getColor()
    • getStroke

      public float getStroke()
    • setShape

      public void setShape(Shape shape)
    • setColor

      public void setColor(ColorRGB color)
    • setStroke

      public void setStroke(float stroke)