GemBox.Pdf
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PdfSampledFunction Class

    Namespace:
    GemBox.Pdf.Functions
    Assembly:
    GemBox.Pdf.dll

    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.

    • C#
    • VB.NET
    public sealed class PdfSampledFunction : PdfFunction
    Public NotInheritable Class PdfSampledFunction
        Inherits PdfFunction
    Inheritance:
    System.Object
    PdfObject
    PdfFunction
    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.

    • C#
    • VB.NET
    public PdfSampledFunction()
    Public Sub New

    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.

    • C#
    • VB.NET
    public int BitsPerSample { get; set; }
    Public Property BitsPerSample As Integer
    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
    PDF Specification ISO 32000-1:2008, section '7.10.2 Type 0 (Sampled) Functions'

    Decode

    (Optional) A collection of nPdfNumberRanges 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.

    • C#
    • VB.NET
    public PdfNumberRangeCollection Decode { get; set; }
    Public Property Decode As PdfNumberRangeCollection
    Property Value
    PdfNumberRangeCollection

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

    See Also
    PDF Specification ISO 32000-1:2008, section '7.10.2 Type 0 (Sampled) Functions'

    Encode

    (Optional) A collection of mPdfNumberRanges 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 }, …].

    • C#
    • VB.NET
    public PdfNumberRangeCollection Encode { get; set; }
    Public Property Encode As PdfNumberRangeCollection
    Property Value
    PdfNumberRangeCollection

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

    See Also
    PDF Specification ISO 32000-1:2008, section '7.10.2 Type 0 (Sampled) Functions'

    FunctionType

    Gets the Sampled value.

    • C#
    • VB.NET
    public override PdfFunctionType FunctionType { get; }
    Public Overrides ReadOnly Property FunctionType As PdfFunctionType
    Property Value
    PdfFunctionType

    The Sampled value.

    Overrides
    PdfFunction.FunctionType

    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.

    • C#
    • VB.NET
    public int Order { get; set; }
    Public Property Order As Integer
    Property Value
    System.Int32

    The order of interpolation between samples.

    Exceptions
    System.ArgumentOutOfRangeException

    Value is not 1 nor 3.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.10.2 Type 0 (Sampled) Functions'

    Samples

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

    • C#
    • VB.NET
    [CLSCompliant(false)]
    public uint[] Samples { get; set; }
    <CLSCompliant(False)>
    Public Property Samples As UInteger()
    Property Value
    System.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 System.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
    PDF Specification ISO 32000-1:2008, section '7.10.2 Type 0 (Sampled) Functions'

    Size

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

    • C#
    • VB.NET
    public IList<int> Size { get; set; }
    Public Property Size As IList(Of Integer)
    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
    System.ArgumentNullException

    Value is null.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.10.2 Type 0 (Sampled) Functions'

    Inherited Properties

    Domain

    (Required) A collection of mPdfNumberRanges, where m shall be the number of input values. For each i from 0 to m − 1, Domain[i].First shall be less than or equal to Domain[i].Last, and the ith input value, x[i], shall lie in the interval Domain[i].First ≤ x[i] ≤ Domain[i].Last. Input values outside the declared domain shall be clipped to the nearest boundary value.

    (Inherited from PdfFunction)

    Metadata

    (Optional; PDF 1.4) A metadata stream containing metadata for the component.

    (Inherited from PdfObject)

    Range

    (Required for PdfSampledFunctions and PdfPostScriptCalculatorFunctions, optional otherwise) A collection of nPdfNumberRanges, where n shall be the number of output values. For each j from 0 to n − 1, Range[j].First shall be less than or equal to Range[j].Last, and the jth output value, y[j] , shall lie in the interval Range[j].First ≤ y[j] ≤ Range[j].Last. Output values outside the declared range shall be clipped to the nearest boundary value. If this entry is absent, no clipping shall be done.

    (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)

    Extension Methods

    PdfObjectExtensions.GetDictionary(PdfObject)
    PdfObjectExtensions.GetOrAddDictionary(PdfObject)
    PdfObjectExtensions.GetArray(PdfObject)

    See Also

    PDF Specification ISO 32000-1:2008, section '7.10.2 Type 0 (Sampled) Functions'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.