Class LinearGradientBuilder
java.lang.Object
com.itextpdf.kernel.colors.gradients.AbstractLinearGradientBuilder
com.itextpdf.kernel.colors.gradients.LinearGradientBuilder
The linear gradient builder implementation with direct target gradient vector and shading transformation (
more info
)
-
Field Summary
Fields inherited from class com.itextpdf.kernel.colors.gradients.AbstractLinearGradientBuilder
ZERO_EPSILON
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetCurrentSpaceToGradientVectorSpaceTransformation
(Rectangle targetBoundingBox, AffineTransform contextTransform) Returns the current space to gradient vector space transformations that should be applied to the shading color.Point[]
getGradientVector
(Rectangle targetBoundingBox, AffineTransform contextTransform) Returns the base gradient vector in gradient vector space.setCurrentSpaceToGradientVectorSpaceTransformation
(AffineTransform transformation) Set the linear gradient space transformation which specifies the transformation from the current coordinates space to gradient vector spacesetGradientVector
(double x0, double y0, double x1, double y1) Set coordinates for gradient vector (more info
)Methods inherited from class com.itextpdf.kernel.colors.gradients.AbstractLinearGradientBuilder
addColorStop, buildColor, createCoordinatesForNewDomain, evaluateCoveringDomain, getColorStops, getSpreadMethod, setSpreadMethod
-
Constructor Details
-
LinearGradientBuilder
public LinearGradientBuilder()Constructs the builder instance
-
-
Method Details
-
setGradientVector
Set coordinates for gradient vector (more info
)- Parameters:
-
x0
- the x coordinate of the vector start -
y0
- the y coordinate of the vector start -
x1
- the x coordinate of the vector end -
y1
- the y coordinate of the vector end - Returns:
- the current builder instance
-
setCurrentSpaceToGradientVectorSpaceTransformation
public LinearGradientBuilder setCurrentSpaceToGradientVectorSpaceTransformation(AffineTransform transformation) Set the linear gradient space transformation which specifies the transformation from the current coordinates space to gradient vector spaceThe current space is the one on which linear gradient will be drawn (as a fill or stroke color for shapes on PDF canvas). This transformation mainly used for color lines skewing.
- Parameters:
-
transformation
- theAffineTransform
representing the transformation to set - Returns:
- the current builder instance
-
getGradientVector
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 classAbstractLinearGradientBuilder
- 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
-
getCurrentSpaceToGradientVectorSpaceTransformation
public AffineTransform getCurrentSpaceToGradientVectorSpaceTransformation(Rectangle targetBoundingBox, AffineTransform contextTransform) Description copied from class:AbstractLinearGradientBuilder
Returns the current space to gradient vector space transformations that should be applied to the shading color. The transformation should be invertible as the current target bounding box coordinates should be transformed into the resulted shading space coordinates.- Overrides:
-
getCurrentSpaceToGradientVectorSpaceTransformation
in classAbstractLinearGradientBuilder
- Parameters:
-
targetBoundingBox
- the rectangle to be covered by constructed color in current space -
contextTransform
- the current canvas transformation - Returns:
-
the additional transformation to be concatenated to the current for resulted shading or
null
if no additional transformation is specified
-