帆布抗锯齿硬件加速(Android的API 11及更高版本) [英] Canvas antialiasing with hardware acceleration (Android API 11 and Later)

查看:256
本文介绍了帆布抗锯齿硬件加速(Android的API 11及更高版本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的位图我画在画布及功放内;我用旋转矩阵。

I have a simple bitmap that I draw within a canvas & that I rotate using a matrix.

我碰到的问题是,使用硬件加速旋转时(这是工作完美地与硬件加速关闭)边缘没有抗锯齿。 当然,像setDrawFilter而且是无用的,因为它们在硬件加速功能开启时忽略!

The problem I bump into is that using hardware acceleration the edges are not anti-aliased when rotated (this is working perfectly with Hardware acceleration turning off). And of course things like "setDrawFilter" are useless as they are ignored when hardware acceleration is turned on!

canvas.setDrawFilter(new PaintFlagsDrawFilter(1, Paint.ANTI_ALIAS_FLAG));

我缺少的东西或者是它的硬件渲染方法只是一个限制?有没有什么别的选择吗?

Am I missing something or is it just a limitation of the hardware rendering method ? Is there any alternative?

推荐答案

设置抗伪标志上的油漆也不会帮助反正。要旋转他们,你应该添加一个1px的透明边框周围时,你得到的位图抗锯齿的边界。

Setting the antialias flag on the paint would not help anyway. To get antialiased borders on bitmap when rotating them you should add a 1px transparent border around them.

这篇关于帆布抗锯齿硬件加速(Android的API 11及更高版本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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