首页 > 解决方案 > Performant outline around UIImage edges

问题描述

I'm trying to draw an outline around the edges of a UIImage - achieving an outline effect like so:

enter image description here

As much as I understood, the best solution is to create a replica of the original image, filled with the desired outline color and drawing it behind the original image, and potentially looping through the image angles and re-drawing to round out rough edges.
Currently, I'm using the solution proposed here (by @Stéphane de Luca), but the problem is that this solution is very slow for my needs as I need to control the outline width with a slider.

So, basically I need to either find a different outlining algorithm or find a way to optimize the performance of the current solution.
What I did try to optimize performance:

I'll appreciate any help, whether it's proposing a different algorithm / outlining technique or potential ways to optimize the current solution for high performance and fast value changes.

标签: iosswiftgraphicsuiimagecore-graphics

解决方案


推荐阅读