Preface I saw @周楷雯Kevin talking about CALayer anti-aliasing issues on Weibo over the weekend The specific steps are:
I remembered that I encountered a similar problem a long time ago. At that time, I had to make a sticker-like application, so of course I would encounter the problem of sticker scaling and rotation, so the aliasing problem also needed to be solved. But at that time, it was the era of iOS 4 and 5, and there was no such thing as allowsEdgeAntialiasing mentioned above (this thing was not released until iOS 7, but it is said that iOS 6 can also be used, but it is black technology... you know) So I asked for help from stackoverflow and got a very simple but not simple method, which is what I said on Weibo. Just leave a one-pixel transparent border on the image to be displayed and it will be done. method The method is relatively simple. I wrote it as a UIImage Category method and it has been sitting in my tool library for years (I only remembered it when I encountered this problem).
Let’s take a look at the actual effect first It can be seen that if no processing is done during rotation, there will be obvious aliasing. Using the transparent edge method or setting allowsEdgeAntialiasing can eliminate aliasing. Next, let’s take a look at the performance comparison of these two methods. The test method is to rotate 500 UIImageViews on my iPhone 5S and compare the frame rates. The results are as follows The results show that the performance of allowsEdgeAntialiasing is still slightly worse than the transparent edge method, so...
summary The demo in this article can be found here The testing method may not be very rigorous (I wrote this article on the spur of the moment so it didn't take me too much time). If there are any errors, please point them out. |
<<: Summary of tips for Android code optimization
>>: App Store exposure data and acquisition methods
[[139917]] About interview questions Interview qu...
Recently, there should be a large number of fans ...
[[141038]] Since mid-January I have been working ...
The report shows that even though the scale of Ch...
The salary of programmers varies. Some may earn 3...
The Spring Festival is coming again, and the Spri...
Sleep apnea syndrome is a common sleep disorder t...
The author or source of this article or its origi...
In mid-to-late February this year, I changed jobs...
This article is the on-site dry goods of WOT2016 ...
Archives connect the present and the past, and ca...
According to a report by Russian Satellite Networ...
Huang Shiming: Stop the inner war you started: Ge...
Apple's innovation ability has declined great...
This week for workers It's been a long week T...