# PdfSampledFunction Class

Type 0 functions use a sequence of sample values (contained in a stream) to provide an approximation for functions whose domains and ranges are bounded. The samples are organized as an *m*-dimensional table in which each entry has *n* components.

`public sealed class PdfSampledFunction : PdfFunction`

```
Public NotInheritable Class PdfSampledFunction
Inherits PdfFunction
```

- Inheritance:
- PdfSampledFunction

### Constructors

#### PdfSampledFunction()

Initializes a new instance of the PdfSampledFunction class. The Domain, Range, Size, and Samples properties should be subsequently populated and the BitsPerSample property should be set.

### Properties

#### BitsPerSample

*(Required)* The number of bits that shall represent each sample. If the function has multiple output values, each one shall occupy BitsPerSample bits. Valid values shall be 1, 2, 4, 8, 12, 16, 24, and 32.

##### Property Value

- System.Int32

The number of bits that shall represent each sample.

##### Exceptions

- System.ArgumentOutOfRangeException

Value is not 1, 2, 4, 8, 12, 16, 24, nor 32.

##### See Also

#### Decode

*(Optional)* A collection of *n*PdfNumberRanges specifying the linear mapping of sample values into the range appropriate for the function's output values.

Default value (if null): same as the value of Range.

`public PdfNumberRangeCollection Decode { get; set; }`

`Public Property Decode As PdfNumberRangeCollection`

##### Property Value

A collection of *n*PdfNumberRanges specifying the linear mapping of sample values into the range appropriate for the function's output values.

##### See Also

#### Encode

*(Optional)* A collection of *m*PdfNumberRanges specifying the linear mapping of input values into the domain of the function's sample table.

Default value (if null): [ { 0, Size[0] − 1 }, { 0, Size[1] − 1 }, …].

`public PdfNumberRangeCollection Encode { get; set; }`

`Public Property Encode As PdfNumberRangeCollection`

##### Property Value

A collection of *m*PdfNumberRanges specifying the linear mapping of input values into the domain of the function's sample table.

##### See Also

#### FunctionType

Gets the Sampled value.

`public override PdfFunctionType FunctionType { get; }`

`Public Overrides ReadOnly Property FunctionType As PdfFunctionType`

##### Property Value

The Sampled value.

##### Overrides

#### Order

*(Optional)* The order of interpolation between samples. Valid values shall be 1 and 3, specifying linear and cubic spline interpolation, respectively.

Default value: 1.

##### Property Value

- System.Int32

The order of interpolation between samples.

##### Exceptions

- System.ArgumentOutOfRangeException

Value is not 1 nor 3.

##### See Also

#### Samples

Gets or sets the samples organized as an *m*-dimensional table in which each entry has *n* components.

```
[CLSCompliant(false)]
public uint[] Samples { get; set; }
```

```
<CLSCompliant(False)>
Public Property Samples As UInteger()
```

##### Property Value

- UInt32[]

The samples organized as an *m*-dimensional table in which each entry has *n* components.

##### Remarks

Each sample value shall be represented as a sequence of BitsPerSample bits.

For a function with multidimensional input (more than one input variable), the sample values in the first dimension vary fastest, and the values in the last dimension vary slowest.

For a function with multidimensional output (more than one output value), the values shall be stored in the same order as Range.

The stream data shall be long enough to contain the entire sample array, as indicated by Size, Range, and BitsPerSample; see 7.3.8.2, "Stream Extent".

##### important

This API is not CLS-compliant because it supports samples whose BitsPerSample is 24 or 32. If you are writing your application in a .NET language that doesn't support UInt32 type, you will have to use GetDictionary(PdfObject) on a PdfSampledFunction instance and then use Open(PdfStreamDataMode, PdfStreamDataState, PdfStreamDataOptions) on the PdfDictionary's Stream to read or write samples.

##### See Also

#### Size

*(Required)* A list of *m* positive integers that shall specify the number of samples in each input dimension of the sample table.

##### Property Value

- System.Collections.Generic.IList<System.Int32>

A list of *m* positive integers that shall specify the number of samples in each input dimension of the sample table.

##### Exceptions

Value is null.

##### See Also

### Inherited Properties

Domain |
(Inherited from PdfFunction) |

Metadata |
(Inherited from PdfObject) |

Range |
(Inherited from PdfFunction) |

### Inherited Methods

Compile() | Compiles the PDF function described by this PdfFunction instance into executable code and produces a delegate that represents the PDF function. (Inherited from PdfFunction) |

Compile(System.Boolean) | Compiles the PDF function described by this PdfFunction instance into executable code and produces a delegate that represents the PDF function. (Inherited from PdfFunction) |