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

pack-priv abstract Class Patch

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.pdfbox.pdmodel.graphics.shading.TensorPatch, org.apache.pdfbox.pdmodel.graphics.shading.CoonsPatch
Imports
java.awt.geom.Point2D, java.util.ArrayList, .List

Patch is extended by CoonsPatch and TensorPatch. This was done as part of GSoC2014, Tilman Hausherr is the mentor.
Author
Shaola Ren

Field Summary

Modifier and TypeField and Description
protected Point2D[][]
protected final float[][]
protected int[]
protected List<ShadedTriangle>

Constructor Summary

AccessConstructor and Description
pack-priv
Patch(float[][]
4 corner's colors
color
)

Constructor of Patch.

Method Summary

Modifier and TypeMethod and Description
protected double

Returns:

calculated value
edgeEquationValue
(Point2D
target point
p
,
Point2D
one end of a line
p1
,
Point2D
the other end of a line
p2
)

A line from point p1 to point p2 defines an equation, adjust the form of the equation to let the rhs equals 0, then calculate the lhs value by plugging the coordinate of p in the lhs expression.

protected float[][]

Returns:

color
getFlag1Color
()

Get the implicit color for flag = 1.

protected abstract Point2D[]

Returns:

implicit control points
getFlag1Edge
()

Get the implicit edge for flag = 1.

protected float[][]

Returns:

color
getFlag2Color
()

Get implicit color for flag = 2.

protected abstract Point2D[]

Returns:

implicit control points
getFlag2Edge
()

Get the implicit edge for flag = 2.

protected float[][]

Returns:

color
getFlag3Color
()

Get implicit color for flag = 3.

protected abstract Point2D[]

Returns:

implicit control points
getFlag3Edge
()

Get the implicit edge for flag = 3.

protected double

Returns:

length of the line
getLen
(Point2D
one end of a line
ps
,
Point2D
the other end of the line
pe
)

Calculate the distance from point ps to point pe.

protected List<ShadedTriangle>

Returns:

a ShadedTriangle list which can compose the grid patch
getShadedTriangles
(CoordinateColorPair[][]
all the crossing point coordinates and color of a grid
patchCC
)

An assistant method to accomplish type 6 and type 7 shading.

protected boolean

Returns:

true when 4 control points are on a line, otherwise false
isEdgeALine
(Point2D[]
an edge's control points, the size of ctl is 4
ctl
)

Whether the for control points are on a line.

private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

controlPointsback to summary
protected Point2D[][] controlPoints
cornerColorback to summary
protected final float[][] cornerColor
levelback to summary
protected int[] level
listOfTrianglesback to summary
protected List<ShadedTriangle> listOfTriangles

Constructor Detail

Patchback to summary
pack-priv Patch(float[][] color)

Constructor of Patch.

Parameters
color:float[][]

4 corner's colors

Method Detail

edgeEquationValueback to summary
protected double edgeEquationValue(Point2D p, Point2D p1, Point2D p2)

A line from point p1 to point p2 defines an equation, adjust the form of the equation to let the rhs equals 0, then calculate the lhs value by plugging the coordinate of p in the lhs expression.

Parameters
p:Point2D

target point

p1:Point2D

one end of a line

p2:Point2D

the other end of a line

Returns:double

calculated value

getFlag1Colorback to summary
protected float[][] getFlag1Color()

Get the implicit color for flag = 1.

Returns:float[][]

color

getFlag1Edgeback to summary
protected abstract Point2D[] getFlag1Edge()

Get the implicit edge for flag = 1.

Returns:Point2D[]

implicit control points

getFlag2Colorback to summary
protected float[][] getFlag2Color()

Get implicit color for flag = 2.

Returns:float[][]

color

getFlag2Edgeback to summary
protected abstract Point2D[] getFlag2Edge()

Get the implicit edge for flag = 2.

Returns:Point2D[]

implicit control points

getFlag3Colorback to summary
protected float[][] getFlag3Color()

Get implicit color for flag = 3.

Returns:float[][]

color

getFlag3Edgeback to summary
protected abstract Point2D[] getFlag3Edge()

Get the implicit edge for flag = 3.

Returns:Point2D[]

implicit control points

getLenback to summary
protected double getLen(Point2D ps, Point2D pe)

Calculate the distance from point ps to point pe.

Parameters
ps:Point2D

one end of a line

pe:Point2D

the other end of the line

Returns:double

length of the line

getShadedTrianglesback to summary
protected List<ShadedTriangle> getShadedTriangles(CoordinateColorPair[][] patchCC)

An assistant method to accomplish type 6 and type 7 shading.

Parameters
patchCC:CoordinateColorPair[][]

all the crossing point coordinates and color of a grid

Returns:List<ShadedTriangle>

a ShadedTriangle list which can compose the grid patch

isEdgeALineback to summary
protected boolean isEdgeALine(Point2D[] ctl)

Whether the for control points are on a line.

Parameters
ctl:Point2D[]

an edge's control points, the size of ctl is 4

Returns:boolean

true when 4 control points are on a line, otherwise false

overlapsback to summary
private boolean overlaps(Point2D p0, Point2D p1)