Package icyllis.modernui.graphics
Class Outline
java.lang.Object
icyllis.modernui.graphics.Outline
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 Summary
Modifier and TypeMethodDescriptionfloatgetAlpha()Returns the alpha represented by the Outline.floatReturns the rounded rect radius, if set.booleanPopulatesoutBoundswith the outline bounds, if set, and returnstrue.booleanisEmpty()Returns whether the Outline is empty.voidsetAlpha(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.voidsetEmpty()Sets the outline to be empty.voidsetNone()voidsetRect(int left, int top, int right, int bottom) Sets the Outline to the rect defined by the input coordinates.voidConvenience forsetRect(int, int, int, int)voidsetRoundRect(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.voidsetRoundRect(Rect rect, float radius) Convenience forsetRoundRect(int, int, int, int, float)
-
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
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.0feither 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
Convenience forsetRoundRect(int, int, int, int, float) -
setRect
public void setRect(int left, int top, int right, int bottom) Sets the Outline to the rect defined by the input coordinates. -
setRect
Convenience forsetRect(int, int, int, int) -
getRect
PopulatesoutBoundswith the outline bounds, if set, and returnstrue. If no outline bounds are set, returnsfalse.- Parameters:
outRect- the rect to populate with the outline bounds, if set- Returns:
trueifoutBoundswas populated with outline bounds, orfalseif no outline bounds are set
-
getRadius
public float getRadius()Returns the rounded rect radius, if set. A return value of0indicates a non-rounded rect.- Returns:
- the rounded rect radius
-
setNone
@Internal public void setNone()
-