UIImageView增加特定区域的亮度

时间:2022-01-12 07:22:06

How can I increase brightness in specific area of a UIImageView, For ex:I have an imageview with image.I want to increase the brightness of image in specific elliptical area of that image. I know how to increase the brightness of whole image , But dont know for specific elliptical area.

如何增加UIImageView特定区域的亮度,例如:我有一个带图像的imageview。我想增加该图像特定椭圆区域的图像亮度。我知道如何增加整个图像的亮度,但不知道具体的椭圆区域。

1 个解决方案

#1


1  

You can add a black UIView with a specific alpha apply on it (this will control how dark you want your view) and attach a mask layer to this view that has an ellipse. For the part of your view that is masked it will be brighter.

您可以添加一个带有特定alpha应用的黑色UIView(这将控制您希望视图的暗度)并将遮罩层附加到具有椭圆的此视图。对于被遮盖的视图部分,它会更亮。

You need to import the Quartzcore framework when you are working with layer/mask. The mask is a property of your view layer ([yourView layer].mask).

在使用图层/蒙版时,需要导入Quartzcore框架。蒙版是视图图层的属性([yourView图层] .mask)。

#1


1  

You can add a black UIView with a specific alpha apply on it (this will control how dark you want your view) and attach a mask layer to this view that has an ellipse. For the part of your view that is masked it will be brighter.

您可以添加一个带有特定alpha应用的黑色UIView(这将控制您希望视图的暗度)并将遮罩层附加到具有椭圆的此视图。对于被遮盖的视图部分,它会更亮。

You need to import the Quartzcore framework when you are working with layer/mask. The mask is a property of your view layer ([yourView layer].mask).

在使用图层/蒙版时,需要导入Quartzcore框架。蒙版是视图图层的属性([yourView图层] .mask)。