在图像视图上应用旋转后,图像变得模糊和扭曲

发布于 2024-12-28 20:08:59 字数 460 浏览 6 评论 0原文

我遇到了一个奇怪的问题, 我有一个图像视图,必须以大约 5 度的某个角度显示。为此,我将 UIImageView 旋转到 5 度,但 UIImageView 中的图像未按原样正确显示转型前。

如需更多了解,请参阅图像

旋转前的图像 旋转后的图像

您可以看到第二张图像看起来像是从角落剪掉的,而且看起来也有些模糊。

我的轮换代码:-

myimageView.transform = CGAffineTransformMakeRotation(radians(5));

请建议我如何解决这个问题。

提前致谢。

I am stuck with a strange problem that,
I have a image view which has to shown at some angle approx 5 degree.For that I rotate my UIImageView to 5 degree but the image in UIImageView not coming proper as it was before transformation.

For more understanding see images

image before rotation
image after rotation

You can see the second image is looking like clipped from corners and looks some blur also.

My code for rotation:-

myimageView.transform = CGAffineTransformMakeRotation(radians(5));

Please suggest me how to solve this problem.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故事和酒 2025-01-04 20:08:59

看起来这个类似的 SO Q&A 中有几个解决方案:
任何快速而肮脏的抗锯齿技术旋转的 UIImageView?

如果实际上只是锯齿状的边缘,请尝试在图像内容周围添加 1px 透明边框(这是上面链接中的建议)。

Looks like there are several solutions located in this similar SO Q&A:
Any quick and dirty anti-aliasing techniques for a rotated UIImageView?

If it is, in fact, just the edges that are jagged, try adding a 1px transparent border around in image content (this is a suggestion in the above link).

蹲在坟头点根烟 2025-01-04 20:08:59

您是否尝试过使用CGContextRotateCTM(context, radians);[sourceImage drawInRect:rect];

Have you tried using CGContextRotateCTM(context, radians); and [sourceImage drawInRect:rect];?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文