Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
    
    Gesture
    open class Gesture : Parcelable
    
    A gesture is a hand-drawn shape on a touch screen. It can have one or multiple strokes. Each stroke is a sequence of timed points. A user-defined gesture can be recognized by a GestureLibrary.
    Summary
    
      
        
          | Inherited constants | 
        
          | From class Parcelable
                
                  
                    | Int | CONTENTS_FILE_DESCRIPTOR
                         Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor. |  
                    | Int | PARCELABLE_WRITE_RETURN_VALUE
                         Flag for use with writeToParcel: the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)". Some implementations may want to release resources at this point. |  | 
      
    
    
    
    
    Public constructors
    
    Public methods
    
      addStroke
      
      open fun addStroke(stroke: GestureStroke!): Unit
      Adds a stroke to the gesture.
      
     
    
      clone
      
      open fun clone(): Any!
      
        
          
            | Return | 
          
            | Any! | a clone of this instance. | 
        
      
      
        
          
            | Exceptions | 
          
            | java.lang.CloneNotSupportedException | if the object's class does not support the Cloneableinterface. Subclasses that override theclonemethod can also throw this exception to indicate that an instance cannot be cloned. | 
        
      
     
    
      describeContents
      
      open fun describeContents(): Int
      
     
    
      getBoundingBox
      
      open fun getBoundingBox(): RectF!
      
        
          
            | Return | 
          
            | RectF! | the bounding box of the gesture | 
        
      
     
    
      getID
      
      open fun getID(): Long
      
        
          
            | Return | 
          
            | Long | the id of the gesture | 
        
      
     
    
      getLength
      
      open fun getLength(): Float
      Calculates the total length of the gesture. When there are multiple strokes in the gesture, this returns the sum of the lengths of all the strokes.
      
        
          
            | Return | 
          
            | Float | the length of the gesture | 
        
      
     
    
    
      getStrokesCount
      
      open fun getStrokesCount(): Int
      
        
          
            | Return | 
          
            | Int | the number of strokes included by this gesture | 
        
      
     
    
      toBitmap
      
      open fun toBitmap(
    width: Int, 
    height: Int, 
    inset: Int, 
    color: Int
): Bitmap!
      Creates a bitmap of the gesture with a transparent background.
      
      
     
    
      toBitmap
      
      open fun toBitmap(
    width: Int, 
    height: Int, 
    edge: Int, 
    numSample: Int, 
    color: Int
): Bitmap!
      Creates a bitmap of the gesture with a transparent background.
      
        
          
            | Parameters | 
          
            | width | Int: width of the target bitmap | 
          
            | height | Int: height of the target bitmap | 
          
            | edge | Int: the edge | 
          
            | numSample | Int: | 
          
            | color | Int: | 
        
      
      
     
    
      toPath
      
      open fun toPath(): Path!
     
    
      toPath
      
      open fun toPath(path: Path!): Path!
     
    
    
      toPath
      
      open fun toPath(
    width: Int, 
    height: Int, 
    edge: Int, 
    numSample: Int
): Path!
     
    
      writeToParcel
      
      open fun writeToParcel(
    out: Parcel, 
    flags: Int
): Unit
      
     
    Properties
    
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [null,null,["Last updated 2025-02-10 UTC."],[],[]]