本文介绍了如何赋予UIImage负面色彩效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的第一个问题。
我有一个应用程序,其中我想更改图像效果看起来像负色效果
This is my first question.
I have an app in which i want to change the image effect look like negative color effect
推荐答案
这很简单你必须选择图像并在下面的代码中设置图像
it's so simple you have to choose image and set the image in the below code
UIGraphicsBeginImageContext(renderImage.size);
CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy);
[renderImage drawInRect:CGRectMake(0, 0, renderImage.size.width, renderImage.size.height)];
CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeDifference);
CGContextSetFillColorWithColor(UIGraphicsGetCurrentContext(),[UIColor whiteColor].CGColor);
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, renderImage.size.width, renderImage.size.height));
renderImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
这篇关于如何赋予UIImage负面色彩效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!