Class RoundedBackground

  • All Implemented Interfaces:
    Background

    public class RoundedBackground
    extends java.lang.Object
    implements Background
    Draws a plain color on the background with a round corner.

    Should be used in association with a RoundedBorder to:

    • anti-alias its edges by using the same color,
    • draw a colored border that fits its shape.

    The corner radius and border thickness are stored as a char for heap optimization and therefore cannot exceed 65535.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void apply​(ej.microui.display.GraphicsContext g, int width, int height)
      Applies the background on a graphics context.
      boolean equals​(java.lang.Object obj)  
      int getBorderThickness()
      Gets the border thickness.
      int getColor()
      Gets the color.
      int getCornerRadius()
      Gets the corner radius.
      int hashCode()  
      boolean isTransparent​(int width, int height)
      Tells whether or not this background is transparent.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RoundedBackground

        @Deprecated
        public RoundedBackground​(int color,
                                 int cornerRadius)
        Creates a rounded background.

        The given corner radius is clamped between 0 and Character.MAX_VALUE.

        Parameters:
        color - the color.
        cornerRadius - the corner radius.
      • RoundedBackground

        public RoundedBackground​(int color,
                                 int cornerRadius,
                                 int borderThickness)
        Creates a rounded background.

        The given corner radius and border thickness are clamped between 0 and Character.MAX_VALUE.

        Parameters:
        color - the color.
        cornerRadius - the corner radius.
        borderThickness - the border thickness.
    • Method Detail

      • getColor

        public int getColor()
        Gets the color.
        Returns:
        the color.
      • getCornerRadius

        public int getCornerRadius()
        Gets the corner radius.
        Returns:
        the corner radius.
      • getBorderThickness

        public int getBorderThickness()
        Gets the border thickness.
        Returns:
        the border thickness.
      • isTransparent

        public boolean isTransparent​(int width,
                                     int height)
        Description copied from interface: Background
        Tells whether or not this background is transparent.

        A background is considered as transparent if it does not draw every pixel with maximal opacity when it is applied. If a widget has a transparent background, its parent has to be rendered before the widget.

        Specified by:
        isTransparent in interface Background
        Parameters:
        width - the width of the background.
        height - the height of the background.
        Returns:
        true if the background is transparent, false otherwise.
      • apply

        public void apply​(ej.microui.display.GraphicsContext g,
                          int width,
                          int height)
        Description copied from interface: Background
        Applies the background on a graphics context.
        Specified by:
        apply in interface Background
        Parameters:
        g - the graphics context.
        width - the width of the background.
        height - the height of the background.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Specified by:
        equals in interface Background
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface Background
        Overrides:
        hashCode in class java.lang.Object