Class FunctionType0
java.lang.Object
org.loboevolution.pdfview.function.PDFFunction
org.loboevolution.pdfview.function.FunctionType0
A sampled function maps input values to output values by interpolating
along a line or cubic between two known values.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
ConstantCUBIC_INTERPOLATION=3
protected static final int
the valid interpolation methodsFields inherited from class org.loboevolution.pdfview.function.PDFFunction
TYPE_0, TYPE_2, TYPE_3, TYPE_4
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doFunction
(float[] inputs, int inputOffset, float[] outputs, int outputOffset) Subclasses must implement this method to perform the actual function on the given set of data.protected int
Get the number of bits per sampleprotected float
getDecode
(int i) Get the decoding for a particular input parameterprotected float
getEncode
(int i) Get the encoding for a particular input parameterprotected int
getOrder()
Get the interpolation typeprotected int
getSample
(int[] values, int od) Get a component for a sample given m indices and output dimension.protected int
getSize
(int dimension) Get the size of a given input dimensionprotected void
Read the function information from a PDF Objectprotected void
setBitsPerSample
(int bits) Set the number of bits per sampleprotected void
setDecode
(float[] decode) Set the decode arrayprotected void
setEncode
(float[] encode) Set the encode arrayprotected void
setOrder
(int order) Set the interpolation typeprotected void
setSamples
(int[][] samples) Set the table of samplesprotected void
setSize
(int[] size) Set the size of all input dimensionsMethods inherited from class org.loboevolution.pdfview.function.PDFFunction
calculate, calculate, getDomain, getFunction, getNumInputs, getNumOutputs, getRange, interpolate
-
Field Details
-
LINEAR_INTERPOLATION
protected static final int LINEAR_INTERPOLATIONthe valid interpolation methods- See Also:
-
CUBIC_INTERPOLATION
protected static final int CUBIC_INTERPOLATIONConstantCUBIC_INTERPOLATION=3
- See Also:
-
-
Constructor Details
-
FunctionType0
protected FunctionType0()Creates a new instance of FunctionType0
-
-
Method Details
-
parse
Read the function information from a PDF ObjectRead the function information from a PDF Object
- Specified by:
parse
in classPDFFunction
- Parameters:
obj
- aPDFObject
object.- Throws:
IOException
- if any.
-
doFunction
protected void doFunction(float[] inputs, int inputOffset, float[] outputs, int outputOffset) Subclasses must implement this method to perform the actual function on the given set of data. Note that the inputs are guaranteed to be clipped to the domain, while the outputs will be automatically clipped to the range after being returned from this function.Map from m input values to n output values. The number of inputs m must be exactly one half the size of the domain. The number of outputs should match one half the size of the range.
- Specified by:
doFunction
in classPDFFunction
- Parameters:
inputs
- an array ofinvalid reference
float
inputOffset
- the offset into the inputs array to read fromoutputs
- guaranteed to be at least as big asgetNumOutputs()
, but not yet clipped to domainoutputOffset
- the offset into the output array to write to
-
getSize
protected int getSize(int dimension) Get the size of a given input dimension- Parameters:
dimension
- the input dimension to get the size of- Returns:
- the number of samples in the given dimension
-
setSize
protected void setSize(int[] size) Set the size of all input dimensions- Parameters:
size
- an array ofinvalid reference
int
-
getBitsPerSample
protected int getBitsPerSample()Get the number of bits per sample- Returns:
- a
Integer
object.
-
setBitsPerSample
protected void setBitsPerSample(int bits) Set the number of bits per sample- Parameters:
bits
- aInteger
object.
-
getOrder
protected int getOrder()Get the interpolation type- Returns:
- a
Integer
object.
-
setOrder
protected void setOrder(int order) Set the interpolation type- Parameters:
order
- aInteger
object.
-
getEncode
protected float getEncode(int i) Get the encoding for a particular input parameter- Parameters:
i
- the index into the encoding array, which has size 2 * m. the ith entry in the array has index 2i, 2i + 1- Returns:
- the encoding value if the encoding array is set, or the default
-
setEncode
protected void setEncode(float[] encode) Set the encode array- Parameters:
encode
- an array ofinvalid reference
float
-
getDecode
protected float getDecode(int i) Get the decoding for a particular input parameter- Parameters:
i
- the index into the decoding array, which has size 2 * n. the ith entry in the array has index 2i, 2i + 1- Returns:
- the decoding value if the decoding array is set, or the default
-
setDecode
protected void setDecode(float[] decode) Set the decode array- Parameters:
decode
- an array ofinvalid reference
float
-
getSample
protected int getSample(int[] values, int od) Get a component for a sample given m indices and output dimension.- Parameters:
values
- an array of m values determining which sample to selectod
- the output dimension (0 - n) to get the sample in- Returns:
- the sample for the given values and index
-
setSamples
protected void setSamples(int[][] samples) Set the table of samples- Parameters:
samples
- an array ofinvalid reference
int
-