Interface IGradientBuilder

All Known Implementing Classes:
AbstractGradientBuilder, AbstractLinearGradientBuilder, AbstractRadialGradientBuilder, LinearGradientBuilder, RadialGradientBuilder, StrategyBasedLinearGradientBuilder, StrategyBasedRadialGradientBuilder

public interface IGradientBuilder
Contract for gradient builders that can produce Color instances.
  • Method Details

    • addStopColor

      IGradientBuilder addStopColor (GradientColorStop gradientColorStop)
      Adds the new color stop to the end (more info).

      Note: if the previously added color stop's offset would have greater offset than the added one, then the new offset would be normalized to be equal to the previous one. (Comparison made between relative on coordinates vector offsets. If any of them has the absolute offset, then the absolute value would be converted to relative first.)

      Parameters:
      gradientColorStop - the gradient stop color to add
      Returns:
      the current builder instance
    • setSpread

      IGradientBuilder setSpread (GradientSpreadMethod gradientSpreadMethod)
      Set the spread method to use for the gradient.
      Parameters:
      gradientSpreadMethod - the gradient spread method to set
      Returns:
      the current builder instance
    • setSvgLuminanceMode

      IGradientBuilder setSvgLuminanceMode (boolean svgLuminanceMode)
      Sets whether to build a DeviceGray gradient using the SVG luminance coefficients. This method is SVG-specific because PDF and SVG use different luminance formulas. By default, gradients are built in DeviceRGB. The original RGB stop colors are not modified.
      Parameters:
      svgLuminanceMode - true to build a luminance gradient, false to build an RGB gradient
      Returns:
      the current builder instance
    • buildColor

      Color buildColor (Rectangle targetBoundingBox, AffineTransform contextTransform, PdfDocument document)
      Builds the Color object representing the gradient with specified configuration that fills the target bounding box.
      Parameters:
      targetBoundingBox - the bounding box to be filled in current space
      contextTransform - the transformation from the base coordinates space into the current space. The null value is valid and can be used if there is no transformation from base coordinates to current space specified, or it is equal to identity transformation.
      document - the PdfDocument for which the linear gradient would be built.
      Returns:
      the constructed Color or null if no color to be applied or base gradient vector has been specified