Package com.itextpdf.layout.renderer
Class RotationUtils
java.lang.Object
com.itextpdf.layout.renderer.RotationUtils
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MinMaxWidth
countRotationMinMaxWidth
(MinMaxWidth minMaxWidth, AbstractRenderer renderer) This method tries to calculate min-max-width of rotated element using heuristics ofRotationMinMaxWidth.calculate(double, double, MinMaxWidth)
.private static Float
getLayoutRotatedWidth
(AbstractRenderer renderer, float availableWidth, Rectangle previousBBox, double angle) static Float
retrieveRotatedLayoutWidth
(float availableWidth, AbstractRenderer renderer) This method tries to calculate width of not rotated renderer, so after rotation it fits availableWidth.
-
Constructor Details
-
RotationUtils
private RotationUtils()
-
-
Method Details
-
countRotationMinMaxWidth
public static MinMaxWidth countRotationMinMaxWidth(MinMaxWidth minMaxWidth, AbstractRenderer renderer) This method tries to calculate min-max-width of rotated element using heuristics ofRotationMinMaxWidth.calculate(double, double, MinMaxWidth)
. This method may callIRenderer.layout(LayoutContext)
once in best case (if the width is set on element, or if we are really lucky) and three times in worst case.- Parameters:
minMaxWidth
- the minMaxWidth of NOT rotated rendererrenderer
- the actual renderer- Returns:
- minMaxWidth of rotated renderer or original value in case rotated value can not be calculated, or renderer isn't rotated.
-
retrieveRotatedLayoutWidth
This method tries to calculate width of not rotated renderer, so after rotation it fits availableWidth. This method uses heuristics ofRotationMinMaxWidth.calculate(double, double, MinMaxWidth, double)
. It doesn't take into account any of height properties of renderer or height of layoutArea. The minMaxWidth calculations and initial layout may take long time, but they won't be called if the renderer have width property.- Parameters:
availableWidth
- the width of layoutArearenderer
- the actual renderer- Returns:
- the width that should be set as width of layout area to properly layout element, or fallback to
AbstractRenderer.retrieveWidth(float)
in case it can not be calculated, or renderer isn't rotated.
-
getLayoutRotatedWidth
private static Float getLayoutRotatedWidth(AbstractRenderer renderer, float availableWidth, Rectangle previousBBox, double angle)
-