Package com.itextpdf.layout.renderer
Class BackgroundSizeCalculationUtil
- java.lang.Object
-
- com.itextpdf.layout.renderer.BackgroundSizeCalculationUtil
-
final class BackgroundSizeCalculationUtil extends java.lang.Object
Utility class for calculate background image width and height.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
PERCENT_100
private static UnitValue
PERCENT_VALUE_100
-
Constructor Summary
Constructors Modifier Constructor Description private
BackgroundSizeCalculationUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
calculateBackgroundHeight(UnitValue height, float areaHeight, boolean scale, BackgroundImage image, java.lang.Float[] widthAndHeight)
static float[]
calculateBackgroundImageSize(BackgroundImage image, float areaWidth, float areaHeight)
Calculates width and height values for image with a given area params.private static BackgroundSize
calculateBackgroundSizeForArea(BackgroundImage image, float areaWidth, float areaHeight)
private static void
calculateBackgroundWidth(UnitValue width, float areaWidth, boolean scale, BackgroundImage image, java.lang.Float[] widthAndHeight)
private static BackgroundSize
createSizeWithMaxValueSide(boolean maxWidth)
private static void
scaleHeight(float newHeight, BackgroundImage image, java.lang.Float[] imageWidthAndHeight)
private static void
scaleWidth(float newWidth, BackgroundImage image, java.lang.Float[] imageWidthAndHeight)
private static void
setDefaultSizeIfNull(java.lang.Float[] widthAndHeight, float areaWidth, float areaHeight, BackgroundImage image, boolean isGradient)
-
-
-
Field Detail
-
PERCENT_100
private static final int PERCENT_100
- See Also:
- Constant Field Values
-
PERCENT_VALUE_100
private static final UnitValue PERCENT_VALUE_100
-
-
Method Detail
-
calculateBackgroundImageSize
public static float[] calculateBackgroundImageSize(BackgroundImage image, float areaWidth, float areaHeight)
Calculates width and height values for image with a given area params.- Parameters:
image
- theBackgroundImage
width and height of which you want to calculateareaWidth
- width of the area of this imagesareaHeight
- height of the area of this images- Returns:
- array of two Float values. NOTE that first value defines width, second defines height.
- See Also:
BackgroundSize
-
calculateBackgroundSizeForArea
private static BackgroundSize calculateBackgroundSizeForArea(BackgroundImage image, float areaWidth, float areaHeight)
-
createSizeWithMaxValueSide
private static BackgroundSize createSizeWithMaxValueSide(boolean maxWidth)
-
calculateBackgroundWidth
private static void calculateBackgroundWidth(UnitValue width, float areaWidth, boolean scale, BackgroundImage image, java.lang.Float[] widthAndHeight)
-
calculateBackgroundHeight
private static void calculateBackgroundHeight(UnitValue height, float areaHeight, boolean scale, BackgroundImage image, java.lang.Float[] widthAndHeight)
-
scaleWidth
private static void scaleWidth(float newWidth, BackgroundImage image, java.lang.Float[] imageWidthAndHeight)
-
scaleHeight
private static void scaleHeight(float newHeight, BackgroundImage image, java.lang.Float[] imageWidthAndHeight)
-
setDefaultSizeIfNull
private static void setDefaultSizeIfNull(java.lang.Float[] widthAndHeight, float areaWidth, float areaHeight, BackgroundImage image, boolean isGradient)
-
-