Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何改变图像某些部分的饱和度?_Ios_Image_Swift_Core Graphics - Fatal编程技术网

Ios 如何改变图像某些部分的饱和度?

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 =

我有一个UIImageView和一些pointsCGPOint值。这样我就可以创建这样的路径

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,然后将其放回原处。