Added in API level 1

PathShape


open class PathShape : Shape

Creates geometric paths, utilizing the android.graphics.Path class.

The path can be drawn to a Canvas with its own draw() method, but more graphical control is available if you instead pass the PathShape to a android.graphics.drawable.ShapeDrawable.

Summary

Public constructors
PathShape(path: Path, stdWidth: Float, stdHeight: Float)

PathShape constructor.

Public methods
open PathShape

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

open Boolean
equals(other: Any?)

open Int

Protected methods
open Unit
onResize(width: Float, height: Float)

Inherited functions
Float getHeight()

Returns the height of the Shape.

Unit 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.

Float getWidth()

Returns the width of the Shape.

Boolean hasAlpha()

Checks whether the Shape is opaque.

Default impl returns true. Override if your subclass can be opaque.

Unit resize(width: Float, height: Float)

Resizes the dimensions of this shape.

Must be called before draw(android.graphics.Canvas,android.graphics.Paint).

Public constructors

PathShape

Added in API level 1
PathShape(
    path: Path,
    stdWidth: Float,
    stdHeight: Float)

PathShape constructor.

Parameters
path Path: a Path that defines the geometric paths for this shape This value cannot be null.
stdWidth Float: the standard width for the shape. Any changes to the width with resize() will result in a width scaled based on the new width divided by this width.
stdHeight Float: the standard height for the shape. Any changes to the height with resize() will result in a height scaled based on the new height divided by this height.

Public methods

clone

Added in API level 1
open fun clone(): PathShape
Return
PathShape 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
Parameters
canvas Canvas!: the Canvas within which this shape should be drawn
paint Paint!: the Paint object that defines this shape's characteristics

equals

Added in API level 1
open fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

hashCode

Added in API level 1
open fun hashCode(): Int
Return
Int a hash code value for this object.

Protected methods

onResize

Added in API level 1
protected open fun onResize(
    width: Float,
    height: Float
): Unit
Parameters
width Float: the new width of the Shape
height Float: the new height of the Shape