OvalShape
public class OvalShape
extends RectShape
| java.lang.Object | |||
| ↳ | android.graphics.drawable.shapes.Shape | ||
| ↳ | android.graphics.drawable.shapes.RectShape | ||
| ↳ | android.graphics.drawable.shapes.OvalShape | ||
Defines an oval shape.
The oval can be drawn to a Canvas with its own draw() method, but more graphical control is available if you instead pass the OvalShape to a ShapeDrawable.
Summary
Public constructors | |
|---|---|
OvalShape() | |
Public methods | |
|---|---|
OvalShape | clone() Creates and returns a copy of this object. |
void | draw(Canvas canvas, Paint paint) Draws this shape into the provided Canvas, with the provided Paint. |
void | getOutline(Outline outline) Computes the Outline of the shape and return it in the supplied Outline parameter. |
Inherited methods | |
|---|---|
Public constructors
Public methods
clone
public OvalShape clone ()
Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:
will be true, and that the expression: x.clone() != x
will be x.clone().getClass() == x.getClass()
true, but these are not absolute requirements. While it is typically the case that: will be x.clone().equals(x)
true, this is not an absolute requirement. By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().
By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.
| Returns | |
|---|---|
OvalShape | a clone of this instance. |
| Throws | |
|---|---|
CloneNotSupportedException | |
draw
public void draw (Canvas canvas, Paint paint)
Draws this shape into the provided Canvas, with the provided Paint.
Before calling this, you must call resize(float, float).
| Parameters | |
|---|---|
canvas | Canvas: the Canvas within which this shape should be drawn |
paint | Paint: the Paint object that defines this shape's characteristics |
getOutline
public void getOutline (Outline outline)
Computes the Outline of the shape and return it in the supplied Outline parameter. The default implementation does nothing and outline is not changed.
| Parameters | |
|---|---|
outline | Outline: the Outline to be populated with the result. Must be non-null. |