Android APIs
public final class

Outline

extends Object
java.lang.Object
   ↳ android.graphics.Outline

Class Overview

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.

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.
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 convex path.
void setEmpty()
Sets the outline to be empty.
void setOval(Rect rect)
Convenience for setOval(int, int, int, int)
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 setRect(int, int, int, int)
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)
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Outline ()

Added in API level 21

Constructs an empty Outline. Call one of the setter methods to make the outline valid for use with a View.

public Outline (Outline src)

Added in API level 21

Constructs an Outline with a copy of the data in src.

Public Methods

public boolean canClip ()

Added in API level 21

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.

public float getAlpha ()

Added in API level 21

Returns the alpha represented by the Outline.

public boolean isEmpty ()

Added in API level 21

Returns whether the Outline is empty.

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

See Also

public void offset (int dx, int dy)

Added in API level 22

Offsets the Outline by (dx,dy)

public void set (Outline src)

Added in API level 21

Replace the contents of this Outline with the contents of src.

Parameters
src Source outline to copy from.

public void setAlpha (float alpha)

Added in API level 21

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.

public void setConvexPath (Path convexPath)

Added in API level 21

Sets the Constructs an Outline from a convex path.

public void setEmpty ()

Added in API level 21

Sets the outline to be empty.

See Also

public void setOval (Rect rect)

Added in API level 21

public void setOval (int left, int top, int right, int bottom)

Added in API level 21

Sets the outline to the oval defined by input rect.

public void setRect (Rect rect)

Added in API level 21

public void setRect (int left, int top, int right, int bottom)

Added in API level 21

Sets the Outline to the rounded rect defined by the input rect, and corner radius.

public void setRoundRect (Rect rect, float radius)

Added in API level 21

public void setRoundRect (int left, int top, int right, int bottom, float radius)

Added in API level 21

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)