Class ShapeItem

java.lang.Object
ch.epfl.cs107.play.window.swing.ShapeItem
All Implemented Interfaces:
Item, Comparable<Item>

public final class ShapeItem extends Object implements Item
Draw a single shape.
  • Constructor Details

    • ShapeItem

      public ShapeItem(Shape shape, Color fillColor, Color outlineColor, float thickness, float alpha, float depth)
      Creates a new shape item.
      Parameters:
      shape - (Shape): Swing shape, not null
      fillColor - (Color): fill color, may be null
      outlineColor - (Color): outline color, may be null
      thickness - (float): outline thickness
      alpha - (float): transparency, between 0 (invisible) and 1 (opaque)
      depth - (float): associated depth
  • Method Details

    • getDepth

      public float getDepth()
      Specified by:
      getDepth in interface Item
      Returns:
      render priority, lower-values drawn first
    • render

      public void render(Graphics2D g)
      Description copied from interface: Item
      Renders the item.
      Specified by:
      render in interface Item
      Parameters:
      g - target context, not null