Class PDFunctionType0
java.lang.Object
org.apache.pdfbox.pdmodel.common.function.PDFunction
org.apache.pdfbox.pdmodel.common.function.PDFunctionType0
- All Implemented Interfaces:
COSObjectable
This class represents a type 0 function in a PDF document.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Inner class do to an interpolation in the Nth dimension by comparing the content size of N-1 dimensional objects. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate COSArray
An array of 2 x n numbers specifying the linear mapping of sample values into the range appropriate for the function's output values.private COSArray
An array of 2 x m numbers specifying the linear mapping of input values into the domain of the function's sample table.private static final org.apache.commons.logging.Log
Log instance.private int[][]
The samples of the function.private COSArray
An array of m positive integers specifying the number of samples in each input dimension of the sample table. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
eval
(float[] input) Evaluates the function at the given input.int
Get the number of bits that the output value will take up.getDecodeForParameter
(int paramNum) Get the decode for the input parameter.private COSArray
Returns all decode values as COSArray.getEncodeForParameter
(int paramNum) Get the encode for the input parameter.private COSArray
Returns all encode values as COSArray.int
Returns the function type.int
getOrder()
Get the order of interpolation between samples.getSize()
The "Size" entry, which is the number of samples in each input dimension of the sample table.void
setBitsPerSample
(int bps) Set the number of bits that the output value will take up.void
setDecodeValues
(COSArray decodeValues) This will set the decode values.void
setEncodeValues
(COSArray encodeValues) This will set the encode values.Methods inherited from class org.apache.pdfbox.pdmodel.common.function.PDFunction
clipToRange, clipToRange, create, eval, getCOSObject, getDomainForInput, getNumberOfInputParameters, getNumberOfOutputParameters, getPDStream, getRangeForOutput, getRangeValues, interpolate, setDomainValues, setRangeValues, toString
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOGLog instance. -
encode
An array of 2 x m numbers specifying the linear mapping of input values into the domain of the function's sample table. Default value: [ 0 (Size0 - 1) 0 (Size1 - 1) ...]. -
decode
An array of 2 x n numbers specifying the linear mapping of sample values into the range appropriate for the function's output values. Default value: same as the value of Range -
size
An array of m positive integers specifying the number of samples in each input dimension of the sample table. -
samples
private int[][] samplesThe samples of the function.
-
-
Constructor Details
-
PDFunctionType0
Constructor.- Parameters:
function
- The function.
-
-
Method Details
-
getFunctionType
public int getFunctionType()Returns the function type. Possible values are: 0 - Sampled function 2 - Exponential interpolation function 3 - Stitching function 4 - PostScript calculator function- Specified by:
getFunctionType
in classPDFunction
- Returns:
- the function type.
-
getSize
The "Size" entry, which is the number of samples in each input dimension of the sample table.- Returns:
- A List of java.lang.Integer objects.
-
getBitsPerSample
public int getBitsPerSample()Get the number of bits that the output value will take up. Valid values are 1,2,4,8,12,16,24,32.- Returns:
- Number of bits for each output value.
-
getOrder
public int getOrder()Get the order of interpolation between samples. Valid values are 1 and 3, specifying linear and cubic spline interpolation, respectively. Default is 1. See p.170 in PDF spec 1.7.- Returns:
- order of interpolation.
-
setBitsPerSample
public void setBitsPerSample(int bps) Set the number of bits that the output value will take up. Valid values are 1,2,4,8,12,16,24,32.- Parameters:
bps
- The number of bits for each output value.
-
getEncodeValues
Returns all encode values as COSArray.- Returns:
- the encode array.
-
getDecodeValues
Returns all decode values as COSArray.- Returns:
- the decode array.
-
getEncodeForParameter
Get the encode for the input parameter.- Parameters:
paramNum
- The function parameter number.- Returns:
- The encode parameter range or null if none is set.
-
setEncodeValues
This will set the encode values.- Parameters:
encodeValues
- The new encode values.
-
getDecodeForParameter
Get the decode for the input parameter.- Parameters:
paramNum
- The function parameter number.- Returns:
- The decode parameter range or null if none is set.
-
setDecodeValues
This will set the decode values.- Parameters:
decodeValues
- The new decode values.
-
eval
Evaluates the function at the given input. ReturnValue = f(input)- Specified by:
eval
in classPDFunction
- Parameters:
input
- The array of input values for the function. In many cases will be an array of a single value, but not always.- Returns:
- The of outputs the function returns based on those inputs. In many cases will be an array of a single value, but not always.
- Throws:
IOException
- if something went wrong processing the function.
-