public class Contour extends Object
You can clip or draw a shadow by using a contour, which takes the form of a right-angled rectangle, a rounded rectangle, an oval, or a convex polygon.
| 构造器 | 说明 |
|---|---|
Contour() |
Default constructor used to create a
Contour instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
clear() |
Set the contour to be empty.
|
int |
getAlpha() |
Obtains the alpha value of the contour.
|
Color |
getContourColor() |
Obtains the color of the contour.
|
float |
getRadius() |
Obtains the radius of the current contour.
|
boolean |
getRect(Rect rect) |
Sets the given rectangle with the rectangle of the current contour.
|
boolean |
isEmpty() |
Checks whether the current contour is empty,
clear(). |
void |
set(Contour srcContour) |
Replaces the current contour with another contour.
|
void |
setAlpha(int alpha) |
Sets the alpha value of the contour.
|
void |
setContourColor(Color color) |
Sets the color of the contour.
|
void |
setContourEncompassRect(int left,
int top,
int right,
int bottom,
float radius) |
Sets the contour by passing the coordinates of the rectangle and the radius of its rounded corners.
|
void |
setContourRect(int left,
int top,
int right,
int bottom) |
Sets the contour by passing the coordinates of the rectangle.
|
void |
setContourRect(Rect rect) |
Sets the contour using the specified rectangle.
|
void |
setConvexPath(Path path) |
Sets the contour to a convex path.
|
void |
setOval(int left,
int top,
int right,
int bottom) |
Sets the contour of an oval based on the coordinates of the specified rectangle.
|
void |
setOval(Rect rect) |
Sets the contour of an oval based on the specified
Rect object. |
void |
translate(int dx,
int dy) |
Translates the current contour.
|
public void setContourEncompassRect(int left,
int top,
int right,
int bottom,
float radius)
left - Indicates the X coordinate of the upper left corner of the specified rectangle.top - Indicates the Y coordinate of the upper left corner of the specified rectangle.right - Indicates the X coordinate of the lower right corner of the specified rectangle.bottom - Indicates the Y coordinate of the lower right corner of the specified rectangle.radius - Indicates the radius of the rectangle's rounded corners.public void translate(int dx,
int dy)
dx - Indicates the length to translate on the x axis.dy - Indicates the length to translate on the y axis.public void setContourRect(Rect rect)
rect - Indicates the specified rectangle.public void setContourRect(int left,
int top,
int right,
int bottom)
left - Indicates the X coordinate of the upper left corner of the specified rectangle.top - Indicates the Y coordinate of the upper left corner of the specified rectangle.right - Indicates the X coordinate of the lower right corner of the specified rectangle.bottom - Indicates the Y coordinate of the lower right corner of the specified rectangle.public void setConvexPath(Path path)
path - Indicates the specified path.public void setOval(int left,
int top,
int right,
int bottom)
left - Indicates the left bound of the rectangle.top - Indicates the top bound of the rectangle.right - Indicates the right bound of the rectangle.bottom - Indicates the bottom bound of the rectangle.public void setOval(Rect rect)
Rect object.rect - Indicates the Rect object.public void set(Contour srcContour)
srcContour - Indicates the contour used to replace the current contour.public boolean isEmpty()
clear().true if mMode is MODE_EMPTY, returns false otherwise.public void clear()
public float getRadius()
Only the contour of round rect or circle can get a effective value.
public boolean getRect(Rect rect)
rect - Indicates the rectangle to set.true if the operation is successful, returns false otherwise.public void setAlpha(int alpha)
alpha - Indicates the alpha value to set. The value ranges from 0 to 255.public int getAlpha()
public void setContourColor(Color color)
color - Indicates the color to set.public Color getContourColor()