Interface Triangler
- 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
-
Method Details
-
filler
Filler filler()Gets aFillercurrently used by this triangler.- Returns:
- reference to the currently used filler
- Since:
- 2.0.0
- See Also:
-
setFiller
Sets theFillerto use for the rasterization.- Parameters:
f- the filler to use- Throws:
NullPointerException- iffisnull- Since:
- 2.0.0
- See Also:
-
draw
Draws theTrianglewith the currently used filler.- Parameters:
t- theTriangleto draw- Throws:
NullPointerException- iftisnull- Since:
- 2.0.0
-