Android的Canvas.DrawBitmap不模糊/抗锯齿技术? [英] Android Canvas.DrawBitmap without blurring/AntiAliasing?

查看:3541
本文介绍了Android的Canvas.DrawBitmap不模糊/抗锯齿技术?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让使用精灵的安卓游戏,(或非常像素化的人物,背景等)。我画他们,像这样在画布上......

I'm trying to make an android game using sprites, (or very pixelated characters, backgrounds etc.). I draw them on the canvas like so...

矩阵preSCALE(xrat,yrat);

canvas.drawBitmap(IMG,矩阵,NULL);

在哪里IMG是位图和xrat和yrat是尺度。

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

我的问题是,当我测试,位图模糊或抗锯齿,是有办法prevent呢?如果块模糊游戏的刚性块状的艺术风格就完蛋了。

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)帮助AP preciated!

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.

这篇关于Android的Canvas.DrawBitmap不模糊/抗锯齿技术?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆