Most visited

Recently visited

Added in API level 8

GestureUtils

public final class GestureUtils
extends Object

java.lang.Object
   ↳ android.gesture.GestureUtils


用于手势处理和分析的实用功能,包括以下方法:

Summary

Public methods

static OrientedBoundingBox computeOrientedBoundingBox(ArrayList<GesturePoint> originalPoints)

计算一组点的定向最小边界框。

static OrientedBoundingBox computeOrientedBoundingBox(float[] originalPoints)

计算一组点的定向最小边界框。

static float[] spatialSampling(Gesture gesture, int bitmapSize)

通过将手势呈现为2D灰度位图来在空间上对手势进行采样。

static float[] spatialSampling(Gesture gesture, int bitmapSize, boolean keepAspectRatio)

通过将手势呈现为2D灰度位图来在空间上对手势进行采样。

static float[] temporalSampling(GestureStroke stroke, int numPoints)

暂时将笔画抽样为给定数量的均匀分布的点。

Inherited methods

From class java.lang.Object

Public methods

computeOrientedBoundingBox

Added in API level 8
OrientedBoundingBox computeOrientedBoundingBox (ArrayList<GesturePoint> originalPoints)

计算一组点的定向最小边界框。

Returns
OrientedBoundingBox an oriented bounding box

computeOrientedBoundingBox

Added in API level 8
OrientedBoundingBox computeOrientedBoundingBox (float[] originalPoints)

计算一组点的定向最小边界框。

Returns
OrientedBoundingBox an oriented bounding box

spatialSampling

Added in API level 8
float[] spatialSampling (Gesture gesture, 
                int bitmapSize)

通过将手势呈现为2D灰度位图来在空间上对手势进行采样。 缩放手势以适合位图的大小。 缩放不一定保持手势的宽高比。

Parameters
gesture Gesture: the gesture to be sampled
bitmapSize int: the size of the bitmap
Returns
float[] a bitmapSize x bitmapSize grayscale bitmap that is represented as a 1D array. The float at index i represents the grayscale value at pixel [i%bitmapSize, i/bitmapSize]

spatialSampling

Added in API level 8
float[] spatialSampling (Gesture gesture, 
                int bitmapSize, 
                boolean keepAspectRatio)

通过将手势呈现为2D灰度位图来在空间上对手势进行采样。 缩放手势以适合位图的大小。

Parameters
gesture Gesture: the gesture to be sampled
bitmapSize int: the size of the bitmap
keepAspectRatio boolean: if the scaling should keep the gesture's aspect ratio
Returns
float[] a bitmapSize x bitmapSize grayscale bitmap that is represented as a 1D array. The float at index i represents the grayscale value at pixel [i%bitmapSize, i/bitmapSize]

temporalSampling

Added in API level 8
float[] temporalSampling (GestureStroke stroke, 
                int numPoints)

暂时将笔画抽样为给定数量的均匀分布的点。

Parameters
stroke GestureStroke: the gesture stroke to be sampled
numPoints int: the number of points
Returns
float[] the sampled points in the form of [x1, y1, x2, y2, ..., xn, yn]

Hooray!