Android APIs
public class

GestureStroke

extends Object
java.lang.Object
   ↳ android.gesture.GestureStroke

Class Overview

A gesture stroke started on a touch down and ended on a touch up. A stroke consists of a sequence of timed points. One or multiple strokes form a gesture.

Summary

Fields
public final RectF boundingBox
public final float length
public final float[] points
Public Constructors
GestureStroke(ArrayList<GesturePoint> points)
A constructor that constructs a gesture stroke from a list of gesture points.
Public Methods
void clearPath()
Invalidates the cached path that is used to render the stroke.
Object clone()
Creates and returns a copy of this Object.
OrientedBoundingBox computeOrientedBoundingBox()
Computes an oriented bounding box of the stroke.
Path getPath()
Path toPath(float width, float height, int numSample)
Converts the stroke to a Path of a given number of points.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public final RectF boundingBox

Added in API level 4

public final float length

Added in API level 4

public final float[] points

Added in API level 4

Public Constructors

public GestureStroke (ArrayList<GesturePoint> points)

Added in API level 4

A constructor that constructs a gesture stroke from a list of gesture points.

Public Methods

public void clearPath ()

Added in API level 4

Invalidates the cached path that is used to render the stroke.

public Object clone ()

Added in API level 4

Creates and returns a copy of this Object. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should call super.clone() to create the new instance and then create deep copies of the nested, mutable objects.

Returns
  • a copy of this object.

public OrientedBoundingBox computeOrientedBoundingBox ()

Added in API level 4

Computes an oriented bounding box of the stroke.

Returns
  • OrientedBoundingBox

public Path getPath ()

Added in API level 4

public Path toPath (float width, float height, int numSample)

Added in API level 4

Converts the stroke to a Path of a given number of points.

Parameters
width the width of the bounding box of the target path
height the height of the bounding box of the target path
numSample the number of points needed
Returns
  • the path