Table of Contents

Class PdfFunction

Namespace
UglyToad.PdfPig.Functions
Assembly
UglyToad.PdfPig.dll

This class represents a function in a PDF document.

public abstract class PdfFunction
Inheritance
PdfFunction
Inherited Members

Constructors

PdfFunction(DictionaryToken, ArrayToken, ArrayToken)

This class represents a function in a PDF document.

public PdfFunction(DictionaryToken function, ArrayToken domain, ArrayToken range)

Parameters

function DictionaryToken
domain ArrayToken
range ArrayToken

PdfFunction(StreamToken, ArrayToken, ArrayToken)

This class represents a function in a PDF document.

public PdfFunction(StreamToken function, ArrayToken domain, ArrayToken range)

Parameters

function StreamToken
domain ArrayToken
range ArrayToken

Properties

FunctionDictionary

The function dictionary.

public DictionaryToken FunctionDictionary { get; }

Property Value

DictionaryToken

FunctionStream

The function stream.

public StreamToken FunctionStream { get; }

Property Value

StreamToken

FunctionType

Returns the function type. Possible values are:

  • 0Sampled function
  • 2Exponential interpolation function
  • 3Stitching function
  • 4PostScript calculator function
public abstract FunctionTypes FunctionType { get; }

Property Value

FunctionTypes

the function type.

NumberOfInputParameters

This will get the number of input parameters that have a domain specified.

public int NumberOfInputParameters { get; }

Property Value

int

The number of input parameters that have a domain specified.

NumberOfOutputParameters

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 range specified.

public int NumberOfOutputParameters { get; }

Property Value

int

The number of output parameters that have a range specified.

RangeValues

Returns all ranges for the output values as ArrayToken. Required for type 0 and type 4 functions.

protected ArrayToken RangeValues { get; }

Property Value

ArrayToken

the ranges array.

Methods

ClipToRange(double, double, double)

Clip the given input value to the given range.

public static double ClipToRange(double x, double rangeMin, double rangeMax)

Parameters

x double

x the input value

rangeMin double

the min value of the range

rangeMax double

the max value of the range

Returns

double

the clipped value

ClipToRange(double[])

Clip the given input values to the ranges.

protected double[] ClipToRange(double[] inputValues)

Parameters

inputValues double[]

inputValues the input values

Returns

double[]

the clipped values

Eval(params double[])

Evaluates the function at the given input. ReturnValue = f(input)

public abstract double[] Eval(params double[] input)

Parameters

input double[]

The array of input values for the function. In many cases will be an array of a single value, but not always.

Returns

double[]

The of outputs the function returns based on those inputs. In many cases will be an array of a single value, but not always.

GetDictionary()

Returns the function's dictionary. If FunctionDictionary is defined, it will be returned. If not, the FunctionStream's StreamDictionary will be returned.

public DictionaryToken GetDictionary()

Returns

DictionaryToken

GetDomainForInput(int)

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.

public PdfRange GetDomainForInput(int n)

Parameters

n int

The parameter number to get the domain for.

Returns

PdfRange

The domain range for this component.

GetRangeForOutput(int)

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.

public PdfRange GetRangeForOutput(int n)

Parameters

n int

The output parameter number to get the range for.

Returns

PdfRange

The range for this component.

Interpolate(double, double, double, double, double)

For a given value of x, interpolate calculates the y value on the line defined by the two points (xRangeMin, xRangeMax) and (yRangeMin, yRangeMax).

protected static double Interpolate(double x, double xRangeMin, double xRangeMax, double yRangeMin, double yRangeMax)

Parameters

x double

the value to be interpolated value.

xRangeMin double

the min value of the x range

xRangeMax double

the max value of the x range

yRangeMin double

the min value of the y range

yRangeMax double

the max value of the y range

Returns

double

the interpolated y value