public final class GestureUtils
extends Object
| java.lang.Object | |
| android.gesture.GestureUtils | |
用于手势处理和分析的实用功能,包括以下方法:
公共方法(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) |
|
|---|---|
java.lang.Object
|
|
OrientedBoundingBox computeOrientedBoundingBox (ArrayList<GesturePoint> originalPoints)
计算一组点的定向最小边界框。
| 返回(Returns) | |
|---|---|
OrientedBoundingBox |
an oriented bounding box |
OrientedBoundingBox computeOrientedBoundingBox (float[] originalPoints)
计算一组点的定向最小边界框。
| 返回(Returns) | |
|---|---|
OrientedBoundingBox |
an oriented bounding box |
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] |
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] |
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] |