All Known Implementing Classes:
DDATriangler, IntBresenhamTriangler

public interface Triangler
An interface for triangle rasterizers.

Accepts a Triangle as the shape to draw and Filler to get the colors for individual pixels.

The library contains some implementations in the same package.

Example usage:


 final Canvas canvas; // javafx canvas to render on

 final Triangler triangler = new DDATriangler(canvas.getGraphicsContext2D());
 triangler.setFiller(new MonotoneTriangleFiller(HTMLColorf.RED));
 // any implementation can be used

 final Triangle triangle = new Polygon3(
         new Point2f(0, 1),
         new Point2f(1, 0),
         new Point2f(1, 1));

 triangler.draw(triangle);
 
Since:
2.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Draws the Triangle with the currently used filler.
    Gets a Filler currently used by this triangler.
    void
    Sets the Filler to use for the rasterization.
  • Method Details

    • filler

      Filler filler()
      Gets a Filler currently used by this triangler.
      Returns:
      reference to the currently used filler
      Since:
      2.0.0
      See Also:
    • setFiller

      void setFiller(Filler f)
      Sets the Filler to use for the rasterization.
      Parameters:
      f - the filler to use
      Throws:
      NullPointerException - if f is null
      Since:
      2.0.0
      See Also:
    • draw

      void draw(Triangle t)
      Draws the Triangle with the currently used filler.
      Parameters:
      t - the Triangle to draw
      Throws:
      NullPointerException - if t is null
      Since:
      2.0.0