Class StrategyBasedLinearGradientBuilder


public class StrategyBasedLinearGradientBuilder extends AbstractLinearGradientBuilder
The linear gradient builder with automatic coordinates vector evaluation for the target filled area based on configured strategy
  • Constructor Details

    • StrategyBasedLinearGradientBuilder

      public StrategyBasedLinearGradientBuilder()
      Create a new instance of the builder
  • Method Details

    • setGradientDirectionAsCentralRotationAngle

      public StrategyBasedLinearGradientBuilder setGradientDirectionAsCentralRotationAngle (double radians)
      Set the strategy to use the minimal coordinates vector that passes through the central point of the target rectangle area, rotated by the specified amount of radians counter clockwise and covers the area to be filled. Zero angle corresponds to the vector from bottom to top.
      radians - the radians value to rotate the coordinates vector
      the current builder instance
    • setGradientDirectionAsStrategy

      public StrategyBasedLinearGradientBuilder setGradientDirectionAsStrategy (StrategyBasedLinearGradientBuilder.GradientStrategy gradientStrategy)
      Set the strategy to predefined one
      gradientStrategy - the strategy to set
      the current builder instance
    • getRotateVectorAngle

      public double getRotateVectorAngle()
      Get the last set rotate vector angle
      the last set rotate vector angle
    • getGradientStrategy

      Get the last set predefined strategy
      the last set predefined strategy
    • isCentralRotationAngleStrategy

      public boolean isCentralRotationAngleStrategy()
      Is the central rotation angle strategy was set last
      true if the last strategy that has been set is a custom rotation angle
    • getGradientVector

      protected Point[] getGradientVector (Rectangle targetBoundingBox, AffineTransform contextTransform)
      Description copied from class: AbstractLinearGradientBuilder
      Returns the base gradient vector in gradient vector space. This vector would be set as shading coordinates vector and its length would be used to translate all color stops absolute offsets into the relatives.
      Specified by:
      getGradientVector in class AbstractLinearGradientBuilder
      targetBoundingBox - the rectangle to be covered by constructed color in current space
      contextTransform - the current canvas transformation
      the array of exactly two elements specifying the gradient coordinates vector