Added in API level 1

OvalShape


open class OvalShape : RectShape
kotlin.Any
   ↳ 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 android.graphics.drawable.ShapeDrawable.

Summary

Public constructors

Public methods
open OvalShape

Creates and returns a copy of this object.

open Unit
draw(canvas: Canvas!, paint: Paint!)

Draws this shape into the provided Canvas, with the provided Paint.

open Unit
getOutline(outline: Outline)

Computes the Outline of the shape and return it in the supplied Outline parameter.

Inherited functions

Public constructors

OvalShape

Added in API level 1
OvalShape()

Public methods

clone

Added in API level 1
open fun clone(): OvalShape

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:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be 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.

Return
OvalShape a clone of this instance.
Exceptions
java.lang.CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

draw

Added in API level 1
open fun draw(
    canvas: Canvas!,
    paint: Paint!
): Unit

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

Added in API level 21
open fun getOutline(outline: Outline): Unit

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.