This is a test project for antialias in Surface View and View,
in the View : ( it's very good for antialias )
@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);
}
in the Surface View : ( ugly -_-!!)
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);
}
u can download the source from here: http://sharpidea.co.cc/GifViewTest.rar
any one can tell me how to anti alias in surfaceView ?