Class Line
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.shading.Line
-
class Line extends java.lang.Object
This class describes a rasterized line. This was done as part of GSoC2014, Tilman Hausherr is the mentor.
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
color0
private float[]
color1
protected java.util.Set<java.awt.Point>
linePoints
private java.awt.Point
point0
private java.awt.Point
point1
-
Constructor Summary
Constructors Constructor Description Line(java.awt.Point p0, java.awt.Point p1, float[] c0, float[] c1)
Constructor of class Line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected float[]
calcColor(java.awt.Point p)
Calculate the color of a point on a rasterized line by linear interpolation.private java.util.Set<java.awt.Point>
calcLine(int x0, int y0, int x1, int y1)
Calculate the points of a line with Bresenham's line algorithm Bresenham's line algorithm
-
-
-
Method Detail
-
calcLine
private java.util.Set<java.awt.Point> calcLine(int x0, int y0, int x1, int y1)
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
protected float[] calcColor(java.awt.Point p)
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
-
-