org.apache.pdfbox.pdmodel.common.function
abstract public class: PDFunction [javadoc |
source]
java.lang.Object
org.apache.pdfbox.pdmodel.common.function.PDFunction
All Implemented Interfaces:
COSObjectable
Direct Known Subclasses:
PDDictionaryFunction, PDStreamFunction, PDFunctionType4, PDFunctionType3, PDFunctionType2, PDFunctionType0
This class represents a function in a PDF document.
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.pdfbox.pdmodel.common.function.PDFunction Detail: |
abstract public COSArray Eval(COSArray input) throws IOException
Evaluates the function at the given input.
ReturnValue = f(input) |
public static PDFunction create(COSBase function) throws IOException {
PDFunction retval = null;
if( function instanceof COSObject )
{
function = ((COSObject)function).getCOSObject();
}
if( function instanceof COSDictionary )
{
COSDictionary funcDic = (COSDictionary)function;
int functionType = funcDic.getInt( "FunctionType" );
if( function instanceof COSStream )
{
if( functionType == 0 )
{
retval = new PDFunctionType0(new PDStream((COSStream)function));
}
else if( functionType == 4 )
{
retval = new PDFunctionType4(new PDStream((COSStream)function));
}
else
{
throw new IOException( "Error: Unknown stream function type " + functionType );
}
}
else
{
if( functionType == 2 )
{
retval = new PDFunctionType2(funcDic);
}
else if( functionType == 3 )
{
retval = new PDFunctionType3(funcDic);
}
else
{
throw new IOException( "Error: Unknown dictionary function type " + functionType );
}
}
}
else
{
throw new IOException( "Error: Unknown COS type for function " + function );
}
return retval;
}
Create the correct PD Model function based on the COS base function. |
abstract public PDRange getDomainForInput(int n)
This will get the range for a certain input parameter. This is will never
return null. If it is not present then the range 0 to 0 will
be returned. |
abstract public int getNumberOfInputParameters()
This will get the number of input parameters that
have a domain specified. |
abstract public int getNumberOfOutputParameters()
This will get the number of output parameters that
have a range specified. A range for output parameters
is optional so this may return zero for a function
that does have output parameters, this will simply return the
number that have the rnage specified. |
abstract public PDRange getRangeForOutput(int n)
This will get the range for a certain output parameters. This is will never
return null. If it is not present then the range 0 to 0 will
be returned. |
abstract public void setDomainForInput(PDRange range,
int n)
This will set the domain for the input values. |
abstract public void setRangeForOutput(PDRange range,
int n)
This will set the a range for output parameter. |