org.apache.fop.pdf

## Class PDFFunction

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFFunction

- All Implemented Interfaces:
    PDFWritable

      public class PDFFunction
      extends PDFObject

  class representing a PDF Function. PDF Functions represent parameterized mathematical formulas and sampled representations with arbitrary resolution. Functions are used in two areas: device-dependent rasterization information for halftoning and transfer functions, and color specification for smooth shading (a PDF 1.3 feature). All PDF Functions have a FunctionType (0,2,3, or 4), a Domain, and a Range.

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.pdf.PDFObject

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFFunction(Function function)`
    `PDFFunction(Function function, java.util.List<PDFFunction> pdfFunctions)`
    `PDFFunction(java.util.List<java.lang.Double> domain, java.util.List<java.lang.Double> range, float[] cZero, float[] cOne, double interpolationExponentN)` create an complete Function object of Type 2, an Exponential Interpolation function.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `contentEquals(PDFObject obj)` Check if the other PDFObject has the same content as the current object.
    `Function` | `getFunction()`
    `byte[]` | `toByteString()`
    `byte[]` | `toPDF()` represent as PDF.

    - ### Methods inherited from class org.apache.fop.pdf.PDFObject

      `encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getChildren, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDFString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PDFFunction

          public PDFFunction(java.util.List<java.lang.Double> domain,
                             java.util.List<java.lang.Double> range,
                             float[] cZero,
                             float[] cOne,
                             double interpolationExponentN)

      create an complete Function object of Type 2, an Exponential Interpolation function. Use null for an optional object parameter if you choose not to use it. For optional int parameters, pass the default.
      Parameters:
        `domain` - List objects of Double objects. This is the domain of the function. See page 264 of the PDF 1.3 Spec.
        `range` - List of Doubles that is the Range of the function. See page 264 of the PDF 1.3 Spec.
        `cZero` - This is a vector of Double objects which defines the function result when x=0. This attribute is optional. It's described on page 268 of the PDF 1.3 spec.
        `cOne` - This is a vector of Double objects which defines the function result when x=1. This attribute is optional. It's described on page 268 of the PDF 1.3 spec.
        `interpolationExponentN` - This is the inerpolation exponent. This attribute is required. PDF Spec page 268

    - #### PDFFunction

          public PDFFunction(Function function)

    - #### PDFFunction

          public PDFFunction(Function function,
                             java.util.List<PDFFunction> pdfFunctions)

  - ### Method Detail

    - #### getFunction

          public Function getFunction()

    - #### toPDF

          public byte[] toPDF()

      represent as PDF. Whatever the FunctionType is, the correct representation spits out. The sets of required and optional attributes are different for each type, but if a required attribute's object was constructed as null, then no error is raised. Instead, the malformed PDF that was requested by the construction is dutifully output. This policy should be reviewed.
      Overrides:
        `toPDF` in class `PDFObject`
      Returns:
        the PDF string.

    - #### toByteString

          public byte[] toByteString()

    - #### contentEquals

          protected boolean contentEquals(PDFObject obj)

      Check if the other PDFObject has the same content as the current object.

      Note: This function has a contract which is less binding than `Object.equals(Object)`. Whereas equals would require all values to be identical, this method is not required to check everything. In the case of PDFObjects, this means that the overriding function does not have to check for `PDFObject.getObjectID()`.

      Overrides:
        `contentEquals` in class `PDFObject`
      Parameters:
        `obj` - object to compare to.
      Returns:
        true if the other object has the same content.

Copyright 1999-2021 The Apache Software Foundation. All Rights Reserved.