/**
* make a type Exponential interpolation function
* (for shading usually)
- *
- * @param theDomain List objects of Double objects.
+ * @param domain List objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theRange List of Doubles that is the Range of the function.
+ * @param range List of Doubles that is the Range of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theCZero This is a vector of Double objects which defines the function result
+ * @param cZero This is a vector of Double objects which defines the function result
* when x=0.
*
* This attribute is optional.
* It's described on page 268 of the PDF 1.3 spec.
- * @param theCOne This is a vector of Double objects which defines the function result
+ * @param cOne This is a vector of Double objects which defines the function result
* when x=1.
*
* This attribute is optional.
* It's described on page 268 of the PDF 1.3 spec.
- * @param theInterpolationExponentN This is the inerpolation exponent.
+ * @param interpolationExponentN This is the inerpolation exponent.
*
* This attribute is required.
* PDF Spec page 268
- * @param theFunctionType The type of the function, which should be 2.
+ *
* @return the PDF function that was created
*/
- public PDFFunction makeFunction(int theFunctionType, List theDomain,
- List theRange, float[] theCZero,
- float[] theCOne,
- double theInterpolationExponentN) { // type 2
- PDFFunction function = new PDFFunction(theFunctionType, theDomain,
- theRange, theCZero, theCOne,
- theInterpolationExponentN);
+ public PDFFunction makeFunction(List domain, List range, float[] cZero, float[] cOne,
+ double interpolationExponentN) {
+ PDFFunction function = new PDFFunction(domain, range, cZero, cOne, interpolationExponentN);
function = registerFunction(function);
return function;
}
String colorName = ncs.getColorName();
final Double zero = new Double(0d);
final Double one = new Double(1d);
- List theDomain = Arrays.asList(new Double[] {zero, one});
- List theRange = Arrays.asList(new Double[] {zero, one, zero, one, zero, one});
+ List domain = Arrays.asList(new Double[] {zero, one});
+ List range = Arrays.asList(new Double[] {zero, one, zero, one, zero, one});
float[] cZero = new float[] {1f, 1f, 1f};
float[] cOne = ncs.getRGBColor().getColorComponents(null);
- PDFFunction tintFunction = makeFunction(2, theDomain, theRange, cZero, cOne, 1.0d);
+ PDFFunction tintFunction = makeFunction(domain, range, cZero, cOne, 1.0d);
PDFSeparationColorSpace cs = new PDFSeparationColorSpace(colorName, tintFunction);
getDocument().registerObject(cs);
if (res != null) {
*
* This attribute is required.
* PDF Spec page 268
- * @param functionType The type of the function, which should be 2.
*/
- public PDFFunction(int functionType, List<Double> domain, List<Double> range, float[] cZero, float[] cOne,
- double interpolationExponentN) {
- this(new Function(functionType, domain, range, cZero, cOne, interpolationExponentN));
+ public PDFFunction(List<Double> domain, List<Double> range, float[] cZero, float[] cOne,
+ double interpolationExponentN) {
+ this(new Function(domain, range, cZero, cOne, interpolationExponentN));
}
*
* Use null for an optional object parameter if you choose not to use it.
* For optional int parameters, pass the default.
- * @param functionType The type of the function, which should be 2.
* @param domain List objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
* This attribute is required.
* PDF Spec page 268
*/
- public Function(int functionType, List<Double> domain, List<Double> range,
- float[] cZero, float[] cOne, double interpolationExponentN) {
+ public Function(List<Double> domain, List<Double> range, float[] cZero, float[] cOne,
+ double interpolationExponentN) {
this(2, domain, range);
this.cZero = cZero;
this.cOne = cOne;
*
* Use null for an optional object parameter if you choose not to use it.
* For optional int parameters, pass the default.
- * @param functionType This is the function type. It should be 3,
- * for a stitching function.
* @param domain List objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
*
* See page 270 in the PDF 1.3 spec.
*/
- public Function(int functionType, List<Double> domain, List<Double> range,
- List<Function> functions, List<Double> bounds,
- List<Double> encode) {
+ public Function(List<Double> domain, List<Double> range, List<Function> functions,
+ List<Double> bounds, List<Double> encode) {
this(3, domain, range);
this.functions = functions;
this.bounds = bounds;
List<Function> functions = makeFunctions(gradient);
// Gradients are currently restricted to sRGB
PDFDeviceColorSpace colorSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
- Function function = new Function(3, null, null, functions, bounds, null);
+ Function function = new Function(null, null, functions, bounds, null);
int shadingType = gradient instanceof LinearGradientPaint ? 2 : 3;
Shading shading = new Shading(shadingType, colorSpace, coords, function);
return new Pattern(2, shading, matrix);
Color nextColor = colors.get(currentPosition + 1);
float[] c0 = currentColor.getColorComponents(null);
float[] c1 = nextColor.getColorComponents(null);
- Function function = new Function(2, null, null, c0, c1, 1.0);
+ Function function = new Function(null, null, c0, c1, 1.0);
functions.add(function);
}
return functions;