我想创建更多平滑曲线,而不仅是线条角度。这是图片我此刻是如何得出:绘制平滑曲线
这里是我的代码:
case FREEHAND:
float[] pts;
float[] ptk;
ptk = new float[2];
imageMatrix.invert(inv);
if (mCurrentShape == null) {
mCurrentShape = new Line();
pts = new float[2];
((Line) mCurrentShape).setBegin(mDownPoint);
pts[0] = (float)((Line) mCurrentShape).getBegin().getX();
pts[1] = (float)((Line) mCurrentShape).getBegin().getY();
inv.mapPoints(pts);
((Line) mCurrentShape).getPath().moveTo(pts[0], pts[1]);
}
ptk[0] = (float)currentPoint.getX();
ptk[1] = (float)currentPoint.getY();
inv.mapPoints(ptk);
((Line) mCurrentShape).getPath().lineTo(ptk[0], ptk[1]);
break;
写意代码:
package aa.bb.cc;
import java.util.ArrayList;
import android.graphics.Path;
public class FreeHand extends Shape{
private ArrayList<Path>_graphics;
public FreeHand(){
super();
_graphics = new ArrayList<Path>();
}
public ArrayList<Path> getGraphicsPath(){
return _graphics;
}
}
看看这个:http://corner.squareup.com/2012/07/smoother-signatures.html它不是一个完整的解决方案,但它给你一个你可以做什么的想法。 – 2013-03-11 12:00:00
这篇关于贝塞尔曲线的文章可能很有用: http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/ – stan0 2013-03-11 13:47:13