write picture description here

Anti-aliasing in Android drawing

In the process of reading the program source code today, I came across a piece of code like this: canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG |Paint.FILTER_BITMAP_FLAG)); I don’t quite understand , Google took a look, it turned out to be: anti-aliasing processing. At the same time, I learned about two anti-aliasing methods in Android drawing. First of all, we must understand what is the sawtooth? As shown in the figure below, the left side is the graphics without anti-aliasing treatment, and the right side is the graphics after anti-aliasing treatment. It is obvious that the graphics after anti-aliasing treatment will appear smoother. On Android This problem also occurs in drawing, but why is there jaggedness? ①When we use Canvas to draw a bitmap, if the bitmap is selected, the bitmap will appear jagged. ② When using View’s RotateAnimation to animate, if the View contains a large number of graphics, jaggedness will also appear. So how to solve it? As long as you grasp one point, if you can set it through Paint, use Paint to set it. If you can’t use Paint to set it, add anti-aliasing to Canvas directly. Solution one, set it through Paint: First of all, in your In the…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索