Class Patch
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.Patch
- Direct Known Subclasses:
CoonsPatch
,TensorPatch
Patch is extended by CoonsPatch and TensorPatch. This was done as part of
GSoC2014, Tilman Hausherr is the mentor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Point2D[][]
protected float[][]
protected int[]
protected List<ShadedTriangle>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.protected float[][]
Get the implicit color for flag = 1.protected abstract Point2D[]
Get the implicit edge for flag = 1.protected float[][]
Get implicit color for flag = 2.protected abstract Point2D[]
Get the implicit edge for flag = 2.protected float[][]
Get implicit color for flag = 3.protected abstract Point2D[]
Get the implicit edge for flag = 3.protected double
Calculate the distance from point ps to point pe.protected List<ShadedTriangle>
getShadedTriangles
(CoordinateColorPair[][] patchCC) An assistant method to accomplish type 6 and type 7 shading.protected boolean
isEdgeALine
(Point2D[] ctl) Whether the for control points are on a line.private boolean
-
Field Details
-
controlPoints
-
cornerColor
protected float[][] cornerColor -
level
protected int[] level -
listOfTriangles
-
-
Constructor Details
-
Patch
Patch(float[][] color) Constructor of Patch.- Parameters:
color
- 4 corner's colors
-
-
Method Details
-
getFlag1Edge
Get the implicit edge for flag = 1.- Returns:
- implicit control points
-
getFlag2Edge
Get the implicit edge for flag = 2.- Returns:
- implicit control points
-
getFlag3Edge
Get the implicit edge for flag = 3.- Returns:
- implicit control points
-
getFlag1Color
protected float[][] getFlag1Color()Get the implicit color for flag = 1.- Returns:
- color
-
getFlag2Color
protected float[][] getFlag2Color()Get implicit color for flag = 2.- Returns:
- color
-
getFlag3Color
protected float[][] getFlag3Color()Get implicit color for flag = 3.- Returns:
- color
-
getLen
Calculate the distance from point ps to point pe.- Parameters:
ps
- one end of a linepe
- the other end of the line- Returns:
- length of the line
-
isEdgeALine
Whether the for control points are on a line.- Parameters:
ctl
- an edge's control points, the size of ctl is 4- Returns:
- true when 4 control points are on a line, otherwise false
-
edgeEquationValue
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
- target pointp1
- one end of a linep2
- the other end of a line- Returns:
- calculated value
-
getShadedTriangles
An assistant method to accomplish type 6 and type 7 shading.- Parameters:
patchCC
- all the crossing point coordinates and color of a grid- Returns:
- a ShadedTriangle list which can compose the grid patch
-
overlaps
-