Class RoundRectangle

java.lang.Object
java.awt.geom.RectangularShape
org.robolectric.shadows.RoundRectangle
All Implemented Interfaces:
java.awt.Shape, Cloneable

public class RoundRectangle
extends java.awt.geom.RectangularShape
Defines a rectangle with rounded corners, where the sizes of the corners are potentially different.

Copied from https://github.com/aosp-mirror/platform_frameworks_base/blob/oreo-release/tools/layoutlib/bridge/src/android/graphics/RoundRectangle.java

  • Field Summary

    Fields 
    Modifier and Type Field Description
    double height  
    double llHeight  
    double llWidth  
    double lrHeight  
    double lrWidth  
    double ulHeight  
    double ulWidth  
    double urHeight  
    double urWidth  
    double width  
    double x  
    double y  
  • Constructor Summary

    Constructors 
    Constructor Description
    RoundRectangle​(float x, float y, float width, float height, float[] cornerDimensions)  
  • Method Summary

    Modifier and Type Method Description
    boolean contains​(double x, double y)  
    boolean contains​(double x, double y, double w, double h)  
    java.awt.geom.Rectangle2D getBounds2D()  
    double getHeight()  
    java.awt.geom.PathIterator getPathIterator​(java.awt.geom.AffineTransform at)  
    double getWidth()  
    double getX()  
    double getY()  
    boolean intersects​(double x, double y, double w, double h)  
    boolean isEmpty()  
    void setFrame​(double x, double y, double w, double h)  

    Methods inherited from class java.awt.geom.RectangularShape

    clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • RoundRectangle

      public RoundRectangle​(float x, float y, float width, float height, float[] cornerDimensions)
      Parameters:
      cornerDimensions - array of 8 floating-point number corresponding to the width and the height of each corner in the following order: upper-left, upper-right, lower-right, lower-left. It assumes for the size the same convention as RoundRectangle2D, that is that the width and height of a corner correspond to the total width and height of the ellipse that corner is a quarter of.
  • Method Details

    • getX

      public double getX()
      Specified by:
      getX in class java.awt.geom.RectangularShape
    • getY

      public double getY()
      Specified by:
      getY in class java.awt.geom.RectangularShape
    • getWidth

      public double getWidth()
      Specified by:
      getWidth in class java.awt.geom.RectangularShape
    • getHeight

      public double getHeight()
      Specified by:
      getHeight in class java.awt.geom.RectangularShape
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in class java.awt.geom.RectangularShape
    • setFrame

      public void setFrame​(double x, double y, double w, double h)
      Specified by:
      setFrame in class java.awt.geom.RectangularShape
    • getBounds2D

      public java.awt.geom.Rectangle2D getBounds2D()
    • contains

      public boolean contains​(double x, double y)
    • intersects

      public boolean intersects​(double x, double y, double w, double h)
    • contains

      public boolean contains​(double x, double y, double w, double h)
    • getPathIterator

      public java.awt.geom.PathIterator getPathIterator​(java.awt.geom.AffineTransform at)