com.orsoncharts.table

## Class GradientRectanglePainter

- java.lang.Object
- - com.orsoncharts.table.GradientRectanglePainter

- All Implemented Interfaces:
    RectanglePainter, java.io.Serializable

      public final class GradientRectanglePainter
      extends java.lang.Object
      implements RectanglePainter, java.io.Serializable

  A `RectanglePainter` that can fill a rectangle with a gradient (the gradient is generated using anchor points to fit any size rectangle on demand). Instances of this class are immutable.
  NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GradientRectanglePainter(java.awt.Color color1, Anchor2D anchor1, java.awt.Color color2, Anchor2D anchor2)` Creates a new instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)` Tests this instance for equality with an arbitrary object.
    `void` | `fill(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)` Fills the specified `area` with a gradient paint created using the colors and anchor points of this painter.
    `Anchor2D` | `getAnchor1()` Returns the anchor point used to find the starting point for the gradient (as specified via the constructor).
    `Anchor2D` | `getAnchor2()` Returns the anchor point used to find the ending point for the gradient (as specified via the constructor).
    `java.awt.Color` | `getColor1()` Returns the first color for the gradient (as specified via the constructor).
    `java.awt.Color` | `getColor2()` Returns the second color for the gradient (as specified via the constructor).
    `int` | `hashCode()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GradientRectanglePainter

          public GradientRectanglePainter(java.awt.Color color1,
                                          Anchor2D anchor1,
                                          java.awt.Color color2,
                                          Anchor2D anchor2)

      Creates a new instance.
      NOTE: some useful standard anchor points are defined in the `TitleAnchor` class.
      Parameters:
        `color1` - the first color for the gradient (`null` not permitted).
        `anchor1` - the anchor point used to determine the starting point for the gradient (`null` not permitted).
        `color2` - the second color for the gradient (`null` not permitted).
        `anchor2` - the anchor point used to determine the ending point for the gradient (`null` not permitted).

  - ### Method Detail

    - #### getColor1

          public java.awt.Color getColor1()

      Returns the first color for the gradient (as specified via the constructor). There is no setter method because instances of this class are immutable.
      Returns:
        The first color for the gradient (never `null`).

    - #### getAnchor1

          public Anchor2D getAnchor1()

      Returns the anchor point used to find the starting point for the gradient (as specified via the constructor). There is no setter method because instances of this class are immutable.
      Returns:
        The anchor point (never `null`).

    - #### getColor2

          public java.awt.Color getColor2()

      Returns the second color for the gradient (as specified via the constructor). There is no setter method because instances of this class are immutable.
      Returns:
        The second color for the gradient (never `null`).

    - #### getAnchor2

          public Anchor2D getAnchor2()

      Returns the anchor point used to find the ending point for the gradient (as specified via the constructor). There is no setter method because instances of this class are immutable.
      Returns:
        The anchor point (never `null`).

    - #### fill

          public void fill(java.awt.Graphics2D g2,
                           java.awt.geom.Rectangle2D area)

      Fills the specified `area` with a gradient paint created using the colors and anchor points of this painter.
      Specified by:
        `fill` in interface `RectanglePainter`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `area` - the area to fill (`null` not permitted).

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this instance for equality with an arbitrary object.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object (`null` not permitted).
      Returns:
        A boolean.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`