equal
deleted
inserted
replaced
205 CGImageRelease(imageMasked); |
205 CGImageRelease(imageMasked); |
206 |
206 |
207 return newImage; |
207 return newImage; |
208 } |
208 } |
209 |
209 |
|
210 // by http://www.sixtemia.com/journal/2010/06/23/uiimage-negative-color-effect/ |
|
211 -(UIImage *)convertToNegative { |
|
212 UIGraphicsBeginImageContext(self.size); |
|
213 CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy); |
|
214 [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)]; |
|
215 CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeDifference); |
|
216 CGContextSetFillColorWithColor(UIGraphicsGetCurrentContext(),[UIColor whiteColor].CGColor); |
|
217 CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, self.size.width, self.size.height)); |
|
218 UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); |
|
219 UIGraphicsEndImageContext(); |
|
220 return result; |
|
221 } |
|
222 |
210 @end |
223 @end |