Increase/Decrease brightness of a UIImageView

北慕城南 提交于 2019-12-06 14:17:48

问题


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?


回答1:


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 the UIImage contained within the UIImageView.

EDIT:

Also, as I answered in your other question, the UIImage will scale to fit the UIImageView. The image data itself will not scale, but the onscreen rendering will.



来源:https://stackoverflow.com/questions/7219050/increase-decrease-brightness-of-a-uiimageview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!