1
這是表面觀和查看抗鋸齒的測試項目,可以嗎?如何在android中防止SurfaceView的別名?
在查看:(這是非常好的反鋸齒)
@Override
protected void onDraw(Canvas canvas) {
Paint p = new Paint();
p.setColor(Color.WHITE);
canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG));
canvas.drawColor(Color.BLACK);
Matrix mMatrix = new Matrix();
mMatrix.postScale(0.34f, 0.34f);
canvas.drawBitmap(mBitmap, mMatrix, p);
canvas.drawText("View Anti alias", 100, 300, p);
}
在表面觀
:(醜陋的-_- !!)
public void doDraw(Canvas canvas) {
Paint p = new Paint();
p.setColor(Color.WHITE);
canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));
canvas.drawColor(Color.BLACK);
Matrix mMatrix = new Matrix();
mMatrix.postScale(0.34f, 0.34f);
canvas.drawBitmap(mBitmap, mMatrix, p);
canvas.drawText("Surface View Anti alias", 100, 300, p);
}
ü可以從這裏下載源: http://sharpidea.co.cc/GifViewTest.rar
任何人能告訴我如何在ti的別名在surfaceView中?
在surfaceHolder.lockCanvas()畫布上使用drawPath()時會出現類似的問題。在畫布上嘗試了各種Paint組合和setDrawFilter()。如果您找到解決方案,請欣賞此更新。 – kctang 2011-10-06 15:12:45