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 Summary
Modifier and TypeMethodDescriptionaddStopColor(GradientColorStop gradientColorStop) Adds the new color stop to the end (more info).buildColor(Rectangle targetBoundingBox, AffineTransform contextTransform, PdfDocument document) Builds theColorobject representing the gradient with specified configuration that fills the target bounding box.setSpread(GradientSpreadMethod gradientSpreadMethod) Set the spread method to use for the gradient.setSvgLuminanceMode(boolean svgLuminanceMode) Sets whether to build a DeviceGray gradient using the SVG luminance coefficients.
-
Method Details
-
addStopColor
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
Set the spread method to use for the gradient.- Parameters:
-
gradientSpreadMethod- the gradient spread method to set - Returns:
- the current builder instance
-
setSvgLuminanceMode
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-trueto build a luminance gradient,falseto build an RGB gradient - Returns:
- the current builder instance
-
buildColor
Color buildColor(Rectangle targetBoundingBox, AffineTransform contextTransform, PdfDocument document) Builds theColorobject 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. Thenullvalue 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- thePdfDocumentfor which the linear gradient would be built. - Returns:
-
the constructed
Colorornullif no color to be applied or base gradient vector has been specified
-