org.apache.fop.render.gradient

## Class Function

- java.lang.Object
- - org.apache.fop.render.gradient.Function

-     public class Function
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `Function.SubFunctionRenderer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Function(List<Double> domain, List<Double> range, float[] cZero, float[] cOne, double interpolationExponentN)` create an complete Function object of Type 2, an Exponential Interpolation function.
    `Function(List<Double> domain, List<Double> range, List<Double> encode, byte[] datasource, int bitsPerSample, List<Integer> size)`
    `Function(List<Double> domain, List<Double> range, List<Function> functions, List<Float> bounds, List<Double> encode)` create an complete Function object of Type 3, a Stitching function.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getBitsPerSample()` Gets the bits per sample of the function
    `List<Float>` | `getBounds()` Gets the function bounds
    `float[]` | `getCOne()` Gets the function C1 value (color for gradient)
    `float[]` | `getCZero()` Gets the function C0 value (color for gradient)
    `List<Double>` | `getDomain()` The function domain
    `List<Double>` | `getEncode()` Gets the function encoding
    `List<Function>` | `getFunctions()` Gets the sub-functions
    `int` | `getFunctionType()` Gets the function type
    `double` | `getInterpolationExponentN()` Gets the interpolation exponent of the function
    `int` | `getOrder()` Gets the function order
    `List<Double>` | `getRange()` Gets the function range
    `String` | `output(StringBuilder out, GradientMaker.DoubleFormatter doubleFormatter, Function.SubFunctionRenderer subFunctionRenderer)`
    `void` | `setCOne(float[] cOne)`
    `void` | `setCZero(float[] cZero)`

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

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

- - ### Constructor Detail

    - #### Function

          public Function(List<Double> domain,
                          List<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

    - #### Function

          public Function(List<Double> domain,
                          List<Double> range,
                          List<Function> functions,
                          List<Float> bounds,
                          List<Double> encode)

      create an complete Function object of Type 3, a Stitching 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 objects of Double objects. This is the Range of the function. See page 264 of the PDF 1.3 Spec.
        `functions` - A List of the PDFFunction objects that the stitching function stitches. This attributed is required. It is described on page 269 of the PDF spec.
        `bounds` - This is a vector of Doubles representing the numbers that, in conjunction with Domain define the intervals to which each function from the 'functions' object applies. It must be in order of increasing magnitude, and each must be within Domain. It basically sets how much of the gradient each function handles. This attributed is required. It's described on page 269 of the PDF 1.3 spec.
        `encode` - List objects of Double objects. This is the linear mapping of input values intop the domain of the function's sample table. Default is hard to represent in ascii, but basically [0 (Size0 1) 0 (Size1 1)...]. This attribute is required. See page 270 in the PDF 1.3 spec.

    - #### Function

          public Function(List<Double> domain,
                          List<Double> range,
                          List<Double> encode,
                          byte[] datasource,
                          int bitsPerSample,
                          List<Integer> size)

  - ### Method Detail

    - #### setCZero

          public void setCZero(float[] cZero)

    - #### setCOne

          public void setCOne(float[] cOne)

    - #### getFunctionType

          public int getFunctionType()

      Gets the function type

    - #### getBounds

          public List<Float> getBounds()

      Gets the function bounds

    - #### getDomain

          public List<Double> getDomain()

      The function domain

    - #### getEncode

          public List<Double> getEncode()

      Gets the function encoding

    - #### getFunctions

          public List<Function> getFunctions()

      Gets the sub-functions

    - #### getBitsPerSample

          public int getBitsPerSample()

      Gets the bits per sample of the function

    - #### getInterpolationExponentN

          public double getInterpolationExponentN()

      Gets the interpolation exponent of the function

    - #### getOrder

          public int getOrder()

      Gets the function order

    - #### getRange

          public List<Double> getRange()

      Gets the function range

    - #### getCZero

          public float[] getCZero()

      Gets the function C0 value (color for gradient)

    - #### getCOne

          public float[] getCOne()

      Gets the function C1 value (color for gradient)

    - #### output

          public String output(StringBuilder out,
                               GradientMaker.DoubleFormatter doubleFormatter,
                               Function.SubFunctionRenderer subFunctionRenderer)

Copyright © 2025 Apache Software Foundation. All rights reserved.