org.apache.pdfbox.pdmodel.common.function
Class PDFunctionType0

java.lang.Object
  extended by org.apache.pdfbox.pdmodel.common.function.PDFunction
      extended by org.apache.pdfbox.pdmodel.common.function.PDFunctionType0
All Implemented Interfaces:
COSObjectable

public class PDFunctionType0
extends PDFunction

This class represents a type 0 function in a PDF document.

Version:
$Revision: 1.2 $
Author:
Ben Litchfield

Constructor Summary
PDFunctionType0(COSBase function)
          Constructor.
 
Method Summary
 float[] eval(float[] input)
          Evaluates the function at the given input.
 int getBitsPerSample()
          Get the number of bits that the output value will take up.
 PDRange getDecodeForParameter(int paramNum)
          Get the decode for the input parameter.
 PDRange getEncodeForParameter(int paramNum)
          Get the encode for the input parameter.
 int getFunctionType()
          Returns the function type.
 int[][] getSamples()
          Get all sample values of this function.
 COSArray 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, getDictionary, getDomainForInput, getNumberOfInputParameters, getNumberOfOutputParameters, getPDStream, getRangeForOutput, getRangeValues, interpolate, setDomainValues, setRangeValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFunctionType0

public PDFunctionType0(COSBase function)
Constructor.

Parameters:
functionStream - The function .
Method Detail

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 class PDFunction
Returns:
the function type.

getSize

public COSArray 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.

getSamples

public int[][] getSamples()
Get all sample values of this function.

Returns:
an array with all samples.

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.

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.

getEncodeForParameter

public PDRange getEncodeForParameter(int paramNum)
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

public void setEncodeValues(COSArray encodeValues)
This will set the encode values.

Parameters:
range - The new encode values.

getDecodeForParameter

public PDRange getDecodeForParameter(int paramNum)
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

public void setDecodeValues(COSArray decodeValues)
This will set the decode values.

Parameters:
range - The new decode values.

eval

public float[] eval(float[] input)
             throws IOException
Evaluates the function at the given input. ReturnValue = f(input)

Specified by:
eval in class PDFunction
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 - an IOExcpetion is thrown if something went wrong processing the function.