Class Line
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.Line
This class describes a rasterized line. This was done as part of GSoC2014,
Tilman Hausherr is the mentor.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected float[]
Calculate the color of a point on a rasterized line by linear interpolation.calcLine
(int x0, int y0, int x1, int y1) Calculate the points of a line with Bresenham's line algorithm Bresenham's line algorithm
-
Field Details
-
point0
-
point1
-
color0
private final float[] color0 -
color1
private final float[] color1 -
linePoints
-
-
Constructor Details
-
Line
Constructor of class Line.- Parameters:
p0
- one end of a linep1
- the other end of the linec0
- color of point p0c1
- color of point p1
-
-
Method Details
-
calcLine
Calculate the points of a line with Bresenham's line algorithm Bresenham's line algorithm- Parameters:
x0
- coordinatey0
- coordinatex1
- coordinatey1
- coordinate- Returns:
- all the points on the rasterized line from (x0, y0) to (x1, y1)
-
calcColor
Calculate the color of a point on a rasterized line by linear interpolation.- Parameters:
p
- target point, p should always be contained in linePoints- Returns:
- color
-