iText 8.0.5 API
iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder Class Reference

The linear gradient builder with automatic coordinates vector evaluation for the target filled area based on configured strategy More...

Inheritance diagram for iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder:
iText.Kernel.Colors.Gradients.AbstractLinearGradientBuilder

Public Types

enum   GradientStrategy {
  GradientStrategy.TO_BOTTOM, GradientStrategy.TO_BOTTOM_LEFT, GradientStrategy.TO_BOTTOM_RIGHT, GradientStrategy.TO_LEFT,
  GradientStrategy.TO_RIGHT, GradientStrategy.TO_TOP, GradientStrategy.TO_TOP_LEFT, GradientStrategy.TO_TOP_RIGHT
}
  Specifies the predefined strategies More...
 

Public Member Functions

  StrategyBasedLinearGradientBuilder ()
  Create a new instance of the builder More...
 
virtual iText.Kernel.Colors.Gradients.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. More...
 
virtual iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder  SetGradientDirectionAsStrategy (StrategyBasedLinearGradientBuilder.GradientStrategy gradientStrategy)
  Set the strategy to predefined one More...
 
virtual double  GetRotateVectorAngle ()
  Get the last set rotate vector angle More...
 
virtual StrategyBasedLinearGradientBuilder.GradientStrategy  GetGradientStrategy ()
  Get the last set predefined strategy More...
 
virtual bool  IsCentralRotationAngleStrategy ()
  Is the central rotation angle strategy was set last More...
 
- Public Member Functions inherited from iText.Kernel.Colors.Gradients.AbstractLinearGradientBuilder
virtual AbstractLinearGradientBuilder  AddColorStop (GradientColorStop gradientColorStop)
  Adds the new color stop to the end ( more info ). More...
 
virtual AbstractLinearGradientBuilder  SetSpreadMethod (GradientSpreadMethod gradientSpreadMethod)
  Set the spread method to use for the gradient More...
 
virtual IList< GradientColorStop GetColorStops ()
  Get the copy of current color stops list. More...
 
virtual GradientSpreadMethod  GetSpreadMethod ()
  Get the current spread method More...
 
virtual Color  BuildColor (Rectangle targetBoundingBox, AffineTransform contextTransform, PdfDocument document)
  Builds the iText.Kernel.Colors.Color object representing the linear gradient with specified configuration that fills the target bounding box. More...
 

Package Functions

override Point[]  GetGradientVector (Rectangle targetBoundingBox, AffineTransform contextTransform)
  Returns the base gradient vector in gradient vector space. More...
 
- Package Functions inherited from iText.Kernel.Colors.Gradients.AbstractLinearGradientBuilder
virtual AffineTransform  GetCurrentSpaceToGradientVectorSpaceTransformation (Rectangle targetBoundingBox, AffineTransform contextTransform)
  Returns the current space to gradient vector space transformations that should be applied to the shading color. More...
 

Additional Inherited Members

- Static Package Functions inherited from iText.Kernel.Colors.Gradients.AbstractLinearGradientBuilder
static double[]  EvaluateCoveringDomain (Point[] coords, Rectangle toCover)
  Evaluates the minimal domain that covers the box with vector normals. More...
 
static Point[]  CreateCoordinatesForNewDomain (double[] newDomain, Point[] baseVector)
  Expand the base vector to cover the new domain More...
 
- Static Package Attributes inherited from iText.Kernel.Colors.Gradients.AbstractLinearGradientBuilder
const double  ZERO_EPSILON = 1E-10
  The epsilon value used for data creation More...
 

Detailed Description

The linear gradient builder with automatic coordinates vector evaluation for the target filled area based on configured strategy

Member Enumeration Documentation

◆ GradientStrategy

Specifies the predefined strategies

Enumerator
TO_BOTTOM 

Gradient vector from the middle of the top side to the middle of the bottom side

TO_BOTTOM_LEFT 

Evaluates the gradient vector in such way that the first color would be painted at the top right corner, the last one - at the bottom left corner and the middle color line would pass through left corners

TO_BOTTOM_RIGHT 

Evaluates the gradient vector in such way that the first color would be painted at the top left corner, the last one - at the bottom right corner and the middle color line would pass through left corners

TO_LEFT 

Gradient vector from the middle of the right side to the middle of the left side

TO_RIGHT 

Gradient vector from the middle of the left side to the middle of the right side

TO_TOP 

Gradient vector from the middle of the bottom side to the middle of the top side

TO_TOP_LEFT 

Evaluates the gradient vector in such way that the first color would be painted at the bottom right corner, the last one - at the top left corner and the middle color line would pass through left corners

TO_TOP_RIGHT 

Evaluates the gradient vector in such way that the first color would be painted at the bottom left corner, the last one - at the top right corner and the middle color line would pass through left corners

Constructor & Destructor Documentation

◆ StrategyBasedLinearGradientBuilder()

iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder.StrategyBasedLinearGradientBuilder ( )
inline

Create a new instance of the builder

Member Function Documentation

◆ GetGradientStrategy()

virtual StrategyBasedLinearGradientBuilder.GradientStrategy iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder.GetGradientStrategy ( )
inlinevirtual

Get the last set predefined strategy

Returns
the last set predefined strategy

◆ GetGradientVector()

override Point [] iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder.GetGradientVector ( Rectangle  targetBoundingBox,
AffineTransform  contextTransform 
)
inlinepackagevirtual

Returns the base gradient vector in gradient vector space.

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.

Parameters
targetBoundingBox the rectangle to be covered by constructed color in current space
contextTransform the current canvas transformation
Returns
the array of exactly two elements specifying the gradient coordinates vector

Implements iText.Kernel.Colors.Gradients.AbstractLinearGradientBuilder.

◆ GetRotateVectorAngle()

virtual double iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder.GetRotateVectorAngle ( )
inlinevirtual

Get the last set rotate vector angle

Returns
the last set rotate vector angle

◆ IsCentralRotationAngleStrategy()

virtual bool iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder.IsCentralRotationAngleStrategy ( )
inlinevirtual

Is the central rotation angle strategy was set last

Returns

true if the last strategy that has been set is a custom rotation angle

◆ SetGradientDirectionAsCentralRotationAngle()

virtual iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder.SetGradientDirectionAsCentralRotationAngle ( double  radians )
inlinevirtual

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.

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.

Parameters
radians the radians value to rotate the coordinates vector
Returns
the current builder instance

◆ SetGradientDirectionAsStrategy()

virtual iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder iText.Kernel.Colors.Gradients.StrategyBasedLinearGradientBuilder.SetGradientDirectionAsStrategy ( StrategyBasedLinearGradientBuilder.GradientStrategy  gradientStrategy )
inlinevirtual

Set the strategy to predefined one

Parameters
gradientStrategy the strategy to set
Returns
the current builder instance