Android Canvas.DrawBitmap 没有模糊/抗锯齿?
我正在尝试使用精灵(或非常像素化的角色、背景等)制作一个Android游戏。我像这样在画布上绘制它们...
matrix.preScale(xrat,yrat);
canvas.drawBitmap(img, matrix, null);
其中 img 是位图xrat 和 yrat 是音阶。
我的问题是,当我测试时,位图模糊或抗锯齿,有办法防止这种情况吗?如果方块模糊的话,游戏僵硬的块状美术风格就会被破坏。
任何(任何)帮助表示赞赏!
I'm trying to make an android game using sprites, (or very pixelated 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个新的画图,以便在使用以下设置绘制位图时使用:
过滤我相信默认情况下处于启用状态,并且在按比例绘制时会尝试平滑位图。
Create a new Paint to use when drawing the bitmaps with the settings:
Filtering I believe is on by default and will attempt to smooth out bitmaps when drawn scaled up.