Class BackgroundSizeCalculationUtil


  • final class BackgroundSizeCalculationUtil
    extends java.lang.Object
    Utility class for calculate background image width and height.
    • Constructor Detail

      • BackgroundSizeCalculationUtil

        private BackgroundSizeCalculationUtil()
    • 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 - 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:
        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)