ios - Performant outline around UIImage edges
问题描述
I'm trying to draw an outline around the edges of a UIImage
- achieving an outline effect like so:
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:
- Scaling down the image - helps but not enough as drawing still happens many times for high quality
- Drawing for high quality once and re-render in lower quality to draw fewer times - getting unexpected, inconsistent outline results
- I'm thinking of creating the colorized image once and scale it somehow according to the outline width value but I'm not sure how exactly to approach it.
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.
解决方案
推荐阅读
- ios - 无需物理创建 .PLIST 文件即可下载 .IPA 媒体
- angular - 如何验证反应形式的文本输入,以便在用户输入数字时显示错误
- c# - 使用委托/事件在 c# 中的一个地方处理所有子事件?
- java - 如何从 aws lambda 触发 AWS 步进函数
- java - 如何即时创建 pdf 文件并将其作为电子邮件附件?
- r - 使用不同列中的 2 个依赖选择输入过滤闪亮的数据表
- java - SpringApplication.run() 方法完成之前的大延迟
- java - stringRedisTemplate.opsForList().leftPop("key", 3, TimeUnit.SECONDS) 无法正常关闭
- typescript - 如何在 TypeScript 中使用 ToLowerCase 过滤数组
- postgresql - 按 id 选择行,它是按某个值排序的最近行。PostgreSQL