Class AreaStyle


  • public class AreaStyle
    extends Object
    This class represents the complete style of an area for further comparison.
    Author:
    burgetr
    • Constructor Detail

      • AreaStyle

        public AreaStyle​(float averageFontSize,
                         float averageFontWeight,
                         float averageFontStyle,
                         float averageColorLuminosity,
                         Color backgroundColor)
      • AreaStyle

        public AreaStyle​(Area source)
    • Method Detail

      • getAverageFontSize

        public double getAverageFontSize()
      • setAverageFontSize

        public void setAverageFontSize​(float averageFontSize)
      • getAverageFontWeight

        public double getAverageFontWeight()
      • setAverageFontWeight

        public void setAverageFontWeight​(float averageFontWeight)
      • getAverageFontStyle

        public double getAverageFontStyle()
      • setAverageFontStyle

        public void setAverageFontStyle​(float averageFontStyle)
      • getAverageColorLuminosity

        public double getAverageColorLuminosity()
      • setAverageColorLuminosity

        public void setAverageColorLuminosity​(float averageColorLuminosity)
      • getBackgroundColor

        public Color getBackgroundColor()
      • setBackgroundColor

        public void setBackgroundColor​(Color backgroundColor)
      • isSameStyle

        public boolean isSameStyle​(AreaStyle other)
        Compares two styles and decides if it is the same style. The thresholds of the style are taken from the Config.
        Parameters:
        other - the other area to be compared
        Returns:
        true if the areas are considered to have the same style
      • hasSameStyle

        public static boolean hasSameStyle​(Area a1,
                                           Area a2)
        Compares two visual areas and checks whether they have the same visual style.
        Parameters:
        a1 - the first area to compare
        a2 - the second area to compare
        Returns:
        true when a2 has the same visual style as a1
      • hasEqualBackground

        public static boolean hasEqualBackground​(Area a1,
                                                 Area a2)
        Checks if two areas have the same background color
        Parameters:
        a1 - the first area to compare
        a2 - the second area to compare
        Returns:
        true if the areas are both transparent or they have the same background color declared
      • hasConsistentStyle

        public static boolean hasConsistentStyle​(Area root)
        Checks whether all children of a given area have a consistent visual style (as defined by hasSameStyle(Area, Area)).
        Parameters:
        root - The area to test.
        Returns:
        true when the area is a leaf area or all the child areas have a consistent visual style.
      • computeColorLuminosity

        public float computeColorLuminosity​(Area area)