Class BackgroundSizeCalculationUtil

java.lang.Object
com.itextpdf.layout.renderer.BackgroundSizeCalculationUtil

final class BackgroundSizeCalculationUtil extends Object
Utility class for calculate background image width and height.
  • Field Details

    • PERCENT_100

      private static final int PERCENT_100
      See Also:
    • PERCENT_VALUE_100

      private static final UnitValue PERCENT_VALUE_100
  • Constructor Details

    • BackgroundSizeCalculationUtil

      private BackgroundSizeCalculationUtil()
  • Method Details

    • 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 - the BackgroundImage width and height of which you want to calculate
      areaWidth - width of the area of this images
      areaHeight - height of the area of this images
      Returns:
      array of two Float values. NOTE that first value defines width, second defines height.
      See Also:
    • 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, Float[] widthAndHeight)
    • calculateBackgroundHeight

      private static void calculateBackgroundHeight(UnitValue height, float areaHeight, boolean scale, BackgroundImage image, Float[] widthAndHeight)
    • scaleWidth

      private static void scaleWidth(float newWidth, BackgroundImage image, Float[] imageWidthAndHeight)
    • scaleHeight

      private static void scaleHeight(float newHeight, BackgroundImage image, Float[] imageWidthAndHeight)
    • setDefaultSizeIfNull

      private static void setDefaultSizeIfNull(Float[] widthAndHeight, float areaWidth, float areaHeight, BackgroundImage image, boolean isGradient)