| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
ShapeElement.Orientation |
Indicates the direction of the gradient effect relative to the element object's bounds.
|
static class |
ShapeElement.RadiusType |
Indicates the type of the processed value for the radius.
|
Element.ConstantState, Element.OnBoundsChangeListener, Element.OnChangeListener, Element.OnLayoutDirectionChangeListener, Element.OnRankChangeListener| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
ARC |
Indicates that the
ShapeElement object is in the shape of arc. |
static int |
CORNER_END_BOTTOM_X |
Indicates the relative corner radius ID for the
end_bottom_x tag. |
static int |
CORNER_END_BOTTOM_Y |
Indicates the relative corner radius ID for the
end_bottom_y tag. |
static int |
CORNER_END_TOP_X |
Indicates the relative corner radius ID for the
end_top_x tag. |
static int |
CORNER_END_TOP_Y |
Indicates the relative corner radius ID for the
end_top_y tag. |
static int |
CORNER_LEFT_BOTTOM_X |
Indicates the corner radius ID for the
left_bottom_x tag. |
static int |
CORNER_LEFT_BOTTOM_Y |
Indicates the corner radius ID for the
left_bottom_y tag. |
static int |
CORNER_LEFT_TOP_X |
Indicates the relative corner radius ID for the
start_top_x tag. |
static int |
CORNER_LEFT_TOP_Y |
Indicates the relative corner radius ID for the
start_top_y tag. |
static int |
CORNER_RADIUS_ARRAY_SIZE |
Indicates the corner radius array size.
|
static int |
CORNER_RIGHT_BOTTOM_X |
Indicates the corner radius ID for the
right_bottom_x tag. |
static int |
CORNER_RIGHT_BOTTOM_Y |
Indicates the corner radius ID for the
right_bottom_y tag. |
static int |
CORNER_RIGHT_TOP_X |
Indicates the corner radius ID for the
right_top_x tag. |
static int |
CORNER_RIGHT_TOP_Y |
Indicates the corner radius ID for the
right_top_y tag. |
static int |
CORNER_START_BOTTOM_X |
Indicates the relative corner radius ID for the
start_bottom_x tag. |
static int |
CORNER_START_BOTTOM_Y |
Indicates the relative corner radius ID for the
start_bottom_y tag. |
static int |
CORNER_START_TOP_X |
Indicates the relative corner radius id for
start_top_x tag. |
static int |
CORNER_START_TOP_Y |
Indicates the relative corner radius id for
start_top_y tag. |
static int |
LINE |
Indicates a line.
|
static int |
LINEAR_GRADIENT_SHADER_TYPE |
Indicates that the shader is of the linear type.
|
Path |
mPath |
已过时。
Please use
getPath() method to obtain path.
This member will became a private in next version. |
static int |
OVAL |
Indicates an oval,
which can be displayed as an oval or a circle according to the width and height of the component.
|
static int |
PATH |
Indicates that the
ShapeElement object is in a shape drawn along a particular path. |
static int |
RADIAL_GRADIENT_SHADER_TYPE |
Indicates that the shader is of the radial type.
|
static int |
RECTANGLE |
Indicates a rectangle, for which the corner radius can be set.
|
static int |
RING |
Indicates that this
ShapeElement is in the shape of a ring. |
static int |
SWEEP_GRADIENT_SHADER_TYPE |
Indicates that the shader is of the sweep type.
|
ALPHA_DEFAULT, ALPHA_MAX, ALPHA_MIN, DEFAULT_BOUNDS_RECT, MAX_RANK, MIN_RANK| 构造器 | 说明 |
|---|---|
ShapeElement() |
Default constructor creates transparent element.
|
ShapeElement(RgbColor color) |
A constructor used to create a
ShapeElement with the specified color. |
ShapeElement(ShapeElement.Orientation orientation,
RgbColor[] colors) |
A constructor used to create a
ShapeElement based on the specified gradient orientation
and array of colors. |
ShapeElement(Context context,
int xmlId) |
A constructor used to create a
ShapeElement instance based on the specified XML resource. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
Arc |
getArc() |
Obtains the arc attributes of a
ShapeElement object in the shape of ARC. |
float[] |
getCornerRadii() |
Obtains the four corner's radius.
|
float[] |
getCornerRadiiResolved() |
Obtains the resolved values of the four corners' radii.
|
float |
getCornerRadius() |
Obtains the corner radius.
|
float[] |
getDashPathEffectIntervals() |
Obtains the dash path effect intervals.
|
float |
getDashPathEffectPhase() |
Obtains the dash path effect phase.
|
ShapeElement.Orientation |
getGradientOrientation() |
Obtains the gradient direction defined in this element object.
|
ShapeElement.Orientation |
getOrientation() |
已过时。
Use
getGradientOrientation() instead. |
Path |
getPath() |
Obtains the path.
|
RgbColor[] |
getRgbColors() |
Obtains the color filled in this
ShapeElement object. |
int |
getRingRadius() |
Obtains the inner radius of this shape element.
|
float |
getRingRadiusProportion() |
Obtains the inner radius proportion of this shape element.
|
int |
getRingThickness() |
Obtains the ring thickness of this shape element.
|
float |
getRingThicknessProportion() |
Obtains the ring thickness proportion of this shape element.
|
float[] |
getShaderCenter() |
Obtains the center point position of the shader based on the proportion to this shape element's width
and height.
|
float |
getShaderRadius() |
Obtains the gradient radius of this shape element.
|
ShapeElement.RadiusType |
getShaderRadiusType() |
Obtains the gradient radius type of this shape element.
|
float[] |
getShaderStops() |
Obtains shader points for this shape element.
|
int |
getShaderType() |
Obtains the shader type.
|
int |
getShape() |
Obtains the shape of this
ShapeElement object. |
Paint.StrokeCap |
getStrokeCap() |
Obtains the stroke cap, which specifies the shape of each drawing point of a stroke.
|
RgbColor |
getStrokeColor() |
已过时。
Use
getStrokeColors() instead. |
RgbColor[] |
getStrokeColors() |
Obtains the stroke colors of this shape element.
|
ShapeElement.Orientation |
getStrokeOrientation() |
Obtains the gradient direction defined for the stroke of this shape element.
|
float[] |
getStrokeShaderCenter() |
Obtains the center point position of the stroke shader based on the proportion to this shape element's width
and height.
|
float |
getStrokeShaderRadius() |
Obtains the gradient radius for the stroke.
|
ShapeElement.RadiusType |
getStrokeShaderRadiusType() |
Obtains the gradient radius type for the stroke.
|
int |
getStrokeShaderType() |
Obtains the stroke shader type of this shape element.
|
float[] |
getStrokeStops() |
Obtains the stroke shader points of this shape element.
|
int |
getStrokeWidth() |
Obtains the stroke width of this
ShapeElement object. |
boolean |
isSectorEnabled() |
Checks whether an arc shape supports sector drawing (the space between the arc start and end points is filled).
|
boolean |
isStrokeCapEnabled() |
Checks whether the
StrokeCap option is enabled for this shape element. |
Element |
makeUnique() |
Make this element unique.
|
void |
setArc(Arc arc) |
Sets the arc attributes of a
ShapeElement object in the shape of ARC. |
void |
setCornerRadiiArray(float[] radii) |
Sets the each corner's radius.
|
void |
setCornerRadiiArray(float[] radii,
boolean relative) |
Sets the relative radius for each corner.
|
void |
setCornerRadius(float radius) |
Sets the corner radius.
|
void |
setDashPathEffectValues(float[] intervals,
float phase) |
Adds dash path effect intervals and phase for this element.
|
void |
setGradientOrientation(ShapeElement.Orientation orientation) |
Sets the direction of the gradient effect for this element object.
|
void |
setOrientation(ShapeElement.Orientation orientation) |
|
void |
setPadding(int left,
int top,
int right,
int bottom) |
Sets the padding for this shape element.
|
void |
setPaddingRtl(int start,
int top,
int end,
int bottom) |
Sets the relative padding for this shape element.
|
void |
setPath(Path path) |
Sets the path.
|
void |
setRgbColor(RgbColor color) |
Sets the color for filling a
ShapeElement object. |
void |
setRgbColors(RgbColor[] colors) |
Sets the colors for filling a
ShapeElement object with gradient effect. |
void |
setRingRadius(int radius) |
Sets the inner radius for this shape element.
|
void |
setRingRadiusProportion(float radiusProportion) |
Sets the inner radius proportion for this shape element.
|
void |
setRingThickness(int thickness) |
Sets the ring thickness for this shape element.
|
void |
setRingThicknessProportion(float thicknessProportion) |
Sets the ring thickness proportion for this shape element.
|
void |
setSectorEnabled(boolean enable) |
Sets whether to enable an arc shape to support sector drawing (to fill the space between the arc start and
end points).
|
void |
setShaderCenter(float x,
float y) |
Sets the center point position of the gradient based on the proportion to this shape element's width and height.
|
void |
setShaderRadius(float radius,
ShapeElement.RadiusType type) |
Sets a gradient radius.
|
void |
setShaderStops(float[] points) |
Sets shader points for this shape element.
|
void |
setShaderType(int type) |
Sets the shader type.
|
void |
setShape(int shape) |
Sets the shape.
|
void |
setShapeSize(int width,
int height) |
Sets the size for this shape element.
|
void |
setStroke(int width,
RgbColor color) |
Sets the border width and color.
|
void |
setStroke(int width,
RgbColor[] colors) |
Sets the stroke width and gradient colors for this shape element.
|
void |
setStroke(int width,
RgbColor[] colors,
float dashSize,
float dashSpace) |
Sets the stroke width and gradient colors with dashes for this shape element.
|
void |
setStroke(int width,
RgbColor color,
float dashSize,
float dashSpace) |
Sets the stroke width and color with dashes for this shape element.
|
void |
setStrokeCap(Paint.StrokeCap cap) |
Sets the stroke cap, which specifies the shape of each drawing point of a stroke.
|
void |
setStrokeCapEnabled(boolean enable) |
Enables or disables the
StrokeCap option for this shape element. |
void |
setStrokeOrientation(ShapeElement.Orientation orientation) |
Sets the gradient direction for the stroke of this shape element.
|
void |
setStrokeShaderCenter(float x,
float y) |
Sets the center point position of the stroke shader based on the proportion to this shape element's width and
height.
|
void |
setStrokeShaderRadius(float radius,
ShapeElement.RadiusType type) |
Sets the gradient radius for the stroke.
|
void |
setStrokeShaderType(int type) |
Sets the stroke shader type for this shape element.
|
void |
setStrokeStops(float[] points) |
Sets the stroke shader points for this shape element.
|
clearColorMatrix, drawToCanvas, getAlpha, getBounds, getCallback, getColorMatrix, getCurrentElement, getHeight, getLayoutDirection, getMinHeight, getMinWidth, getPadding, getRank, getStateColorMode, getVisible, getWidth, isInheritDirection, isStateful, isVisible, release, setAlpha, setBounds, setBounds, setCallback, setColorMatrix, setInheritDirection, setLayoutDirection, setOnBoundsChangeListener, setOnLayoutDirectionChangeListener, setOnRankChangeListener, setRank, setStateColor, setStateColorList, setStateColorMode, setVisible, skipAnimationpublic static final int ARC
ShapeElement object is in the shape of arc.public static final int CORNER_END_BOTTOM_X
end_bottom_x tag.public static final int CORNER_END_BOTTOM_Y
end_bottom_y tag.public static final int CORNER_END_TOP_X
end_top_x tag.public static final int CORNER_END_TOP_Y
end_top_y tag.public static final int CORNER_LEFT_BOTTOM_X
left_bottom_x tag.public static final int CORNER_LEFT_BOTTOM_Y
left_bottom_y tag.public static final int CORNER_LEFT_TOP_X
start_top_x tag.public static final int CORNER_LEFT_TOP_Y
start_top_y tag.public static final int CORNER_RADIUS_ARRAY_SIZE
public static final int CORNER_RIGHT_BOTTOM_X
right_bottom_x tag.public static final int CORNER_RIGHT_BOTTOM_Y
right_bottom_y tag.public static final int CORNER_RIGHT_TOP_X
right_top_x tag.public static final int CORNER_RIGHT_TOP_Y
right_top_y tag.public static final int CORNER_START_BOTTOM_X
start_bottom_x tag.public static final int CORNER_START_BOTTOM_Y
start_bottom_y tag.public static final int CORNER_START_TOP_X
start_top_x tag.public static final int CORNER_START_TOP_Y
start_top_y tag.public static final int LINE
public static final int LINEAR_GRADIENT_SHADER_TYPE
public static final int OVAL
public static final int PATH
ShapeElement object is in a shape drawn along a particular path.public static final int RADIAL_GRADIENT_SHADER_TYPE
public static final int RECTANGLE
public static final int RING
ShapeElement is in the shape of a ring.public static final int SWEEP_GRADIENT_SHADER_TYPE
@Deprecated public Path mPath
getPath() method to obtain path.
This member will became a private in next version.ShapeElement shape PATH.setShape(int)public ShapeElement()
ShapeElement(RgbColor),
ShapeElement(Orientation, RgbColor[])public ShapeElement(RgbColor color)
ShapeElement with the specified color.color - Indicates the color.ShapeElement(),
ShapeElement(Orientation, RgbColor[])public ShapeElement(ShapeElement.Orientation orientation, RgbColor[] colors)
ShapeElement based on the specified gradient orientation
and array of colors.orientation - Indicates the direction (angle) of the gradient.colors - Indicates the colors for filling the shape element.ShapeElement(),
ShapeElement(RgbColor)public ShapeElement(Context context, int xmlId)
ShapeElement instance based on the specified XML resource.context - Indicates the application context.xmlId - Indicates the ID of the XML resource.ElementScatterException - Throws this exception if the context value is null.public void setRingRadiusProportion(float radiusProportion)
When a radius is set, the radius proportion does not take effect.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
radiusProportion - Indicates the inner radius proportion to set. The default value is 3.0.
The value must be positive.IllegalArgumentException - Throws this exception if the radiusProportion value is invalid.getRingRadiusProportion(),
setRingRadius(int),
getRingRadius(),
makeUnique()public float getRingRadiusProportion()
setRingRadiusProportion(float)public void setRingRadius(int radius)
When a radius is set, the radius proportion does not take effect.
Calling this method to change the properties will affect all shape element instances loaded
from the same resource.
Call makeUnique() before calling this method.
radius - Indicates the inner radius to set. The value must be positive or 0.
If the value is 0, the radius proportion will be used.IllegalArgumentException - Throws this exception if the radius value is less than 0.getRingRadius(),
setRingRadiusProportion(float),
getRingRadiusProportion(),
makeUnique()public int getRingRadius()
0) will be
returned.setRingRadius(int)public void setRingThicknessProportion(float thicknessProportion)
When a thickness is set, the thickness proportion does not take effect.
Calling this method to change the properties will affect all shape element instances loaded
from the same resource. Call makeUnique() before calling this method.
thicknessProportion - Indicates the ring thickness proportion to set. The default value is 9.0f.
The value must be positive.IllegalArgumentException - Throws this exception if the thicknessProportion value is invalid.getRingThicknessProportion(),
setRingThickness(int),
getRingThickness(),
makeUnique()public float getRingThicknessProportion()
setRingThicknessProportion(float)public void setRingThickness(int thickness)
When a thickness is set, the thickness proportion does not take effect.
Calling this method to change the properties will affect all shape element instances loaded
from the same resource.
Call makeUnique() before calling this method.
thickness - Indicates the ring thickness to set. The value must be positive or 0.
If the value is 0, the ring thickness proportion will be used.IllegalArgumentException - Throws this exception if the thickness value is invalid.getRingThickness(),
setRingThicknessProportion(float),
getRingThicknessProportion(),
makeUnique()public int getRingThickness()
0) will be returned.setRingThicknessProportion(float)public void setShape(int shape)
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
public int getShape()
ShapeElement object.setShape(int)public void setShapeSize(int width,
int height)
Calling this method to change the properties will affect all shape element instances loaded
from the same resource. Call makeUnique() before calling this method.
width - Indicates the width of the shape element. The value must be positive or
-1, which means that the shape width is the same as the container width.height - Indicates the height of the shape element. The value must be positive or
-1, which means that the shape height is the same as the container height.IllegalArgumentException - Throws this exception if the width or height value is invalid.makeUnique()public void setPadding(int left,
int top,
int right,
int bottom)
Calling this method to change the properties will affect all shape element instances loaded
from the same resource. Call makeUnique() before calling this method.
left - Indicates the left padding to set. The value must be positive or 0.top - Indicates the top padding to set. The value must be positive or 0.right - Indicates the right padding to set. The value must be positive or 0.bottom - Indicates the bottom padding to set. The value must be positive or 0.IllegalArgumentException - Throws this exception if any of the passed values is invalid.setPaddingRtl(int, int, int, int),
makeUnique()public void setPaddingRtl(int start,
int top,
int end,
int bottom)
Calling this method to change the properties will affect all shape element instances loaded
from the same resource. Call makeUnique() before calling this method.
start - Indicates the start padding to set. The value must be positive or 0.top - Indicates the top padding to set. The value must be positive or 0.end - Indicates the end padding to set. The value must be positive or 0.bottom - Indicates the bottom padding to set. The value must be positive or 0.IllegalArgumentException - Throws this exception if any of the passed values is invalid.setPadding(int, int, int, int),
makeUnique()public void setRgbColor(RgbColor color)
ShapeElement object.
This method does not take effect if the shape of the ShapeElement instance is LINE.
Use the setRgbColors(ohos.agp.colors.RgbColor[]) method to achieve gradient effect.
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
color - Indicates the color value. The value null means transparent color.setRgbColors(RgbColor[]),
getRgbColors(),
makeUnique(),
RgbPalettepublic void setRgbColors(RgbColor[] colors)
ShapeElement object with gradient effect.
This method does not take effect if the shape of the ShapeElement object is LINE.
You can call setRgbColor(ohos.agp.colors.RgbColor) to apply a single color to a ShapeElement object.
Note: For set this property in XML use attribute ohos:colors
with next inner parameters:
1.#AARRGGBB - RgbColor in hex type. For example: ohos:colors = "#FFFFFFFF"
2.#RRGGBB - RgbColor in hex type where alpha for color will 0xFF.
For example: ohos:colors = "#FFFFFF"
3.name_of_color - value from RgbPalette. For example: ohos:colors = "red, green, blue"
4.color:name_of_color - multiple color from user json file in resource where color:
indicates that the color is in the resources and name_of_color is name of color in user json file.
For example:
<shape>
<solid ohos:colors="color:dark_violet, green, #FF0000FF, ..., color:canary_yellow"/>
</shape>
Note: If write incorrect color program throw IllegalArgumentException
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
colors - Indicates the colors for filling the shape element object.setRgbColor(RgbColor),
getRgbColors(),
makeUnique(),
RgbPalettepublic RgbColor[] getRgbColors()
ShapeElement object.setRgbColors(RgbColor[]),
setRgbColor(RgbColor)public void setStroke(int width,
RgbColor color)
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
Note: For set this property in XML use attribute ohos:colors
with next inner parameters:
1.#AARRGGBB - RgbColor in hex type. For example: ohos:colors = "#FFFFFFFF"
2.#RRGGBB - RgbColor in hex type where alpha for color will 0xFF.
For example: ohos:colors = "#FFFFFF"
3.name_of_color - value from RgbPalette. For example: ohos:colors = "red, green, blue"
4.color:name_of_color - multiple color from user json file in resource where color:
indicates that the color is in the resources and name_of_color is name of color in user json file.
For example:
<shape>
<stroke ohos:colors="color:dark_violet, green, #FF0000FF, ..., color:canary_yellow"/>
</shape>
Note: If write incorrect color program throw IllegalArgumentException
width - Indicates the border width. The value must be positive or 0.
Value 0 means no stroke. Invalide values are ignored.color - Indicates the border color. The value null means transparent border.setStroke(int, RgbColor[]),
setStroke(int, RgbColor, float, float),
setStroke(int, RgbColor[], float, float),
getStrokeColors(),
getStrokeWidth(),
makeUnique(),
RgbPalettepublic void setStroke(int width,
RgbColor[] colors)
Calling this method to change the properties will affect all shape element instances loaded
from the same resource. Call makeUnique() before calling this method.
width - Indicates the stroke width to set. The value must be positive or 0.
No stroke is drawn when the value is 0. Nothing happens when an invalid value is passed.colors - Indicates the stroke gradient colors to set. A transparent stroke is drawn when the value is
null.setStroke(int, RgbColor[]),
setStroke(int, RgbColor, float, float),
setStroke(int, RgbColor[], float, float),
getStrokeColors(),
getStrokeWidth(),
makeUnique()public void setStroke(int width,
RgbColor color,
float dashSize,
float dashSpace)
The dash usage is equivalent to setDashPathEffectValues(float[],float)
with the dash path effect intervals (specified by dashSize and dashSpace)
and the phase 0 as input parameters.
Calling this method to change the properties will affect all shape element instances loaded
from the same resource. Call makeUnique() before calling this method.
width - Indicates the stroke width to set. The value must be positive or 0.
No stroke is drawn when the value is 0. Nothing happens when an invalid value is passed.color - Indicates the stroke color to set. A transparent stroke is drawn when the value is null.dashSize - Indicates the length of each dash, in pixels. The value must be positive or 0.
No dash is drawn when the value is 0 or negative.dashSpace - Indicates the gap between two adjacent dashes, in pixels. The value must be positive.
No dash is drawn when the value is 0 or negative.setStroke(int, RgbColor),
setStroke(int, RgbColor[]),
setStroke(int, RgbColor[], float, float),
setStrokeCap(Paint.StrokeCap),
getStrokeColors(),
getStrokeWidth(),
setDashPathEffectValues(float[], float),
makeUnique()public void setStroke(int width,
RgbColor[] colors,
float dashSize,
float dashSpace)
The dash usage is equivalent to setDashPathEffectValues(float[],float)
with the dash path effect intervals (specified by dashSize and dashSpace)
and the phase 0 as input parameters.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
width - Indicates the stroke width to set. The value must be positive or 0.
No stroke is drawn when the value is 0. Nothing happens when an invalid value is passed.colors - Indicates the stroke colors to set. The value null means a transparent stroke.dashSize - Indicates the length of each dash, in pixels. The value must be positive or 0.
No dash is drawn when the value is 0 or negative.dashSpace - Indicates the gap between two adjacent dashes, in pixels. The value must be positive.
No dash is drawn when the value is 0 or negative.setStroke(int, RgbColor),
setStroke(int, RgbColor[]),
setStroke(int, RgbColor, float, float),
getStrokeColors(),
getStrokeWidth(),
setDashPathEffectValues(float[], float),
makeUnique()public int getStrokeWidth()
ShapeElement object.setStroke(int, RgbColor)@Deprecated public RgbColor getStrokeColor()
getStrokeColors() instead.setStroke(int, RgbColor)public RgbColor[] getStrokeColors()
setStroke(int, RgbColor),
setStroke(int, RgbColor[]),
setStroke(int, RgbColor, float, float),
setStroke(int, RgbColor[], float, float)public void setStrokeCap(Paint.StrokeCap cap)
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
cap - Indicates the stroke cap to set. The value cannot be null.IllegalArgumentException - Throws this exception if the cap value is invalid.getStrokeCap(),
setStrokeCapEnabled(boolean),
isStrokeCapEnabled()public Paint.StrokeCap getStrokeCap()
setStrokeCap(Paint.StrokeCap),
setStrokeCapEnabled(boolean),
isStrokeCapEnabled()public void setStrokeCapEnabled(boolean enable)
StrokeCap option for this shape element.
Enable the StrokeCap option if you want to draw stroke caps.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
enable - Specifies whether to enable the StrokeCap option. The value true means to
enable the option, and false means the opposite. The default value is false.setStrokeCap(Paint.StrokeCap),
isStrokeCapEnabled()public boolean isStrokeCapEnabled()
StrokeCap option is enabled for this shape element.true if the StrokeCap option is enabled; returns false otherwise.setStrokeCapEnabled(boolean)public void setStrokeStops(float[] points)
Colors are distributed evenly between the start and end points, which are 0.0f and
1.0f, respectively. Intermediate values must be strictly increasing.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
points - Indicates the points where gradient colors are drawn. The value of each point ranges from
0.0f to 1.0f.IllegalArgumentException - Throws this exception if the points value is invalid.getStrokeStops(),
makeUnique()public float[] getStrokeStops()
Colors are distributed evenly between the start and end points, which are 0.0f and
1.0f, respectively. Intermediate values must be strictly increasing.
0.0f and 1.0f.setStrokeStops(float[])public void setStrokeShaderType(int type)
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
type - Indicates the stroke shader type to set, which can be LINEAR_GRADIENT_SHADER_TYPE,
RADIAL_GRADIENT_SHADER_TYPE, or SWEEP_GRADIENT_SHADER_TYPE.
The default value is LINEAR_GRADIENT_SHADER_TYPE.IllegalArgumentException - Throws this exception if the type value is invalid.getStrokeShaderType(),
makeUnique()public int getStrokeShaderType()
setStrokeShaderType(int)public void setStrokeOrientation(ShapeElement.Orientation orientation)
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
orientation - Indicates the direction (angle) to specify for the gradient.getStrokeOrientation(),
makeUnique()public ShapeElement.Orientation getStrokeOrientation()
setStrokeOrientation(Orientation)public void setStrokeShaderCenter(float x,
float y)
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
This method works only when the stroke shader type is RADIAL_GRADIENT_SHADER_TYPE or
SWEEP_GRADIENT_SHADER_TYPE.
x - Indicates the x-position of the shader point based on the proportion to the width.
The default value is 0.5. The value must be positive or 0.0f.y - Indicates the y-position of the shader point based on the proportion to the height.
The default value is 0.5. The value must be positive or 0.0f.IllegalArgumentException - Throws this exception if the x or y value is invalid.getStrokeShaderCenter(),
makeUnique()public float[] getStrokeShaderCenter()
setStrokeShaderCenter(float, float)public void setStrokeShaderRadius(float radius,
ShapeElement.RadiusType type)
This method works only when the shader type is RADIAL_GRADIENT_SHADER_TYPE.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
radius - Indicates the radius of the gradient to set.
The value must be positive or 0.0f.type - Indicates the radius value type.
If the value is RadiusType#FRACTION, the radius is a proportion to the element size
(minimum of width and height).
If the value is RadiusType#PIXELS, the radius is a value in pixels.IllegalArgumentException - Throws this exception if the radius or type value is invalid.getStrokeShaderRadius(),
getStrokeShaderRadiusType(),
makeUnique()public float getStrokeShaderRadius()
The radius is valid only when the shader type is RADIAL_GRADIENT_SHADER_TYPE.
setStrokeShaderRadius(float, RadiusType)public ShapeElement.RadiusType getStrokeShaderRadiusType()
The radius is valid only when the shader type is RADIAL_GRADIENT_SHADER_TYPE.
setStrokeShaderRadius(float, RadiusType)public void setCornerRadius(float radius)
RECTANGLE.
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
radius - Indicates the radius.
If this parameter is set to a value greater than 0, the rectangle is a rounded rectangle.
If the value is less than 0, the setting is invalid.IllegalArgumentException - Throws this exception if the radius value is invalid.getCornerRadius(),
makeUnique()public float getCornerRadius()
setCornerRadius(float)public void setCornerRadiiArray(float[] radii)
RECTANGLE.
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
radii - Indicates the radius array of four corners.
If the array's length is not equal to 8, the setting is invalid.
Each pair of radius means one corner's x-axis radius and y-axis radius.
The values in array must be positive or 0.0f.IllegalArgumentException - Throws this exception if the radii array length
isn't 8.getCornerRadii(),
makeUnique()public void setCornerRadiiArray(float[] radii,
boolean relative)
RECTANGLE.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
radii - Indicates the relative radius array of four corners. If the array's length is not equal to
8, the setting is invalid. Each pair of radii means the x-axis radius and y-axis radius of a corner. The
values in the array must be positive or 0.0f.relative - Specifies whether to use the relative radius. The value true means to use the
relative radius, and false means the opposite.IllegalArgumentException - Throws this exception if the array length of radii
is not CORNER_RADIUS_ARRAY_SIZE.setCornerRadiiArray(float[]),
getCornerRadii(),
getCornerRadiiResolved(),
makeUnique()public float[] getCornerRadii()
setCornerRadiiArray(float[]),
setCornerRadiiArray(float[], boolean),
getCornerRadiiResolved()public float[] getCornerRadiiResolved()
setCornerRadiiArray(float[], boolean)public void setShaderType(int type)
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
type - Indicates the shader type, which can be LINEAR_GRADIENT_SHADER_TYPE,
RADIAL_GRADIENT_SHADER_TYPE, or SWEEP_GRADIENT_SHADER_TYPE.
The default value is LINEAR_GRADIENT_SHADER_TYPE.IllegalArgumentException - Throws this exception if the type value is invalid.getShaderType(),
makeUnique()public int getShaderType()
setShaderType(int)public void setShaderStops(float[] points)
Colors are distributed evenly between the start and end points, which are 0.0f and
1.0f, respectively. Intermediate values must be strictly increasing.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
points - Indicates the points to draw shade colors. The value ranges from 0.0f to 1.0f.getShaderStops(),
makeUnique()public float[] getShaderStops()
Colors are distributed evenly between the start and end points, which are 0.0f and
1.0f, respectively. Intermediate values must be strictly increasing.
0.0f and 1.0f.getShaderStops()public void setArc(Arc arc)
ShapeElement object in the shape of ARC.
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
arc - Indicates the arc attributes to set.IllegalArgumentException - Throws this exception if the arc value is null.getArc(),
makeUnique()public Arc getArc()
ShapeElement object in the shape of ARC.setArc(Arc),
setSectorEnabled(boolean)public void setSectorEnabled(boolean enable)
This parameter is valid only when the shape type is ARC.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
enable - Specifies whether to support sector drawing for an arc shape. The value true means to
support sector drawing, and false means the opposite. The default value is false.isSectorEnabled(),
setArc(Arc),
makeUnique()public boolean isSectorEnabled()
true if sector drawing is supported; returns false otherwise.setSectorEnabled(boolean)public void setGradientOrientation(ShapeElement.Orientation orientation)
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
orientation - Indicates the direction (angle) to specify for the gradient effect of this element object.getGradientOrientation(),
makeUnique()public ShapeElement.Orientation getGradientOrientation()
setGradientOrientation(Orientation)@Deprecated public void setOrientation(ShapeElement.Orientation orientation)
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
orientation - Indicates the direction (angle) to specify for the gradient effect of this element object.getOrientation(),
makeUnique()@Deprecated public ShapeElement.Orientation getOrientation()
getGradientOrientation() instead.setOrientation(Orientation)public void setPath(Path path)
PATH.path - Indicates the path.IllegalArgumentException - Throws this exception if the path value is null.getPath()public Path getPath()
setPath(Path)public void setDashPathEffectValues(float[] intervals,
float phase)
Note: be careful with the changing this property because it will affect all instances of an
element loaded from the same resource. Please invoke makeUnique() before changing this property.
intervals - Indicates the dash path effect value array to set.
The array items are in pairs: The even and odd indices of these values
specify the number of pixels to draw and the number of blank pixels, respectively.
Each interval value must be positive or 0.0f.phase - Indicates the dash path effect phase.IllegalArgumentException - Throws this exception if the intervals values are invalid.getDashPathEffectIntervals(),
getDashPathEffectPhase(),
makeUnique()public float[] getDashPathEffectIntervals()
The intervals are in pairs. The even and odd indices of these values specify the number of pixels to draw and the number of blank pixels, respectively.
setDashPathEffectValues(float[], float)public float getDashPathEffectPhase()
setDashPathEffectValues(float[], float)public void setShaderCenter(float x,
float y)
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
This method works only when the stroke shader type is RADIAL_GRADIENT_SHADER_TYPE or
SWEEP_GRADIENT_SHADER_TYPE.
x - Indicates the x-position of the gradient point based on the proportion to the width.
The default value is 0.5. The value must be positive or 0.0f.y - Indicates the y-position of the gradient point based on the proportion to the height.
The default value is 0.5. The value must be positive or 0.0f.IllegalArgumentException - Throws this exception if the x or y value is invalid.getShaderCenter(),
makeUnique()public float[] getShaderCenter()
setShaderCenter(float, float)public void setShaderRadius(float radius,
ShapeElement.RadiusType type)
This method can be used only when the shader type is RADIAL_GRADIENT_SHADER_TYPE.
Calling this method to change the properties will affect all shape element instances loaded from the same
resource. Call makeUnique() before calling this method.
radius - Indicates the radius of the gradient to set. The value must be positive or 0.0f.type - Indicates the radius value type. If the value is RadiusType#FRACTION, the radius is a
proportion to the element size (minimum of width and height). If the value is RadiusType#PIXELS, the
radius is a value in pixels.IllegalArgumentException - Throws this exception if the radius value is invalid or
type is null.getShaderRadius(),
getShaderRadiusType(),
makeUnique(),
ShapeElement.RadiusTypepublic float getShaderRadius()
The radius is valid only when the shader type is RADIAL_GRADIENT_SHADER_TYPE.
setShaderRadius(float, RadiusType),
getShaderRadiusType()public ShapeElement.RadiusType getShaderRadiusType()
The radius is valid only when the shader type is RADIAL_GRADIENT_SHADER_TYPE.
setShaderRadius(float, RadiusType),
getShaderRadius()public Element makeUnique()