增加/减少 UIImageView 的亮度
有谁知道如何改变 Objective-C 中 UIImageView 的亮度?另外,有没有办法增加/减少 UIImage 的大小?
Does anybody know how to change the brightness of a UIImageView
in objective-C? Also, is there a way to increase/decrease the size of the UIImage
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
UIImage
(void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha
方法,看看您可以创建什么。否则,您将必须做一些更深入的工作来增加 HSV 颜色空间中每个像素的亮度(按比例增加 V 值)。不过,通过使用正确的混合模式将图像与白色图像混合,您应该能够使UIImageView
中包含的UIImage
变亮。编辑:
另外,正如我在您的其他问题中回答的那样,
UIImage
将缩放以适应UIImageView
。图像数据本身不会缩放,但屏幕渲染会缩放。Check out the
UIImage
(void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha
method and see what you can create. Otherwise, you are going to have to do some more in depth work increasing the brightness of each pixel in HSV color space (proportionately increasing the V values). By blending the image with a white image using the right blend mode though, you should be able to brighten theUIImage
contained within theUIImageView
.EDIT:
Also, as I answered in your other question, the
UIImage
will scale to fit theUIImageView
. The image data itself will not scale, but the onscreen rendering will.