Ios 如何改变图像某些部分的饱和度?
我有一个UIImageView和一些pointsCGPOint值。这样我就可以创建这样的路径Ios 如何改变图像某些部分的饱和度?,ios,image,swift,core-graphics,Ios,Image,Swift,Core Graphics,我有一个UIImageView和一些pointsCGPOint值。这样我就可以创建这样的路径 var mutablePath = CGPathCreateMutable() var point1 = patternImageView.someFeature.rightPoints.objectAtIndex(1).CGPointValue() CGPathMoveToPoint(mutablePath, nil, point1.x, point1.y) point1 =
var mutablePath = CGPathCreateMutable()
var point1 = patternImageView.someFeature.rightPoints.objectAtIndex(1).CGPointValue()
CGPathMoveToPoint(mutablePath, nil, point1.x, point1.y)
point1 = patternImageView.someFeature.rightPoints.objectAtIndex(2).CGPointValue()
CGPathAddLineToPoint(mutablePath, nil, point1.x, point1.y)
point1 = patternImageView.someFeature.rightPoints.objectAtIndex(3).CGPointValue()
CGPathAddLineToPoint(mutablePath, nil, point1.x, point1.y)
point1 = patternImageView.someFeature.rightPoints.objectAtIndex(4).CGPointValue()
CGPathAddLineToPoint(mutablePath, nil, point1.x, point1.y)
CGPathCloseSubpath(mutablePath)
var pathForRight:CGPathRef = mutablePath
var rectRight = CGPathGetBoundingBox(pathForRight)
这样我就可以用路径中的所有点创建rect,如下所示
var mutablePath = CGPathCreateMutable()
var point1 = patternImageView.someFeature.rightPoints.objectAtIndex(1).CGPointValue()
CGPathMoveToPoint(mutablePath, nil, point1.x, point1.y)
point1 = patternImageView.someFeature.rightPoints.objectAtIndex(2).CGPointValue()
CGPathAddLineToPoint(mutablePath, nil, point1.x, point1.y)
point1 = patternImageView.someFeature.rightPoints.objectAtIndex(3).CGPointValue()
CGPathAddLineToPoint(mutablePath, nil, point1.x, point1.y)
point1 = patternImageView.someFeature.rightPoints.objectAtIndex(4).CGPointValue()
CGPathAddLineToPoint(mutablePath, nil, point1.x, point1.y)
CGPathCloseSubpath(mutablePath)
var pathForRight:CGPathRef = mutablePath
var rectRight = CGPathGetBoundingBox(pathForRight)
或者我可以将NSValue添加到数组中
var arrayRect = NSMutableArray()
arrayRect.addObject(NSValue(CGRect: CGPathGetBoundingBox(pathForRight)))
是否可以更改rect rectRight中所有像素的饱和度,或者更改某个rect中图像的饱和度?如何仅对图像上的某个rect应用CiFilter?CiFilter包括遮罩。或者,提取图像的一个矩形,应用CiFilter,然后将其放回原处。