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 aFiller
currently used by this triangler.- Returns:
- reference to the currently used filler
- Since:
- 2.0.0
- See Also:
-
setFiller
Sets theFiller
to use for the rasterization.- Parameters:
f
- the filler to use- Throws:
NullPointerException
- iff
isnull
- Since:
- 2.0.0
- See Also:
-
draw
Draws theTriangle
with the currently used filler.- Parameters:
t
- theTriangle
to draw- Throws:
NullPointerException
- ift
isnull
- Since:
- 2.0.0
-