[英]Increase/Decrease brightness of a UIImageView
Does anybody know how to change the brightness of a UIImageView
in objective-C? 有人知道如何在Objective-C中更改UIImageView
的亮度吗? Also, is there a way to increase/decrease the size of the UIImage
? 另外,有没有办法增加/减小UIImage
的大小?
Check out the UIImage
(void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha
method and see what you can create. (void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha
出UIImage
(void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha
方法,看看可以创建什么。 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). 否则,您将不得不做更多的深度工作,以增加HSV颜色空间中每个像素的亮度(成比例地增加V值)。 By blending the image with a white image using the right blend mode though, you should be able to brighten the UIImage
contained within the UIImageView
. 通过使用正确的混合模式将图像与白色图像混合,您应该能够使UIImageView
包含的UIImage
变亮。
EDIT: 编辑:
Also, as I answered in your other question, the UIImage
will scale to fit the UIImageView
. 另外,正如我在另一个问题中回答的那样, UIImage
将缩放以适合UIImageView
。 The image data itself will not scale, but the onscreen rendering will. 图像数据本身不会缩放,但屏幕渲染会缩放。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.