Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.graphics.shading

pack-priv Class Line

extends Object
Class Inheritance
Imports
java.awt.Point, java.util.HashSet, .Set

This class describes a rasterized line. This was done as part of GSoC2014, Tilman Hausherr is the mentor.
Author
Shaola Ren

Field Summary

Modifier and TypeField and Description
private final float[]
private final float[]
protected final Set<Point>
private final Point
private final Point

Constructor Summary

AccessConstructor and Description
pack-priv
Line(Point
one end of a line
p0
,
Point
the other end of the line
p1
,
float[]
color of point p0
c0
,
float[]
color of point p1
c1
)

Constructor of class Line.

Method Summary

Modifier and TypeMethod and Description
protected float[]

Returns:

color
calcColor
(Point
target point, p should always be contained in linePoints
p
)

Calculate the color of a point on a rasterized line by linear interpolation.

private Set<Point>

Returns:

all the points on the rasterized line from (x0, y0) to (x1, y1)
calcLine
(int
coordinate
x0
,
int
coordinate
y0
,
int
coordinate
x1
,
int
coordinate
y1
)

Calculate the points of a line with Bresenham's line algorithm Bresenham's line algorithm

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

color0back to summary
private final float[] color0
color1back to summary
private final float[] color1
linePointsback to summary
protected final Set<Point> linePoints
point0back to summary
private final Point point0
point1back to summary
private final Point point1

Constructor Detail

Lineback to summary
pack-priv Line(Point p0, Point p1, float[] c0, float[] c1)

Constructor of class Line.

Parameters
p0:Point

one end of a line

p1:Point

the other end of the line

c0:float[]

color of point p0

c1:float[]

color of point p1

Method Detail

calcColorback to summary
protected float[] calcColor(Point p)

Calculate the color of a point on a rasterized line by linear interpolation.

Parameters
p:Point

target point, p should always be contained in linePoints

Returns:float[]

color

calcLineback to summary
private Set<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:int

coordinate

y0:int

coordinate

x1:int

coordinate

y1:int

coordinate

Returns:Set<Point>

all the points on the rasterized line from (x0, y0) to (x1, y1)