更流畅的签名

Written by Rob Dickerson.

作者:Rob Dickerson

In a previous post, we described how Square makes signatures appear smooth on Android devices. In the latest release of Square Card Reader, we’ve made signing on Android devices even smoother, more beautiful, and more responsive. The three major changes are an improved splining algorithm, variable stroke width rendering, and the addition of bitmap caching.

之前的文章中,我们描述了Square如何在Android设备上使签名看起来平滑。在最新版本的Square Card Reader中,我们使Android设备上的签名更加平滑、更加美观、更加响应。三个主要的改变是改进的样条算法、可变笔画宽度渲染和位图缓存的添加。

Splining

样条插值

As you move your finger across the signature sheet, Android delivers a sequence of touch events to the Square client, each of which contains a single (x,y) coordinate. To create a signature image, the client needs to reconstruct the line segments between these sampled touch points. The process of calculating line segments to connect a sequence of discrete points is called spline interpolation.

当您在签名表上移动手指时,Android会向Square客户端传递一系列触摸事件,每个事件包含一个(x,y)坐标。为了创建签名图像,客户端需要重建这些采样触摸点之间的线段。连接一系列离散点的线段计算过程称为样条插值

The most straightforward spline interpolation strategy is to connect pairs of touch points with straight lines. This is the strategy previously employed by the Square client.

最直接的样条插值策略是使用直线连接每对触摸点。这是之前Square客户端使用的策略。

Even with enough touch points to approximate the curves of the signature, the linear interpolation technique has the effect of making shapes appear blocky and flattened. If you focus on the curve of the shape above, you will notice corners around the touch points, and a general flattening of what should be a convex J shape.

即使有足够的触点来近似曲线的签名,线性插值技术会使形状看起来像是方块和扁平化的。如果你专注于上面形状的曲线,你会注意到触点周围有角,以及本应该是凸J形状的一般扁平化。

The problem is that the signer’s finger did not move in straight lines from point to point when tracing out this shape. Rather, our touch points are sampled from a full curve that the signer’s finger traced on the touchscreen. While we can’t know the original shape between the sampled points Android gave us, straight lines are not the best guess.

问题在于签名者的手指在追踪这个形状时...

开通本站会员,查看完整译文。

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.129.0. UTC+08:00, 2024-07-02 13:34
浙ICP备14020137号-1 $Map of visitor$