Outline
public
final
class
Outline
extends Object
| java.lang.Object | |
| ↳ | android.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.
See also:
Summary
Public constructors | |
|---|---|
Outline()
Constructs an empty Outline. |
|
Outline(Outline src)
Constructs an Outline with a copy of the data in src. |
|
Public methods | |
|---|---|
boolean
|
canClip()
Returns whether the outline can be used to clip a View. |
float
|
getAlpha()
Returns the alpha represented by the Outline. |
float
|
getRadius()
Returns the rounded rect radius, if set, or a value less than 0 if a path has
been set via |
boolean
|
getRect(Rect outRect)
Populates |
boolean
|
isEmpty()
Returns whether the Outline is empty. |
void
|
offset(int dx, int dy)
Offsets the Outline by (dx,dy) |
void
|
set(Outline src)
Replace the contents of this Outline with the contents of src. |
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
|
setConvexPath(Path convexPath)
Sets the Constructs an Outline from a
|
void
|
setEmpty()
Sets the outline to be empty. |
void
|
setOval(Rect rect)
Convenience for |
void
|
setOval(int left, int top, int right, int bottom)
Sets the outline to the oval defined by input rect. |
void
|
setRect(Rect rect)
Convenience for |
void
|
setRect(int left, int top, int right, int bottom)
Sets the Outline to the rounded rect defined by the input rect, and corner radius. |
void
|
setRoundRect(Rect rect, float radius)
Convenience for |
void
|
setRoundRect(int left, int top, int right, int bottom, float radius)
Sets the Outline to the rounded rect defined by the input rect, and corner radius. |
Inherited methods | |
|---|---|
java.lang.Object
| |
Public constructors
Outline
Outline ()
Constructs an empty Outline. Call one of the setter methods to make the outline valid for use with a View.
Outline
Outline (Outline src)
Constructs an Outline with a copy of the data in src.
| Parameters | |
|---|---|
src |
Outline This value must never be |
Public methods
canClip
boolean canClip ()
Returns whether the outline can be used to clip a View.
Currently, only Outlines that can be represented as a rectangle, circle, or round rect support clipping.
| Returns | |
|---|---|
boolean |
|
See also:
getAlpha
float getAlpha ()
Returns the alpha represented by the Outline.
| Returns | |
|---|---|
float |
|
getRadius
float getRadius ()
Returns the rounded rect radius, if set, or a value less than 0 if a path has
been set via setConvexPath(Path). A return value of 0
indicates a non-rounded rect.
| Returns | |
|---|---|
float |
the rounded rect radius, or value < 0 |
getRect
boolean getRect (Rect outRect)
Populates outBounds with the outline bounds, if set, and returns
true. If no outline bounds are set, or if a path has been set
via setConvexPath(Path), returns false.
| Parameters | |
|---|---|
outRect |
Rect: the rect to populate with the outline bounds, if setThis value must never be |
| Returns | |
|---|---|
boolean |
true if outBounds was populated with outline
bounds, or false if no outline bounds are set
|
isEmpty
boolean isEmpty ()
Returns whether the Outline is empty.
Outlines are empty when constructed, or if setEmpty() is called,
until a setter method is called
| Returns | |
|---|---|
boolean |
|
See also:
offset
void offset (int dx,
int dy)
Offsets the Outline by (dx,dy)
| Parameters | |
|---|---|
dx |
int |
dy |
int |
set
void set (Outline src)
Replace the contents of this Outline with the contents of src.
| Parameters | |
|---|---|
src |
Outline: Source outline to copy from.
This value must never be |
setAlpha
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.
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.
| Parameters | |
|---|---|
alpha |
float Value is between 0.0 and 1.0 inclusive. |
setConvexPath
void setConvexPath (Path convexPath)
Sets the Constructs an Outline from a
convex path.
| Parameters | |
|---|---|
convexPath |
Path This value must never be |
setOval
void setOval (Rect rect)
Convenience for setOval(int, int, int, int)
| Parameters | |
|---|---|
rect |
Rect This value must never be |
setOval
void setOval (int left,
int top,
int right,
int bottom)
Sets the outline to the oval defined by input rect.
| Parameters | |
|---|---|
left |
int |
top |
int |
right |
int |
bottom |
int |
setRect
void setRect (Rect rect)
Convenience for setRect(int, int, int, int)
| Parameters | |
|---|---|
rect |
Rect This value must never be |
setRect
void setRect (int left,
int top,
int right,
int bottom)
Sets the Outline to the rounded rect defined by the input rect, and corner radius.
| Parameters | |
|---|---|
left |
int |
top |
int |
right |
int |
bottom |
int |
setRoundRect
void setRoundRect (Rect rect, float radius)
Convenience for setRoundRect(int, int, int, int, float)
| Parameters | |
|---|---|
rect |
Rect This value must never be |
radius |
float |
setRoundRect
void setRoundRect (int left,
int top,
int right,
int bottom,
float radius)
Sets the Outline to the rounded rect defined by the input rect, and corner radius.
Passing a zero radius is equivalent to calling setRect(int, int, int, int)
| Parameters | |
|---|---|
left |
int |
top |
int |
right |
int |
bottom |
int |
radius |
float |
Interfaces
Classes
- Bitmap
- BitmapFactory
- BitmapFactory.Options
- BitmapRegionDecoder
- BitmapShader
- BlurMaskFilter
- Camera
- Canvas
- Color
- ColorFilter
- ColorMatrix
- ColorMatrixColorFilter
- ColorSpace
- ColorSpace.Connector
- ColorSpace.Rgb
- ColorSpace.Rgb.TransferParameters
- ComposePathEffect
- ComposeShader
- CornerPathEffect
- DashPathEffect
- DiscretePathEffect
- DrawFilter
- EmbossMaskFilter
- ImageFormat
- Interpolator
- LightingColorFilter
- LinearGradient
- MaskFilter
- Matrix
- Movie
- NinePatch
- Outline
- Paint
- Paint.FontMetrics
- Paint.FontMetricsInt
- PaintFlagsDrawFilter
- Path
- PathDashPathEffect
- PathEffect
- PathMeasure
- Picture
- PixelFormat
- Point
- PointF
- PorterDuff
- PorterDuffColorFilter
- PorterDuffXfermode
- RadialGradient
- Rect
- RectF
- Region
- RegionIterator
- Shader
- SumPathEffect
- SurfaceTexture
- SweepGradient
- Typeface
- Typeface.Builder
- Xfermode
- YuvImage
Enums
- Bitmap.CompressFormat
- Bitmap.Config
- BlurMaskFilter.Blur
- Canvas.EdgeType
- Canvas.VertexMode
- ColorSpace.Adaptation
- ColorSpace.Model
- ColorSpace.Named
- ColorSpace.RenderIntent
- Interpolator.Result
- Matrix.ScaleToFit
- Paint.Align
- Paint.Cap
- Paint.Join
- Paint.Style
- Path.Direction
- Path.FillType
- Path.Op
- PathDashPathEffect.Style
- PorterDuff.Mode
- Region.Op
- Shader.TileMode
Exceptions