我遇到麻烦时,我使用canvas.clipPath,它显示锯齿,它看起来不光滑,我知道如果我使用Paint,我可以使用mPaint.setFlags(Paint.ANTI_ALIAS_FLAG) ,这可以抗锯齿,但在我的代码中,我不能使用绘画。如何在画布和路径中进行抗锯齿
public static void drawCurrentPageArea(Canvas canvas, Bitmap bitmap) {
//cebakhja
canvas.save();
canvas.clipPath(getPath5(), Region.Op.XOR);
canvas.drawBitmap(bitmap, 0, 0, null);
canvas.restore();
}
public static Path getPath5()
{
Path mPath5 = new Path();
mPath5.moveTo(ptc.x, ptc.y);
mPath5.quadTo(pte.x, pte.y, ptb.x,ptb.y);
mPath5.lineTo(pta.x, pta.y);
mPath5.lineTo(ptk.x, ptk.y);
mPath5.quadTo(pth.x, pth.y, ptj.x,ptj.y);
mPath5.lineTo(ptf.x, ptf.y);
mPath5.close();
return mPath5;
}
你可以看到我使用canvas.drawBitmap(bitmap,0,0,null);油漆是空的。如果我需要添加油漆,你有什么建议吗? PIC是为http://i.6.cn/cvbnm/36/5c/20/5d8d20e3bafe432d792793509f99131e.jpg
编辑:我定的油漆为空,但不影响
你说你不能和ANTI_ALIAS_FLAG一起使用paint,为什么不呢? – SteelBytes 2011-04-30 04:20:36
你在我的代码中看到,我不使用油漆,所以我不能使用ANTI_ALIAS_FLAG – pengwang 2011-04-30 04:39:59
我看到你不知道,我问为什么不。即,为什么不是canvas.drawBitmap(位图,0,0,新的Paint(Paint.ANTI_ALIAS_FLAG)); – SteelBytes 2011-04-30 04:44:10