Class Outline

java.lang.Object
icyllis.modernui.graphics.Outline

public final class Outline extends Object
Defines a simple shape, used for bounding graphical regions.

Can be computed for a View, or computed by a Drawable, to drive the shape of shadows cast by a View, or to clip the contents of the View.

Since:
3.12
  • Method Details

    • setEmpty

      public void setEmpty()
      Sets the outline to be empty.
      See Also:
    • isEmpty

      public boolean isEmpty()
      Returns whether the Outline is empty.

      Outlines are empty when constructed, or if setEmpty() is called, until a setter method is called

      See Also:
    • setAlpha

      public void setAlpha(@FloatRange(from=0.0,to=1.0) float alpha)
      Sets the alpha represented by the Outline - the degree to which the producer is guaranteed to be opaque over the Outline's shape.

      An alpha value of 0.0f either represents completely transparent content, or content that isn't guaranteed to fill the shape it publishes.

      Content producing a fully opaque (alpha = 1.0f) outline is assumed by the drawing system to fully cover content beneath it, meaning content beneath may be optimized away.

    • getAlpha

      public float getAlpha()
      Returns the alpha represented by the Outline.
    • setRoundRect

      public void setRoundRect(int left, int top, int right, int bottom, float radius)
      Sets the Outline to the rounded rect defined by the input coordinates and corner radius.

      Passing a zero radius is equivalent to calling setRect(int, int, int, int)

    • setRoundRect

      public void setRoundRect(@NonNull Rect rect, float radius)
    • setRect

      public void setRect(int left, int top, int right, int bottom)
      Sets the Outline to the rect defined by the input coordinates.
    • setRect

      public void setRect(@NonNull Rect rect)
    • getRect

      public boolean getRect(@NonNull Rect outRect)
      Populates outBounds with the outline bounds, if set, and returns true. If no outline bounds are set, returns false.
      Parameters:
      outRect - the rect to populate with the outline bounds, if set
      Returns:
      true if outBounds was populated with outline bounds, or false if no outline bounds are set
    • getRadius

      public float getRadius()
      Returns the rounded rect radius, if set. A return value of 0 indicates a non-rounded rect.
      Returns:
      the rounded rect radius
    • setNone

      @Internal public void setNone()