java.lang.Object
io.github.shimeoki.jfx.rasterization.triangle.GradientFiller
All Implemented Interfaces:
Filler

public final class GradientFiller extends Object implements Filler
One of the standard implementations of Filler to fill the triangles with a gradient from three colors.

Linearly interpolates the color based on the barycentric coordinates. The colors are numbered and mapped to the corresponding numbered coordinates of the barycentrics.

Since:
2.0.0
See Also:
  • Constructor Details

    • GradientFiller

      public GradientFiller(Colorf c1, Colorf c2, Colorf c3)
      Creates a new GradientFiller instance.
      Parameters:
      c1 - first color of the gradient
      c2 - second color of the gradient
      c3 - third color of the gradient
      Throws:
      NullPointerException - if at least one parameter is null
      Since:
      2.0.0
  • Method Details

    • color

      public Colorf color(Barycentrics b, Point2i p)
      Description copied from interface: Filler
      Gets the color for the point on specified barycentrics and/or pixel coordinates.

      The parameters can be not copies, but references to the objects, used by the triangler.

      Specified by:
      color in interface Filler
      Parameters:
      b - barycentric coordinates
      p - pixel coordinates
      Returns:
      color for this point; can be null