开发者

Android Canvas.DrawBitmap without blurring/AntiAliasing?

I'm trying to make an android game using sprites, (or very pix开发者_开发技巧elated characters, backgrounds etc.). I draw them on the canvas like so...

matrix.preScale(xrat,yrat);

canvas.drawBitmap(img, matrix, null);

Where img is the Bitmap and the xrat and yrat are the scales.

My problem is that when I test, the Bitmap is blurry or anti-aliased, is there a way to prevent this? The rigid-blocky art style of the game will be ruined if the blocks are blurry.

Any (ANY) help appreciated!


Create a new Paint to use when drawing the bitmaps with the settings:

Paint drawPaint = new Paint();
drawPaint.setAntiAlias(false);
drawPaint.setFilterBitmap(false);

Filtering I believe is on by default and will attempt to smooth out bitmaps when drawn scaled up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜