Class FunctionType2
java.lang.Object
org.openpdf.renderer.function.PDFFunction
org.openpdf.renderer.function.FunctionType2
A type 2 function is an exponential interpolation function, which maps
from one input value to n output values using a simple exponential
formula.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate float[]the function's value at zero for the n outputsprivate float[]the function's value at one for the n outputsprivate floatthe exponentFields inherited from class PDFFunction
TYPE_0, TYPE_2, TYPE_3, TYPE_4 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoFunction(float[] inputs, int inputOffset, float[] outputs, int outputOffset) Calculate the function value for the input.floatgetC0(int index) Get the values at zerofloatgetC1(int index) Get the values at onefloatgetN()Get the exponentintGet the number of outputs, n, returned by this functionprotected voidRead the zeros, ones and exponentprotected voidsetC0(float[] c0) Set the values at zeroprotected voidsetC1(float[] c1) Set the values at oneprotected voidsetN(float n) Set the exponentMethods inherited from class PDFFunction
calculate, calculate, getDomain, getFunction, getNumInputs, getRange, getType, interpolate, setDomain, setRange
-
Field Details
-
c0
private float[] c0the function's value at zero for the n outputs -
c1
private float[] c1the function's value at one for the n outputs -
n
private float nthe exponent
-
-
Constructor Details
-
FunctionType2
public FunctionType2()Creates a new instance of FunctionType2
-
-
Method Details
-
parse
Read the zeros, ones and exponent- Specified by:
parsein classPDFFunction- Throws:
IOException
-
doFunction
protected void doFunction(float[] inputs, int inputOffset, float[] outputs, int outputOffset) Calculate the function value for the input. For each output (j), the function value is: C0(j) + x^N * (C1(j) - C0(j))- Specified by:
doFunctionin classPDFFunction- Parameters:
inputs- guaranteed to be at least as big asgetNumInputs()and all values within rangeinputOffset- 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
-
getNumOutputs
public int getNumOutputs()Description copied from class:PDFFunctionGet the number of outputs, n, returned by this function- Overrides:
getNumOutputsin classPDFFunction- Returns:
- the number of output values this function will return
-
getN
public float getN()Get the exponent -
setN
protected void setN(float n) Set the exponent -
getC0
public float getC0(int index) Get the values at zero -
setC0
protected void setC0(float[] c0) Set the values at zero -
getC1
public float getC1(int index) Get the values at one -
setC1
protected void setC1(float[] c1) Set the values at one
-