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 TypeMethodDescriptionfloat
getAlpha()
Returns the alpha represented by the Outline.float
Returns the rounded rect radius, if set.boolean
PopulatesoutBounds
with the outline bounds, if set, and returnstrue
.boolean
isEmpty()
Returns whether the Outline is empty.void
setAlpha
(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.void
setEmpty()
Sets the outline to be empty.void
setNone()
void
setRect
(int left, int top, int right, int bottom) Sets the Outline to the rect defined by the input coordinates.void
Convenience forsetRect(int, int, int, int)
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.void
setRoundRect
(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.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
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
PopulatesoutBounds
with 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:
true
ifoutBounds
was populated with outline bounds, orfalse
if no outline bounds are set
-
getRadius
public float getRadius()Returns the rounded rect radius, if set. A return value of0
indicates a non-rounded rect.- Returns:
- the rounded rect radius
-
setNone
@Internal public void setNone()
-