├── .gitignore ├── .travis.yml ├── CTImageEdit.podspec ├── CTImageEdit ├── Assets │ ├── .gitkeep │ ├── sccphoto_smear_last@2x.png │ ├── sccphoto_smear_last@3x.png │ ├── sccphoto_smear_next@2x.png │ └── sccphoto_smear_next@3x.png └── Classes │ ├── .gitkeep │ ├── CTImageEditUtil.h │ ├── CTImageEditUtil.m │ ├── CTImageSmearBottom.h │ ├── CTImageSmearBottom.m │ ├── CTImageSmearTop.h │ ├── CTImageSmearTop.m │ ├── CTImageSmearView.h │ ├── CTImageSmearView.m │ ├── CTImageSmearViewController.h │ ├── CTImageSmearViewController.m │ ├── UIImage+EditImageWithColor.h │ └── UIImage+EditImageWithColor.m ├── Example ├── CTImageEdit.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── CTImageEdit-Example.xcscheme ├── CTImageEdit.xcworkspace │ └── contents.xcworkspacedata ├── CTImageEdit │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── CTAppDelegate.h │ ├── CTAppDelegate.m │ ├── CTImageEdit-Info.plist │ ├── CTImageEdit-Prefix.pch │ ├── CTViewController.h │ ├── CTViewController.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── main.m │ └── testimage@2x.png ├── Podfile └── Tests │ ├── Tests-Info.plist │ ├── Tests-Prefix.pch │ ├── Tests.m │ └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── README.md └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | #CocoaPods 21 | Pods 22 | *Podfile.lock 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -workspace Example/CTImageEdit.xcworkspace -scheme CTImageEdit-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /CTImageEdit.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = 'CTImageEdit' 4 | s.version = '0.1.0' 5 | s.summary = 'A short description of CTImageEdit.' 6 | 7 | 8 | s.description = <<-DESC 9 | TODO: Add long description of the pod here. 10 | DESC 11 | 12 | s.homepage = 'https://github.com/huangcheng1/CTImageEdit' 13 | s.license = { :type => 'MIT', :file => 'LICENSE' } 14 | s.author = { 'acct=' => '632306630@qq.com' } 15 | s.source = { :git => 'https://github.com/huangcheng1/CTImageEdit.git', :tag => s.version.to_s } 16 | # s.social_media_url = 'https://twitter.com/' 17 | 18 | s.ios.deployment_target = '8.0' 19 | 20 | s.source_files = 'CTImageEdit/Classes/**/*' 21 | 22 | s.resources = "CTImageEdit/Assets/*.png" 23 | 24 | end 25 | -------------------------------------------------------------------------------- /CTImageEdit/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangcheng1/CTImageEdit/336be3036994dae7a82c3d56e25f65f1b7dfde0b/CTImageEdit/Assets/.gitkeep -------------------------------------------------------------------------------- /CTImageEdit/Assets/sccphoto_smear_last@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangcheng1/CTImageEdit/336be3036994dae7a82c3d56e25f65f1b7dfde0b/CTImageEdit/Assets/sccphoto_smear_last@2x.png -------------------------------------------------------------------------------- /CTImageEdit/Assets/sccphoto_smear_last@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangcheng1/CTImageEdit/336be3036994dae7a82c3d56e25f65f1b7dfde0b/CTImageEdit/Assets/sccphoto_smear_last@3x.png -------------------------------------------------------------------------------- /CTImageEdit/Assets/sccphoto_smear_next@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangcheng1/CTImageEdit/336be3036994dae7a82c3d56e25f65f1b7dfde0b/CTImageEdit/Assets/sccphoto_smear_next@2x.png -------------------------------------------------------------------------------- /CTImageEdit/Assets/sccphoto_smear_next@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangcheng1/CTImageEdit/336be3036994dae7a82c3d56e25f65f1b7dfde0b/CTImageEdit/Assets/sccphoto_smear_next@3x.png -------------------------------------------------------------------------------- /CTImageEdit/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangcheng1/CTImageEdit/336be3036994dae7a82c3d56e25f65f1b7dfde0b/CTImageEdit/Classes/.gitkeep -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageEditUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageEditUtil.h 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface CTImageEditUtil : NSObject 12 | 13 | + (UIImage*)filterForGaussianBlur:(UIImage*)image; 14 | 15 | + (CGRect)getViewBoundWith:(UIImage*)image; 16 | 17 | + (UIImage*)getScaleImageWith:(UIImage*)image; 18 | 19 | + (UIImage*)getImageWithOldImage:(UIImage*)image; 20 | 21 | + (UIImage*)getRotationWithImage:(UIImage*)image withOrientation:(UIDeviceOrientation)orientation; 22 | 23 | + (UIImage*)getUnrotationWithImage:(UIImage*)image withOrientation:(UIDeviceOrientation)orientation; 24 | 25 | + (UIImage *)rotatedByDegrees:(CGFloat)degrees withImage:(UIImage*)image; 26 | 27 | + (UIImage *)rotatedWithImage:(UIImage*)image; 28 | 29 | + (CGSize)getCutViewSizeWith:(CGSize)bSize; 30 | 31 | + (CGSize)getCutImageViewSizeWith:(CGSize)bSize cutViewSize:(CGSize)cSize; 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageEditUtil.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageEditUtil.m 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import "CTImageEditUtil.h" 10 | #import "UIImage+EditImageWithColor.h" 11 | 12 | @implementation CTImageEditUtil 13 | 14 | 15 | /* 16 | 全图模糊 高斯模糊 17 | */ 18 | + (UIImage*)filterForGaussianBlur:(UIImage*)image{ 19 | CGFloat blur = 10 * image.size.width / [UIScreen mainScreen].bounds.size.width; 20 | CIContext *context = [CIContext contextWithOptions:nil]; 21 | CIImage *inputImage = [CIImage imageWithCGImage:image.CGImage]; 22 | CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur" 23 | keysAndValues:kCIInputImageKey, inputImage, 24 | @"inputRadius", @(blur), 25 | nil]; 26 | CIImage *outputImage = filter.outputImage; 27 | return [UIImage imageWithCGImage:[context createCGImage:outputImage fromRect:CGRectMake(0, 0, image.size.width, image.size.height)]]; 28 | } 29 | 30 | + (CGRect)getViewBoundWith:(UIImage*)image{ 31 | 32 | CGSize toSize = image.size; 33 | CGSize size = CTImageEditPreviewFrame.size; 34 | 35 | if (size.width>= toSize.width && size.height >= toSize.height) {//宽度大于要显示的区域 36 | return CGRectMake(0, 0, toSize.width, toSize.height); 37 | }else if (size.width < toSize.width && size.height >= toSize.height) {//宽度小于要显示区域,,太长截取 38 | CGSize resultSize = CGSizeMake(size.width, toSize.height * size.width / toSize.width); 39 | return CGRectMake(0, 0, resultSize.width, resultSize.height); 40 | }else if (size.width >= toSize.width && size.height < toSize.height){ 41 | CGSize resultSize = CGSizeMake( toSize.width * size.height / toSize.height , size.height); 42 | return CGRectMake(0, 0, resultSize.width, resultSize.height); 43 | }else{ 44 | CGFloat scaleW = toSize.width / size.width; 45 | CGFloat scaleH = toSize.height / size.height; 46 | CGSize resultSize; 47 | if (scaleW > scaleH) { 48 | resultSize = CGSizeMake(size.width, toSize.height / scaleW); 49 | }else{ 50 | resultSize = CGSizeMake( toSize.width / scaleH , size.height); 51 | } 52 | return CGRectMake(0, 0, resultSize.width, resultSize.height); 53 | } 54 | } 55 | 56 | + (UIImage*)getImageWithOldImage:(UIImage*)image{ 57 | CGSize resultSize = image.size; 58 | UIGraphicsBeginImageContext(resultSize); 59 | [image drawInRect:CGRectMake(0, 0, resultSize.width,resultSize.height)]; 60 | UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext(); 61 | UIGraphicsEndImageContext(); 62 | image = scaledImage; 63 | 64 | return scaledImage; 65 | } 66 | + (UIImage*)getScaleImageWith:(UIImage*)image{ 67 | 68 | CGSize toSize = image.size; 69 | CGSize size = CTImageEditPreviewFrame.size; 70 | size.width = size.width * [UIScreen mainScreen].scale; 71 | size.height = size.height * [UIScreen mainScreen].scale; 72 | 73 | if (size.width>= toSize.width && size.height >= toSize.height) {//宽度大于要显示的区域 74 | return image; 75 | }else if (size.width < toSize.width && size.height >= toSize.height) {//宽度小于要显示区域,,太长截取 76 | CGSize resultSize = CGSizeMake(size.width, toSize.height * size.width / toSize.width); 77 | UIGraphicsBeginImageContext(resultSize); 78 | [image drawInRect:CGRectMake(0, 0, resultSize.width,resultSize.height)]; 79 | UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext(); 80 | UIGraphicsEndImageContext(); 81 | image = scaledImage; 82 | 83 | return scaledImage; 84 | }else if (size.width >= toSize.width && size.height < toSize.height){ 85 | 86 | CGSize resultSize = CGSizeMake( toSize.width * size.height / toSize.height , size.height); 87 | UIGraphicsBeginImageContext(resultSize); 88 | [image drawInRect:CGRectMake(0, 0, resultSize.width,resultSize.height)]; 89 | UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext(); 90 | UIGraphicsEndImageContext(); 91 | image = scaledImage; 92 | 93 | return scaledImage; 94 | }else{ 95 | CGFloat scaleW = toSize.width / size.width; 96 | CGFloat scaleH = toSize.height / size.height; 97 | CGSize resultSize; 98 | if (scaleW > scaleH) { 99 | resultSize = CGSizeMake(size.width, toSize.height / scaleW); 100 | }else{ 101 | resultSize = CGSizeMake( toSize.width / scaleH , size.height); 102 | } 103 | UIGraphicsBeginImageContext(resultSize); 104 | [image drawInRect:CGRectMake(0, 0, resultSize.width,resultSize.height)]; 105 | UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext(); 106 | UIGraphicsEndImageContext(); 107 | image = scaledImage; 108 | 109 | return scaledImage; 110 | } 111 | } 112 | 113 | + (UIImage *)getRotationWithImage:(UIImage *)image withOrientation:(UIDeviceOrientation)orientation{ 114 | UIImage *newImage; 115 | 116 | switch (orientation) { 117 | case UIDeviceOrientationLandscapeLeft: 118 | newImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationRight]; 119 | break; 120 | case UIDeviceOrientationLandscapeRight: 121 | newImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationRight]; 122 | break; 123 | case UIDeviceOrientationPortraitUpsideDown: 124 | newImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationRight]; 125 | break; 126 | default: 127 | newImage = image; 128 | break; 129 | } 130 | 131 | return newImage; 132 | } 133 | 134 | + (UIImage *)getUnrotationWithImage:(UIImage *)image withOrientation:(UIDeviceOrientation)orientation{ 135 | 136 | UIImage *newImage; 137 | 138 | switch (orientation) { 139 | case UIDeviceOrientationLandscapeLeft: 140 | newImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationLeft]; 141 | break; 142 | case UIDeviceOrientationLandscapeRight: 143 | newImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationRight]; 144 | break; 145 | case UIDeviceOrientationPortraitUpsideDown: 146 | newImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationDown]; 147 | break; 148 | default: 149 | newImage = image; 150 | break; 151 | } 152 | 153 | return newImage; 154 | } 155 | 156 | static inline CGFloat DegreesToRadians(CGFloat degrees) 157 | { 158 | return M_PI * (degrees / 180.0); 159 | } 160 | 161 | + (UIImage *)rotatedByDegrees:(CGFloat)degrees withImage:(UIImage*)image 162 | { 163 | // calculate the size of the rotated view's containing box for our drawing space 164 | UIView *rotatedViewBox = [[UIView alloc] initWithFrame:CGRectMake(0,0,image.size.width, image.size.height)]; 165 | CGAffineTransform t = CGAffineTransformMakeRotation(DegreesToRadians(degrees)); 166 | rotatedViewBox.transform = t; 167 | CGSize rotatedSize = rotatedViewBox.frame.size; 168 | 169 | // Create the bitmap context 170 | UIGraphicsBeginImageContextWithOptions(rotatedSize, NO, 2.0f); 171 | CGContextRef bitmap = UIGraphicsGetCurrentContext(); 172 | 173 | // Move the origin to the middle of the image so we will rotate and scale around the center. 174 | CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2); 175 | 176 | // // Rotate the image context 177 | CGContextRotateCTM(bitmap, DegreesToRadians(degrees)); 178 | 179 | // Now, draw the rotated/scaled image into the context 180 | CGContextScaleCTM(bitmap, 1.0, -1.0); 181 | CGContextDrawImage(bitmap, CGRectMake(-image.size.width / 2, -image.size.height / 2, image.size.width, image.size.height), [image CGImage]); 182 | 183 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 184 | UIGraphicsEndImageContext(); 185 | return newImage; 186 | 187 | 188 | } 189 | 190 | + (UIImage *)rotatedWithImage:(UIImage*)image{ 191 | 192 | // calculate the size of the rotated view's containing box for our drawing space 193 | UIView *rotatedViewBox = [[UIView alloc] initWithFrame:CGRectMake(0,0,image.size.width, image.size.height)]; 194 | CGAffineTransform t = CGAffineTransformMakeRotation(DegreesToRadians(90)); 195 | rotatedViewBox.transform = t; 196 | CGSize rotatedSize = rotatedViewBox.frame.size; 197 | 198 | // Create the bitmap context 199 | UIGraphicsBeginImageContextWithOptions(rotatedSize, NO, image.scale); 200 | CGContextRef bitmap = UIGraphicsGetCurrentContext(); 201 | 202 | // Move the origin to the middle of the image so we will rotate and scale around the center. 203 | CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2); 204 | 205 | // // Rotate the image context 206 | CGContextRotateCTM(bitmap, DegreesToRadians(90)); 207 | 208 | // Now, draw the rotated/scaled image into the context 209 | CGContextScaleCTM(bitmap, 1.0, -1.0); 210 | CGContextDrawImage(bitmap, CGRectMake(-image.size.width / 2, -image.size.height / 2, image.size.width, image.size.height), [image CGImage]); 211 | 212 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 213 | UIGraphicsEndImageContext(); 214 | return newImage; 215 | } 216 | 217 | + (CGSize)getCutViewSizeWith:(CGSize)bSize{ 218 | CGSize screenSize = [UIScreen mainScreen].bounds.size; 219 | 220 | CGFloat scaleW = screenSize.width / bSize.width; 221 | CGFloat scaleH = screenSize.height / bSize.height; 222 | if (scaleH < scaleW && scaleH < 1) { 223 | return CGSizeMake(bSize.width * scaleH, screenSize.height); 224 | }else if (scaleW <= scaleH && scaleW < 1){ 225 | return CGSizeMake(screenSize.width, bSize.height * scaleW); 226 | }else{ 227 | return bSize; 228 | } 229 | } 230 | 231 | + (CGSize)getCutImageViewSizeWith:(CGSize)bSize cutViewSize:(CGSize)cSize{ 232 | 233 | CGFloat scaleW = cSize.width / bSize.width; 234 | CGFloat scaleH = cSize.height / bSize.height; 235 | 236 | if (scaleH > scaleW) { 237 | return CGSizeMake(bSize.width * scaleH, cSize.height); 238 | }else{ 239 | return CGSizeMake(cSize.width, bSize.height * scaleW); 240 | } 241 | 242 | } 243 | 244 | @end 245 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageSmearBottom.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageSmearBottom.h 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @protocol CTImageSmearBottomDelegate 12 | 13 | @optional 14 | /** 15 | * 关闭 16 | */ 17 | - (void)closeMosaic; 18 | /** 19 | * 完成 20 | */ 21 | - (void)commitMosaic; 22 | /** 23 | * 下一步 24 | */ 25 | - (void)nextMosaicOperation; 26 | /** 27 | * 上一步 28 | */ 29 | - (void)lastMosaicOperation; 30 | /** 31 | * 是否有下一步 32 | * 33 | * @return bool 34 | */ 35 | - (BOOL)hasNextMosaicOperation; 36 | /** 37 | * 是否有上一步 38 | * 39 | * @return bool 40 | */ 41 | - (BOOL)hasLastMosaicOperation; 42 | 43 | @end 44 | 45 | @interface CTImageSmearBottom : UIView 46 | 47 | @property (nonatomic,weak) iddelegate; 48 | 49 | - (void)changeState; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageSmearBottom.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageSmearBottom.m 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import "CTImageSmearBottom.h" 10 | #import "UIImage+EditImageWithColor.h" 11 | 12 | @interface CTImageSmearBottom () 13 | 14 | @property (nonatomic,strong) UIButton *cancelBtn; 15 | @property (nonatomic,strong) UIButton *lastBtn; 16 | @property (nonatomic,strong) UIButton *nextBtn; 17 | @property (nonatomic,strong) UIButton *commitBtn; 18 | 19 | @end 20 | 21 | @implementation CTImageSmearBottom 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame{ 24 | self = [super initWithFrame:frame]; 25 | if (self) { 26 | [self addSubview:self.cancelBtn]; 27 | [self addSubview:self.lastBtn]; 28 | [self addSubview:self.nextBtn]; 29 | [self addSubview:self.commitBtn]; 30 | self.backgroundColor = CTImageEditRGBColor(0x333333, 0.3); 31 | } 32 | return self; 33 | } 34 | 35 | - (void)layoutSubviews{ 36 | [super layoutSubviews]; 37 | CGFloat height = self.bounds.size.height; 38 | CGFloat centerX = self.bounds.size.width / 2; 39 | self.nextBtn.frame = CGRectMake(centerX + 16, (height - 24)/2, 24 , 24); 40 | self.lastBtn.frame = CGRectMake(centerX - 16 - 24 , (height - 24)/2, 24 , 24); 41 | 42 | self.cancelBtn.frame = CGRectMake(16, ( height - 30 )/ 2, 50, 30); 43 | self.commitBtn.frame = CGRectMake(self.bounds.size.width - 75 - 16, (height - 30 ) / 2, 70, 30); 44 | [self changeState]; 45 | } 46 | 47 | /** 48 | * 改变前进后退按钮的颜色 49 | */ 50 | - (void)changeState{ 51 | if ([self.delegate respondsToSelector:@selector(hasLastMosaicOperation)]) { 52 | if ([self.delegate hasLastMosaicOperation]) { 53 | [self.lastBtn setImage:[[UIImage imageWithName:@"sccphoto_smear_last"] tintImageWithColor:CTImageEditRGBColor(0xffffff, 1)] forState:UIControlStateNormal]; 54 | }else{ 55 | [self.lastBtn setImage:[[UIImage imageWithName:@"sccphoto_smear_last"] tintImageWithColor:CTImageEditRGBColor(0x999999, 1)] forState:UIControlStateNormal]; 56 | } 57 | } 58 | 59 | if ([self.delegate respondsToSelector:@selector(hasNextMosaicOperation)]) { 60 | if ([self.delegate hasNextMosaicOperation]) { 61 | [self.nextBtn setImage:[[UIImage imageWithName:@"sccphoto_smear_next"] tintImageWithColor:CTImageEditRGBColor(0xffffff, 1)] forState:UIControlStateNormal]; 62 | }else{ 63 | [self.nextBtn setImage:[[UIImage imageWithName:@"sccphoto_smear_next"]tintImageWithColor:CTImageEditRGBColor(0x999999, 1)] forState:UIControlStateNormal]; 64 | } 65 | } 66 | } 67 | 68 | - (void)reLastStep{ 69 | if ([self.delegate respondsToSelector:@selector(hasLastMosaicOperation)]) { 70 | if ([self.delegate hasLastMosaicOperation] && [self.delegate respondsToSelector:@selector(lastMosaicOperation)]) { 71 | [self.delegate lastMosaicOperation]; 72 | } 73 | } 74 | [self changeState]; 75 | } 76 | 77 | - (void)nextStep{ 78 | if ([self.delegate respondsToSelector:@selector(hasNextMosaicOperation)]) { 79 | if ([self.delegate hasNextMosaicOperation] && [self.delegate respondsToSelector:@selector(nextMosaicOperation)]) { 80 | [self.delegate nextMosaicOperation]; 81 | } 82 | } 83 | [self changeState]; 84 | } 85 | 86 | - (void)commitClick{ 87 | if ([self.delegate respondsToSelector:@selector(commitMosaic)]) { 88 | [self.delegate commitMosaic]; 89 | } 90 | } 91 | 92 | - (void)cancelClick{ 93 | if ([self.delegate respondsToSelector:@selector(closeMosaic)]) { 94 | [self.delegate closeMosaic]; 95 | } 96 | } 97 | 98 | - (UIButton *)lastBtn{ 99 | if (!_lastBtn) { 100 | _lastBtn = [[UIButton alloc]init]; 101 | [_lastBtn setImage:[[UIImage imageWithName:@"sccphoto_smear_last"] tintImageWithColor:CTImageEditRGBColor(0x999999, 1)] forState:UIControlStateNormal]; 102 | [_lastBtn addTarget:self action:@selector(reLastStep) forControlEvents:UIControlEventTouchUpInside]; 103 | } 104 | return _lastBtn; 105 | } 106 | 107 | - (UIButton *)nextBtn{ 108 | if (!_nextBtn) { 109 | _nextBtn = [[UIButton alloc]init]; 110 | [_nextBtn setImage:[[UIImage imageWithName:@"sccphoto_smear_next"] tintImageWithColor:CTImageEditRGBColor(0xffffff, 1)] forState:UIControlStateNormal]; 111 | [_nextBtn addTarget:self action:@selector(nextStep) forControlEvents:UIControlEventTouchUpInside]; 112 | } 113 | return _nextBtn; 114 | } 115 | 116 | - (UIButton *)cancelBtn{ 117 | if (!_cancelBtn) { 118 | _cancelBtn = [[UIButton alloc]init]; 119 | [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal]; 120 | _cancelBtn.titleLabel.font = [UIFont systemFontOfSize:16.0]; 121 | [_cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 122 | [_cancelBtn addTarget:self action:@selector(cancelClick) forControlEvents:UIControlEventTouchUpInside]; 123 | } 124 | return _cancelBtn; 125 | } 126 | 127 | - (UIButton *)commitBtn{ 128 | if (!_commitBtn) { 129 | _commitBtn = [[UIButton alloc]init]; 130 | [_commitBtn setTitle:@"完成" forState:UIControlStateNormal]; 131 | [_commitBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 132 | _commitBtn.layer.cornerRadius = 3.0; 133 | _commitBtn.layer.masksToBounds = YES; 134 | _commitBtn.titleLabel.font = [UIFont systemFontOfSize:14.0]; 135 | [_commitBtn setBackgroundImage:[UIImage createImageWithColor:CTImageEditRGBColor(0xffffff, 1)] forState:UIControlStateNormal]; 136 | [_commitBtn addTarget:self action:@selector(commitClick) forControlEvents:UIControlEventTouchUpInside]; 137 | } 138 | return _commitBtn; 139 | } 140 | 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageSmearTop.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageSmearTop.h 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface CTImageSmearTop : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageSmearTop.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageSmearTop.m 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import "CTImageSmearTop.h" 10 | #import "UIImage+EditImageWithColor.h" 11 | 12 | @interface CTImageSmearTop () 13 | 14 | @property (nonatomic,strong) UILabel *titleLabel; 15 | 16 | @end 17 | 18 | @implementation CTImageSmearTop 19 | 20 | - (instancetype)initWithFrame:(CGRect)frame{ 21 | self = [super initWithFrame:frame]; 22 | if (self) { 23 | [self addSubview:self.titleLabel]; 24 | self.titleLabel.text = @"涂抹中"; 25 | self.backgroundColor = CTImageEditRGBColor(0x333333, 0.3); 26 | } 27 | return self; 28 | } 29 | 30 | - (void)layoutSubviews{ 31 | [super layoutSubviews]; 32 | self.titleLabel.frame = CGRectMake((self.frame.size.width - 100 )/2, (self.frame.size.height - 30 )/2, 100, 30); 33 | } 34 | 35 | - (UILabel *)titleLabel{ 36 | if (!_titleLabel) { 37 | _titleLabel = [[UILabel alloc]init]; 38 | _titleLabel.font = [UIFont systemFontOfSize:16.0]; 39 | _titleLabel.textColor = [UIColor whiteColor]; 40 | _titleLabel.textAlignment = NSTextAlignmentCenter; 41 | } 42 | return _titleLabel; 43 | } 44 | @end 45 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageSmearView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageSmearView.h 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import 10 | @protocol CTImageSmearViewDelegate 11 | 12 | @optional 13 | 14 | - (void)hasUpdateSmear; 15 | 16 | @end 17 | 18 | 19 | @interface CTImageSmearView : UIView 20 | 21 | @property (nonatomic,weak) iddelegate; 22 | 23 | - (UIImage*)finishSmear; 24 | 25 | - (BOOL)hasNextStep; 26 | - (void)nexStep; 27 | 28 | - (void)lastStep; 29 | - (BOOL)hasLastStep; 30 | 31 | - (void)packageWithImage:(UIImage*)image; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageSmearView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageSmearView.m 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import "CTImageSmearView.h" 10 | #import "CTImageEditUtil.h" 11 | 12 | @interface CTImageSmearView () 13 | 14 | @property (nonatomic,strong) NSMutableArray *lineArray; 15 | @property (nonatomic,strong) NSMutableArray *removeLineArray; 16 | 17 | @property (nonatomic,strong) NSMutableArray *nowPointArray; 18 | 19 | @property (nonatomic,strong) UIImage *image; 20 | @property (nonatomic,strong) UIImage *nowImage; 21 | @property (nonatomic,strong) UIImage *filterGaussan; 22 | 23 | @end 24 | 25 | @implementation CTImageSmearView 26 | 27 | - (instancetype)initWithFrame:(CGRect)frame{ 28 | self = [super initWithFrame:frame]; 29 | if (self) { 30 | } 31 | return self; 32 | } 33 | 34 | - (void)packageWithImage:(UIImage*)image{ 35 | self.image = image; 36 | 37 | UIImage *realImage = [CTImageEditUtil getImageWithOldImage:image]; 38 | self.filterGaussan = [CTImageEditUtil filterForGaussianBlur:realImage]; 39 | [self.nowPointArray removeAllObjects]; 40 | [self.lineArray removeAllObjects]; 41 | [self.removeLineArray removeAllObjects]; 42 | [self drawSmearView]; 43 | [self setNeedsDisplay]; 44 | 45 | } 46 | 47 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 48 | 49 | [super touchesBegan:touches withEvent:event]; 50 | CGPoint p = [[touches anyObject] locationInView:self]; 51 | 52 | self.nowPointArray = [[NSMutableArray alloc]init]; 53 | [self.removeLineArray removeAllObjects]; 54 | [self.lineArray addObject:self.nowPointArray]; 55 | [self addPoint:p]; 56 | 57 | } 58 | 59 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{ 60 | 61 | [super touchesCancelled:touches withEvent:event]; 62 | CGPoint p = [[touches anyObject] locationInView:self]; 63 | [self addPoint:p]; 64 | 65 | } 66 | 67 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ 68 | [super touchesEnded:touches withEvent:event]; 69 | CGPoint p = [[touches anyObject] locationInView:self]; 70 | [self addPoint:p]; 71 | 72 | } 73 | 74 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ 75 | [super touchesMoved:touches withEvent:event]; 76 | CGPoint p = [[touches anyObject] locationInView:self]; 77 | [self addPoint:p]; 78 | 79 | } 80 | 81 | - (void)addPoint:(CGPoint)p{ 82 | NSValue *point = [NSValue valueWithCGPoint:p]; 83 | [self.nowPointArray addObject:point]; 84 | 85 | [self drawSmearView]; 86 | if ([self.delegate respondsToSelector:@selector(hasUpdateSmear)]) { 87 | [self.delegate hasUpdateSmear]; 88 | } 89 | } 90 | 91 | - (void)drawSmearView{ 92 | UIGraphicsBeginImageContext(self.image.size); 93 | 94 | CGContextRef context = UIGraphicsGetCurrentContext(); 95 | 96 | CGContextSetLineCap(context, kCGLineCapRound); 97 | [self.image drawInRect:CGRectMake(0, 0,self.image.size.width,self.image.size.height)]; 98 | 99 | CGContextSetStrokeColorWithColor(context, [UIColor colorWithPatternImage:self.filterGaussan].CGColor); 100 | 101 | CGContextSetLineWidth(context, 20 * self.image.size.width / self.bounds.size.width); 102 | for (int i = 0 ; i < self.lineArray.count ; i ++ ) { 103 | NSMutableArray *array = [self.lineArray objectAtIndex:i]; 104 | 105 | for (int i = 0 ; i < array.count ; i ++ ) { 106 | NSValue *value = [array objectAtIndex:i]; 107 | CGPoint p = [value CGPointValue]; 108 | p.x = p.x * self.image.size.width / self.bounds.size.width; 109 | p.y = p.y * self.image.size.height / self.bounds.size.height; 110 | if (i == 0) { 111 | CGContextMoveToPoint(context, p.x, p.y); 112 | CGContextAddLineToPoint(context, p.x, p.y); 113 | }else{ 114 | CGContextAddLineToPoint(context, p.x, p.y); 115 | } 116 | } 117 | } 118 | CGContextDrawPath(context, kCGPathStroke); 119 | 120 | // 将绘制的结果存储在内存中 121 | self.nowImage = UIGraphicsGetImageFromCurrentImageContext(); 122 | 123 | // 结束绘制 124 | UIGraphicsEndImageContext(); 125 | [self setNeedsDisplay]; 126 | } 127 | 128 | - (void)drawRect:(CGRect)rect{ 129 | [super drawRect:rect]; 130 | 131 | CGContextRef context = UIGraphicsGetCurrentContext(); 132 | 133 | CGContextSetLineCap(context, kCGLineCapRound); 134 | [self.nowImage drawInRect:rect]; 135 | 136 | } 137 | 138 | - (NSMutableArray *)nowPointArray{ 139 | if (!_nowPointArray) { 140 | _nowPointArray = [[NSMutableArray alloc]init]; 141 | } 142 | return _nowPointArray; 143 | } 144 | 145 | - (NSMutableArray *)lineArray{ 146 | if (!_lineArray) { 147 | _lineArray = [[NSMutableArray alloc]init]; 148 | } 149 | return _lineArray; 150 | } 151 | 152 | - (NSMutableArray *)removeLineArray{ 153 | if (!_removeLineArray) { 154 | _removeLineArray = [[NSMutableArray alloc]init]; 155 | } 156 | return _removeLineArray; 157 | } 158 | 159 | - (UIImage*)finishSmear{ 160 | 161 | return self.nowImage; 162 | } 163 | 164 | - (BOOL)hasNextStep{ 165 | if (self.removeLineArray && self.removeLineArray.count >= 1) { 166 | return YES; 167 | } 168 | return NO; 169 | } 170 | - (void)nexStep{ 171 | if (self.removeLineArray && self.removeLineArray.count >= 1) { 172 | NSMutableArray *next = [self.removeLineArray lastObject]; 173 | [self.removeLineArray removeLastObject]; 174 | [self.lineArray addObject:next]; 175 | [self drawSmearView]; 176 | } 177 | } 178 | 179 | - (void)lastStep{ 180 | if (self.lineArray && self.lineArray.count >= 1) { 181 | NSMutableArray *last = [self.lineArray lastObject]; 182 | [self.lineArray removeLastObject]; 183 | [self.removeLineArray addObject:last]; 184 | [self drawSmearView]; 185 | } 186 | } 187 | - (BOOL)hasLastStep{ 188 | if (self.lineArray && self.lineArray.count >= 1) { 189 | return YES; 190 | } 191 | return NO; 192 | } 193 | 194 | 195 | @end 196 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageSmearViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageSmearViewController.h 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @protocol CTImageSmearViewControllerDelegate 12 | 13 | @optional 14 | 15 | - (void)didSmearPhotoWithResultImage:(UIImage*)image; 16 | 17 | @end 18 | 19 | @interface CTImageSmearViewController : UIViewController 20 | 21 | @property (nonatomic,weak) iddelegate; 22 | 23 | - (void)packageWithImage:(UIImage*)image; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/CTImageSmearViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageSmearViewController.m 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import "CTImageSmearViewController.h" 10 | #import "CTImageSmearView.h" 11 | #import "CTImageEditUtil.h" 12 | #import "UIImage+EditImageWithColor.h" 13 | #import "CTImageSmearTop.h" 14 | #import "CTImageSmearBottom.h" 15 | 16 | @interface CTImageSmearViewController () 17 | 18 | @property (nonatomic,strong) CTImageSmearView *smearView; 19 | 20 | @property (nonatomic,strong) CTImageSmearTop *smearTop; 21 | 22 | @property (nonatomic,strong) CTImageSmearBottom *smearBottom; 23 | 24 | @end 25 | 26 | @implementation CTImageSmearViewController 27 | 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | // Do any additional setup after loading the view. 31 | self.smearView.center = CGPointMake(CGRectGetMidX(CTImageEditPreviewFrame), CGRectGetMidY(CTImageEditPreviewFrame)); 32 | [self.view addSubview:self.smearView]; 33 | [self.view addSubview:self.smearTop]; 34 | [self.view addSubview:self.smearBottom]; 35 | self.view.backgroundColor = [UIColor blackColor]; 36 | } 37 | 38 | - (void)viewDidAppear:(BOOL)animated{ 39 | [super viewDidAppear:animated]; 40 | [UIView animateWithDuration:0.2 animations:^{ 41 | self.smearTop.frame = CGRectMake(0, 0, CTImageEditPreviewFrame.size.width, CTImageEditPreviewFrame.origin.y); 42 | self.smearBottom.frame = CGRectMake(0, CGRectGetMaxY(CTImageEditPreviewFrame), CTImageEditPreviewFrame.size.width, CGRectGetHeight(self.view.bounds) - CGRectGetMaxY(CTImageEditPreviewFrame)); 43 | }completion:^(BOOL finished) { 44 | self.smearTop.frame = CGRectMake(0, 0, CTImageEditPreviewFrame.size.width, CTImageEditPreviewFrame.origin.y); 45 | self.smearBottom.frame = CGRectMake(0, CGRectGetMaxY(CTImageEditPreviewFrame), CTImageEditPreviewFrame.size.width, CGRectGetHeight(self.view.bounds) - CGRectGetMaxY(CTImageEditPreviewFrame)); 46 | }]; 47 | } 48 | 49 | - (void)packageWithImage:(UIImage *)image{ 50 | //根据image设置smearview的frame,以及改变image的大小 51 | 52 | // UIImage *realImage = [SCCPhotoSmearUtil getScaleImageWith:[UIImage imageWithCGImage:image.CGImage scale:[UIScreen mainScreen].scale orientation:image.imageOrientation]]; 53 | 54 | image = [CTImageEditUtil getScaleImageWith:image]; 55 | CGRect bounds = [CTImageEditUtil getViewBoundWith:image]; 56 | self.smearView.bounds = bounds; 57 | [self.smearView packageWithImage:image]; 58 | } 59 | 60 | - (void)didReceiveMemoryWarning { 61 | [super didReceiveMemoryWarning]; 62 | // Dispose of any resources that can be recreated. 63 | } 64 | 65 | - (CTImageSmearView *)smearView{ 66 | if (!_smearView) { 67 | _smearView = [[CTImageSmearView alloc]init]; 68 | _smearView.delegate = self; 69 | } 70 | return _smearView; 71 | } 72 | 73 | - (CTImageSmearTop *)smearTop{ 74 | if (!_smearTop) { 75 | _smearTop = [[CTImageSmearTop alloc]initWithFrame:CGRectMake(0, -CTImageEditPreviewFrame.origin.y, CTImageEditPreviewFrame.size.width, CTImageEditPreviewFrame.origin.y)]; 76 | } 77 | return _smearTop; 78 | } 79 | 80 | - (CTImageSmearBottom *)smearBottom{ 81 | if (!_smearBottom) { 82 | _smearBottom = [[CTImageSmearBottom alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.bounds), CTImageEditPreviewFrame.size.width, CGRectGetHeight(self.view.bounds) - CGRectGetMaxY(CTImageEditPreviewFrame))]; 83 | _smearBottom.delegate = self; 84 | } 85 | return _smearBottom; 86 | } 87 | 88 | #pragma mark - SCCPhotoSmearBottom delegate 89 | 90 | - (void)closeMosaic{ 91 | //关闭viewcontroller 92 | [UIView animateWithDuration:0.2 animations:^{ 93 | self.smearTop.frame = CGRectMake(0, -CTImageEditPreviewFrame.origin.y, CTImageEditPreviewFrame.size.width, CTImageEditPreviewFrame.origin.y); 94 | self.smearBottom.frame = CGRectMake(0, CGRectGetMaxY(self.view.bounds), CTImageEditPreviewFrame.size.width, CGRectGetHeight(self.view.bounds) - CGRectGetMaxY(CTImageEditPreviewFrame)); 95 | } completion:^(BOOL finished) { 96 | self.smearTop.frame = CGRectMake(0, -CTImageEditPreviewFrame.origin.y, CTImageEditPreviewFrame.size.width, CTImageEditPreviewFrame.origin.y); 97 | self.smearBottom.frame = CGRectMake(0, CGRectGetMaxY(self.view.bounds), CTImageEditPreviewFrame.size.width, CGRectGetHeight(self.view.bounds) - CGRectGetMaxY(CTImageEditPreviewFrame)); 98 | [self dismissViewControllerAnimated:NO completion:nil]; 99 | }]; 100 | } 101 | 102 | - (void)commitMosaic{ 103 | UIImage *image = [self.smearView finishSmear]; 104 | if ([self.delegate respondsToSelector:@selector(didSmearPhotoWithResultImage:)]) { 105 | [self.delegate didSmearPhotoWithResultImage:image]; 106 | } 107 | [self closeMosaic]; 108 | } 109 | 110 | - (void)nextMosaicOperation{ 111 | [self.smearView nexStep]; 112 | } 113 | 114 | - (void)lastMosaicOperation{ 115 | [self.smearView lastStep]; 116 | } 117 | 118 | - (BOOL)hasNextMosaicOperation{ 119 | return [self.smearView hasNextStep]; 120 | } 121 | 122 | - (BOOL)hasLastMosaicOperation{ 123 | return [self.smearView hasLastStep]; 124 | } 125 | 126 | - (BOOL) prefersStatusBarHidden 127 | { 128 | return YES; 129 | } 130 | #pragma mark - SCCPhotoSmearView Delegate 131 | 132 | - (void)hasUpdateSmear{ 133 | [self.smearBottom changeState]; 134 | } 135 | 136 | - (UIInterfaceOrientationMask)supportedInterfaceOrientations 137 | { 138 | return UIInterfaceOrientationMaskPortrait; 139 | } 140 | 141 | 142 | - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 143 | { 144 | return UIInterfaceOrientationPortrait; 145 | } 146 | @end 147 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/UIImage+EditImageWithColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+EditImageWithColor.h 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import 10 | 11 | #define CTImageEditRGBColor(rgbValue, alphaValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue] 12 | 13 | 14 | #define CTImageEditPreviewFrame (CGRect){ 0, 60, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height - 167 } 15 | 16 | @interface UIImage (EditImageWithColor) 17 | 18 | - (UIImage*)tintImageWithColor:(UIColor*)tintColor; 19 | 20 | + (UIImage*)createImageWithColor:(UIColor*)color; 21 | 22 | + (UIImage*)imageWithName:(NSString*)str; 23 | @end 24 | -------------------------------------------------------------------------------- /CTImageEdit/Classes/UIImage+EditImageWithColor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+EditImageWithColor.m 3 | // Pods 4 | // 5 | // Created by huang cheng on 2017/2/24. 6 | // 7 | // 8 | 9 | #import "UIImage+EditImageWithColor.h" 10 | 11 | @implementation UIImage (EditImageWithColor) 12 | 13 | 14 | - (UIImage *)tintImageWithColor:(UIColor *)tintColor{ 15 | 16 | UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); 17 | CGContextRef context = UIGraphicsGetCurrentContext(); 18 | 19 | CGContextTranslateCTM(context, 0, self.size.height); 20 | CGContextScaleCTM(context, 1.0, -1.0); 21 | 22 | CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height); 23 | 24 | CGContextSetBlendMode(context, kCGBlendModeNormal); 25 | CGContextDrawImage(context, rect, self.CGImage); 26 | 27 | CGContextSetBlendMode(context, kCGBlendModeSourceIn); 28 | [tintColor setFill]; 29 | CGContextFillRect(context, rect); 30 | 31 | UIImage *coloredImage = UIGraphicsGetImageFromCurrentImageContext(); 32 | UIGraphicsEndImageContext(); 33 | return coloredImage; 34 | } 35 | 36 | + (UIImage*)createImageWithColor:(UIColor*)color{ 37 | 38 | CGRect rect= CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 39 | UIGraphicsBeginImageContext(rect.size); 40 | CGContextRef context = UIGraphicsGetCurrentContext(); 41 | CGContextSetFillColorWithColor(context, [color CGColor]); 42 | CGContextFillRect(context, rect); 43 | UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); 44 | UIGraphicsEndImageContext(); 45 | return theImage; 46 | } 47 | 48 | + (UIImage *)imageWithName:(NSString *)str{ 49 | 50 | NSBundle *bundle = [NSBundle bundleWithIdentifier:@"org.cocoapods.CTImageEdit"]; 51 | UIImage *image = [UIImage imageNamed:str inBundle:bundle compatibleWithTraitCollection:nil]; 52 | return image; 53 | } 54 | @end 55 | -------------------------------------------------------------------------------- /Example/CTImageEdit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4BA0D67E1E60355F000FB6B4 /* testimage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4BA0D67D1E60355F000FB6B4 /* testimage@2x.png */; }; 11 | 58159297ADA1F7918DB120CA /* Pods_CTImageEdit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE4759A42B3180BD85EAD92E /* Pods_CTImageEdit_Tests.framework */; }; 12 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 13 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; 14 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 15 | 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; 16 | 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; 17 | 6003F59E195388D20070C39A /* CTAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* CTAppDelegate.m */; }; 18 | 6003F5A7195388D20070C39A /* CTViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* CTViewController.m */; }; 19 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; 20 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; 21 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 22 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 23 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; 24 | 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; 25 | 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; }; 26 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; 27 | 9C64B373256DB18945F50885 /* Pods_CTImageEdit_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A0906AD1F9CB229E428599C /* Pods_CTImageEdit_Example.framework */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 6003F582195388D10070C39A /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 6003F589195388D20070C39A; 36 | remoteInfo = CTImageEdit; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 2A0906AD1F9CB229E428599C /* Pods_CTImageEdit_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CTImageEdit_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 3DC9B3600BE2454885383614 /* Pods-CTImageEdit_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CTImageEdit_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CTImageEdit_Example/Pods-CTImageEdit_Example.debug.xcconfig"; sourceTree = ""; }; 43 | 411443384B4BE00FE0833E79 /* Pods-CTImageEdit_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CTImageEdit_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CTImageEdit_Tests/Pods-CTImageEdit_Tests.debug.xcconfig"; sourceTree = ""; }; 44 | 4BA0D67D1E60355F000FB6B4 /* testimage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "testimage@2x.png"; sourceTree = ""; }; 45 | 6003F58A195388D20070C39A /* CTImageEdit_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CTImageEdit_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 47 | 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 48 | 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 49 | 6003F595195388D20070C39A /* CTImageEdit-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CTImageEdit-Info.plist"; sourceTree = ""; }; 50 | 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 51 | 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 6003F59B195388D20070C39A /* CTImageEdit-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CTImageEdit-Prefix.pch"; sourceTree = ""; }; 53 | 6003F59C195388D20070C39A /* CTAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTAppDelegate.h; sourceTree = ""; }; 54 | 6003F59D195388D20070C39A /* CTAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTAppDelegate.m; sourceTree = ""; }; 55 | 6003F5A5195388D20070C39A /* CTViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTViewController.h; sourceTree = ""; }; 56 | 6003F5A6195388D20070C39A /* CTViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTViewController.m; sourceTree = ""; }; 57 | 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 58 | 6003F5AE195388D20070C39A /* CTImageEdit_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CTImageEdit_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 60 | 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; 61 | 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 62 | 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; 63 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; 64 | 71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 65 | 77E3C81F86D62F272E1CDA37 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 66 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 67 | AE4759A42B3180BD85EAD92E /* Pods_CTImageEdit_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CTImageEdit_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | C7368527722BF0F774E8459F /* Pods-CTImageEdit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CTImageEdit_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CTImageEdit_Tests/Pods-CTImageEdit_Tests.release.xcconfig"; sourceTree = ""; }; 69 | E0FF6095FF5538698F73C48F /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 70 | E82A0E6852F185CA240E5C04 /* Pods-CTImageEdit_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CTImageEdit_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-CTImageEdit_Example/Pods-CTImageEdit_Example.release.xcconfig"; sourceTree = ""; }; 71 | F360D94313546807F41BD412 /* CTImageEdit.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CTImageEdit.podspec; path = ../CTImageEdit.podspec; sourceTree = ""; }; 72 | /* End PBXFileReference section */ 73 | 74 | /* Begin PBXFrameworksBuildPhase section */ 75 | 6003F587195388D20070C39A /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, 80 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, 81 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, 82 | 9C64B373256DB18945F50885 /* Pods_CTImageEdit_Example.framework in Frameworks */, 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 6003F5AB195388D20070C39A /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, 91 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, 92 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, 93 | 58159297ADA1F7918DB120CA /* Pods_CTImageEdit_Tests.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXFrameworksBuildPhase section */ 98 | 99 | /* Begin PBXGroup section */ 100 | 6003F581195388D10070C39A = { 101 | isa = PBXGroup; 102 | children = ( 103 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, 104 | 6003F593195388D20070C39A /* Example for CTImageEdit */, 105 | 6003F5B5195388D20070C39A /* Tests */, 106 | 6003F58C195388D20070C39A /* Frameworks */, 107 | 6003F58B195388D20070C39A /* Products */, 108 | EA783751E8D87FECD0AB327B /* Pods */, 109 | ); 110 | sourceTree = ""; 111 | }; 112 | 6003F58B195388D20070C39A /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 6003F58A195388D20070C39A /* CTImageEdit_Example.app */, 116 | 6003F5AE195388D20070C39A /* CTImageEdit_Tests.xctest */, 117 | ); 118 | name = Products; 119 | sourceTree = ""; 120 | }; 121 | 6003F58C195388D20070C39A /* Frameworks */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 6003F58D195388D20070C39A /* Foundation.framework */, 125 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, 126 | 6003F591195388D20070C39A /* UIKit.framework */, 127 | 6003F5AF195388D20070C39A /* XCTest.framework */, 128 | 2A0906AD1F9CB229E428599C /* Pods_CTImageEdit_Example.framework */, 129 | AE4759A42B3180BD85EAD92E /* Pods_CTImageEdit_Tests.framework */, 130 | ); 131 | name = Frameworks; 132 | sourceTree = ""; 133 | }; 134 | 6003F593195388D20070C39A /* Example for CTImageEdit */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 4BA0D67D1E60355F000FB6B4 /* testimage@2x.png */, 138 | 6003F59C195388D20070C39A /* CTAppDelegate.h */, 139 | 6003F59D195388D20070C39A /* CTAppDelegate.m */, 140 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 141 | 6003F5A5195388D20070C39A /* CTViewController.h */, 142 | 6003F5A6195388D20070C39A /* CTViewController.m */, 143 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, 144 | 6003F5A8195388D20070C39A /* Images.xcassets */, 145 | 6003F594195388D20070C39A /* Supporting Files */, 146 | ); 147 | name = "Example for CTImageEdit"; 148 | path = CTImageEdit; 149 | sourceTree = ""; 150 | }; 151 | 6003F594195388D20070C39A /* Supporting Files */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 6003F595195388D20070C39A /* CTImageEdit-Info.plist */, 155 | 6003F596195388D20070C39A /* InfoPlist.strings */, 156 | 6003F599195388D20070C39A /* main.m */, 157 | 6003F59B195388D20070C39A /* CTImageEdit-Prefix.pch */, 158 | ); 159 | name = "Supporting Files"; 160 | sourceTree = ""; 161 | }; 162 | 6003F5B5195388D20070C39A /* Tests */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 6003F5BB195388D20070C39A /* Tests.m */, 166 | 6003F5B6195388D20070C39A /* Supporting Files */, 167 | ); 168 | path = Tests; 169 | sourceTree = ""; 170 | }; 171 | 6003F5B6195388D20070C39A /* Supporting Files */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 6003F5B7195388D20070C39A /* Tests-Info.plist */, 175 | 6003F5B8195388D20070C39A /* InfoPlist.strings */, 176 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, 177 | ); 178 | name = "Supporting Files"; 179 | sourceTree = ""; 180 | }; 181 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | F360D94313546807F41BD412 /* CTImageEdit.podspec */, 185 | E0FF6095FF5538698F73C48F /* README.md */, 186 | 77E3C81F86D62F272E1CDA37 /* LICENSE */, 187 | ); 188 | name = "Podspec Metadata"; 189 | sourceTree = ""; 190 | }; 191 | EA783751E8D87FECD0AB327B /* Pods */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | 3DC9B3600BE2454885383614 /* Pods-CTImageEdit_Example.debug.xcconfig */, 195 | E82A0E6852F185CA240E5C04 /* Pods-CTImageEdit_Example.release.xcconfig */, 196 | 411443384B4BE00FE0833E79 /* Pods-CTImageEdit_Tests.debug.xcconfig */, 197 | C7368527722BF0F774E8459F /* Pods-CTImageEdit_Tests.release.xcconfig */, 198 | ); 199 | name = Pods; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXGroup section */ 203 | 204 | /* Begin PBXNativeTarget section */ 205 | 6003F589195388D20070C39A /* CTImageEdit_Example */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CTImageEdit_Example" */; 208 | buildPhases = ( 209 | 5795B3AE6EC263FE0F128DDB /* [CP] Check Pods Manifest.lock */, 210 | 6003F586195388D20070C39A /* Sources */, 211 | 6003F587195388D20070C39A /* Frameworks */, 212 | 6003F588195388D20070C39A /* Resources */, 213 | 668CCD5E982D38FD9D713ED7 /* [CP] Embed Pods Frameworks */, 214 | 68A98DD74B167010C3A2DF9A /* [CP] Copy Pods Resources */, 215 | ); 216 | buildRules = ( 217 | ); 218 | dependencies = ( 219 | ); 220 | name = CTImageEdit_Example; 221 | productName = CTImageEdit; 222 | productReference = 6003F58A195388D20070C39A /* CTImageEdit_Example.app */; 223 | productType = "com.apple.product-type.application"; 224 | }; 225 | 6003F5AD195388D20070C39A /* CTImageEdit_Tests */ = { 226 | isa = PBXNativeTarget; 227 | buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CTImageEdit_Tests" */; 228 | buildPhases = ( 229 | E935BE3A07F9AACBA2DFCBDB /* [CP] Check Pods Manifest.lock */, 230 | 6003F5AA195388D20070C39A /* Sources */, 231 | 6003F5AB195388D20070C39A /* Frameworks */, 232 | 6003F5AC195388D20070C39A /* Resources */, 233 | 5C869726A0894147ECB7CB1D /* [CP] Embed Pods Frameworks */, 234 | E28C9E4CA90CE0C6A3FD6E4C /* [CP] Copy Pods Resources */, 235 | ); 236 | buildRules = ( 237 | ); 238 | dependencies = ( 239 | 6003F5B4195388D20070C39A /* PBXTargetDependency */, 240 | ); 241 | name = CTImageEdit_Tests; 242 | productName = CTImageEditTests; 243 | productReference = 6003F5AE195388D20070C39A /* CTImageEdit_Tests.xctest */; 244 | productType = "com.apple.product-type.bundle.unit-test"; 245 | }; 246 | /* End PBXNativeTarget section */ 247 | 248 | /* Begin PBXProject section */ 249 | 6003F582195388D10070C39A /* Project object */ = { 250 | isa = PBXProject; 251 | attributes = { 252 | CLASSPREFIX = CT; 253 | LastUpgradeCheck = 0720; 254 | ORGANIZATIONNAME = "acct="; 255 | TargetAttributes = { 256 | 6003F5AD195388D20070C39A = { 257 | TestTargetID = 6003F589195388D20070C39A; 258 | }; 259 | }; 260 | }; 261 | buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "CTImageEdit" */; 262 | compatibilityVersion = "Xcode 3.2"; 263 | developmentRegion = English; 264 | hasScannedForEncodings = 0; 265 | knownRegions = ( 266 | en, 267 | Base, 268 | ); 269 | mainGroup = 6003F581195388D10070C39A; 270 | productRefGroup = 6003F58B195388D20070C39A /* Products */; 271 | projectDirPath = ""; 272 | projectRoot = ""; 273 | targets = ( 274 | 6003F589195388D20070C39A /* CTImageEdit_Example */, 275 | 6003F5AD195388D20070C39A /* CTImageEdit_Tests */, 276 | ); 277 | }; 278 | /* End PBXProject section */ 279 | 280 | /* Begin PBXResourcesBuildPhase section */ 281 | 6003F588195388D20070C39A /* Resources */ = { 282 | isa = PBXResourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */, 286 | 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */, 287 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, 288 | 4BA0D67E1E60355F000FB6B4 /* testimage@2x.png in Resources */, 289 | 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 6003F5AC195388D20070C39A /* Resources */ = { 294 | isa = PBXResourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXResourcesBuildPhase section */ 302 | 303 | /* Begin PBXShellScriptBuildPhase section */ 304 | 5795B3AE6EC263FE0F128DDB /* [CP] Check Pods Manifest.lock */ = { 305 | isa = PBXShellScriptBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | ); 309 | inputPaths = ( 310 | ); 311 | name = "[CP] Check Pods Manifest.lock"; 312 | outputPaths = ( 313 | ); 314 | runOnlyForDeploymentPostprocessing = 0; 315 | shellPath = /bin/sh; 316 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 317 | showEnvVarsInLog = 0; 318 | }; 319 | 5C869726A0894147ECB7CB1D /* [CP] Embed Pods Frameworks */ = { 320 | isa = PBXShellScriptBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | ); 324 | inputPaths = ( 325 | ); 326 | name = "[CP] Embed Pods Frameworks"; 327 | outputPaths = ( 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | shellPath = /bin/sh; 331 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CTImageEdit_Tests/Pods-CTImageEdit_Tests-frameworks.sh\"\n"; 332 | showEnvVarsInLog = 0; 333 | }; 334 | 668CCD5E982D38FD9D713ED7 /* [CP] Embed Pods Frameworks */ = { 335 | isa = PBXShellScriptBuildPhase; 336 | buildActionMask = 2147483647; 337 | files = ( 338 | ); 339 | inputPaths = ( 340 | ); 341 | name = "[CP] Embed Pods Frameworks"; 342 | outputPaths = ( 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | shellPath = /bin/sh; 346 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CTImageEdit_Example/Pods-CTImageEdit_Example-frameworks.sh\"\n"; 347 | showEnvVarsInLog = 0; 348 | }; 349 | 68A98DD74B167010C3A2DF9A /* [CP] Copy Pods Resources */ = { 350 | isa = PBXShellScriptBuildPhase; 351 | buildActionMask = 2147483647; 352 | files = ( 353 | ); 354 | inputPaths = ( 355 | ); 356 | name = "[CP] Copy Pods Resources"; 357 | outputPaths = ( 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | shellPath = /bin/sh; 361 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CTImageEdit_Example/Pods-CTImageEdit_Example-resources.sh\"\n"; 362 | showEnvVarsInLog = 0; 363 | }; 364 | E28C9E4CA90CE0C6A3FD6E4C /* [CP] Copy Pods Resources */ = { 365 | isa = PBXShellScriptBuildPhase; 366 | buildActionMask = 2147483647; 367 | files = ( 368 | ); 369 | inputPaths = ( 370 | ); 371 | name = "[CP] Copy Pods Resources"; 372 | outputPaths = ( 373 | ); 374 | runOnlyForDeploymentPostprocessing = 0; 375 | shellPath = /bin/sh; 376 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CTImageEdit_Tests/Pods-CTImageEdit_Tests-resources.sh\"\n"; 377 | showEnvVarsInLog = 0; 378 | }; 379 | E935BE3A07F9AACBA2DFCBDB /* [CP] Check Pods Manifest.lock */ = { 380 | isa = PBXShellScriptBuildPhase; 381 | buildActionMask = 2147483647; 382 | files = ( 383 | ); 384 | inputPaths = ( 385 | ); 386 | name = "[CP] Check Pods Manifest.lock"; 387 | outputPaths = ( 388 | ); 389 | runOnlyForDeploymentPostprocessing = 0; 390 | shellPath = /bin/sh; 391 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 392 | showEnvVarsInLog = 0; 393 | }; 394 | /* End PBXShellScriptBuildPhase section */ 395 | 396 | /* Begin PBXSourcesBuildPhase section */ 397 | 6003F586195388D20070C39A /* Sources */ = { 398 | isa = PBXSourcesBuildPhase; 399 | buildActionMask = 2147483647; 400 | files = ( 401 | 6003F59E195388D20070C39A /* CTAppDelegate.m in Sources */, 402 | 6003F5A7195388D20070C39A /* CTViewController.m in Sources */, 403 | 6003F59A195388D20070C39A /* main.m in Sources */, 404 | ); 405 | runOnlyForDeploymentPostprocessing = 0; 406 | }; 407 | 6003F5AA195388D20070C39A /* Sources */ = { 408 | isa = PBXSourcesBuildPhase; 409 | buildActionMask = 2147483647; 410 | files = ( 411 | 6003F5BC195388D20070C39A /* Tests.m in Sources */, 412 | ); 413 | runOnlyForDeploymentPostprocessing = 0; 414 | }; 415 | /* End PBXSourcesBuildPhase section */ 416 | 417 | /* Begin PBXTargetDependency section */ 418 | 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { 419 | isa = PBXTargetDependency; 420 | target = 6003F589195388D20070C39A /* CTImageEdit_Example */; 421 | targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; 422 | }; 423 | /* End PBXTargetDependency section */ 424 | 425 | /* Begin PBXVariantGroup section */ 426 | 6003F596195388D20070C39A /* InfoPlist.strings */ = { 427 | isa = PBXVariantGroup; 428 | children = ( 429 | 6003F597195388D20070C39A /* en */, 430 | ); 431 | name = InfoPlist.strings; 432 | sourceTree = ""; 433 | }; 434 | 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { 435 | isa = PBXVariantGroup; 436 | children = ( 437 | 6003F5B9195388D20070C39A /* en */, 438 | ); 439 | name = InfoPlist.strings; 440 | sourceTree = ""; 441 | }; 442 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */ = { 443 | isa = PBXVariantGroup; 444 | children = ( 445 | 71719F9E1E33DC2100824A3D /* Base */, 446 | ); 447 | name = LaunchScreen.storyboard; 448 | sourceTree = ""; 449 | }; 450 | /* End PBXVariantGroup section */ 451 | 452 | /* Begin XCBuildConfiguration section */ 453 | 6003F5BD195388D20070C39A /* Debug */ = { 454 | isa = XCBuildConfiguration; 455 | buildSettings = { 456 | ALWAYS_SEARCH_USER_PATHS = NO; 457 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 458 | CLANG_CXX_LIBRARY = "libc++"; 459 | CLANG_ENABLE_MODULES = YES; 460 | CLANG_ENABLE_OBJC_ARC = YES; 461 | CLANG_WARN_BOOL_CONVERSION = YES; 462 | CLANG_WARN_CONSTANT_CONVERSION = YES; 463 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 464 | CLANG_WARN_EMPTY_BODY = YES; 465 | CLANG_WARN_ENUM_CONVERSION = YES; 466 | CLANG_WARN_INT_CONVERSION = YES; 467 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 468 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 469 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 470 | COPY_PHASE_STRIP = NO; 471 | ENABLE_TESTABILITY = YES; 472 | GCC_C_LANGUAGE_STANDARD = gnu99; 473 | GCC_DYNAMIC_NO_PIC = NO; 474 | GCC_OPTIMIZATION_LEVEL = 0; 475 | GCC_PREPROCESSOR_DEFINITIONS = ( 476 | "DEBUG=1", 477 | "$(inherited)", 478 | ); 479 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 480 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 481 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 482 | GCC_WARN_UNDECLARED_SELECTOR = YES; 483 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 484 | GCC_WARN_UNUSED_FUNCTION = YES; 485 | GCC_WARN_UNUSED_VARIABLE = YES; 486 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 487 | ONLY_ACTIVE_ARCH = YES; 488 | SDKROOT = iphoneos; 489 | TARGETED_DEVICE_FAMILY = "1,2"; 490 | }; 491 | name = Debug; 492 | }; 493 | 6003F5BE195388D20070C39A /* Release */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | ALWAYS_SEARCH_USER_PATHS = NO; 497 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 498 | CLANG_CXX_LIBRARY = "libc++"; 499 | CLANG_ENABLE_MODULES = YES; 500 | CLANG_ENABLE_OBJC_ARC = YES; 501 | CLANG_WARN_BOOL_CONVERSION = YES; 502 | CLANG_WARN_CONSTANT_CONVERSION = YES; 503 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 504 | CLANG_WARN_EMPTY_BODY = YES; 505 | CLANG_WARN_ENUM_CONVERSION = YES; 506 | CLANG_WARN_INT_CONVERSION = YES; 507 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 508 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 509 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 510 | COPY_PHASE_STRIP = YES; 511 | ENABLE_NS_ASSERTIONS = NO; 512 | GCC_C_LANGUAGE_STANDARD = gnu99; 513 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 514 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 515 | GCC_WARN_UNDECLARED_SELECTOR = YES; 516 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 517 | GCC_WARN_UNUSED_FUNCTION = YES; 518 | GCC_WARN_UNUSED_VARIABLE = YES; 519 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 520 | SDKROOT = iphoneos; 521 | TARGETED_DEVICE_FAMILY = "1,2"; 522 | VALIDATE_PRODUCT = YES; 523 | }; 524 | name = Release; 525 | }; 526 | 6003F5C0195388D20070C39A /* Debug */ = { 527 | isa = XCBuildConfiguration; 528 | baseConfigurationReference = 3DC9B3600BE2454885383614 /* Pods-CTImageEdit_Example.debug.xcconfig */; 529 | buildSettings = { 530 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 531 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 532 | GCC_PREFIX_HEADER = "CTImageEdit/CTImageEdit-Prefix.pch"; 533 | INFOPLIST_FILE = "CTImageEdit/CTImageEdit-Info.plist"; 534 | MODULE_NAME = ExampleApp; 535 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 536 | PRODUCT_NAME = "$(TARGET_NAME)"; 537 | WRAPPER_EXTENSION = app; 538 | }; 539 | name = Debug; 540 | }; 541 | 6003F5C1195388D20070C39A /* Release */ = { 542 | isa = XCBuildConfiguration; 543 | baseConfigurationReference = E82A0E6852F185CA240E5C04 /* Pods-CTImageEdit_Example.release.xcconfig */; 544 | buildSettings = { 545 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 546 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 547 | GCC_PREFIX_HEADER = "CTImageEdit/CTImageEdit-Prefix.pch"; 548 | INFOPLIST_FILE = "CTImageEdit/CTImageEdit-Info.plist"; 549 | MODULE_NAME = ExampleApp; 550 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 551 | PRODUCT_NAME = "$(TARGET_NAME)"; 552 | WRAPPER_EXTENSION = app; 553 | }; 554 | name = Release; 555 | }; 556 | 6003F5C3195388D20070C39A /* Debug */ = { 557 | isa = XCBuildConfiguration; 558 | baseConfigurationReference = 411443384B4BE00FE0833E79 /* Pods-CTImageEdit_Tests.debug.xcconfig */; 559 | buildSettings = { 560 | BUNDLE_LOADER = "$(TEST_HOST)"; 561 | FRAMEWORK_SEARCH_PATHS = ( 562 | "$(SDKROOT)/Developer/Library/Frameworks", 563 | "$(inherited)", 564 | "$(DEVELOPER_FRAMEWORKS_DIR)", 565 | ); 566 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 567 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 568 | GCC_PREPROCESSOR_DEFINITIONS = ( 569 | "DEBUG=1", 570 | "$(inherited)", 571 | ); 572 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 573 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 574 | PRODUCT_NAME = "$(TARGET_NAME)"; 575 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CTImageEdit_Example.app/CTImageEdit_Example"; 576 | WRAPPER_EXTENSION = xctest; 577 | }; 578 | name = Debug; 579 | }; 580 | 6003F5C4195388D20070C39A /* Release */ = { 581 | isa = XCBuildConfiguration; 582 | baseConfigurationReference = C7368527722BF0F774E8459F /* Pods-CTImageEdit_Tests.release.xcconfig */; 583 | buildSettings = { 584 | BUNDLE_LOADER = "$(TEST_HOST)"; 585 | FRAMEWORK_SEARCH_PATHS = ( 586 | "$(SDKROOT)/Developer/Library/Frameworks", 587 | "$(inherited)", 588 | "$(DEVELOPER_FRAMEWORKS_DIR)", 589 | ); 590 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 591 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 592 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 593 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 594 | PRODUCT_NAME = "$(TARGET_NAME)"; 595 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CTImageEdit_Example.app/CTImageEdit_Example"; 596 | WRAPPER_EXTENSION = xctest; 597 | }; 598 | name = Release; 599 | }; 600 | /* End XCBuildConfiguration section */ 601 | 602 | /* Begin XCConfigurationList section */ 603 | 6003F585195388D10070C39A /* Build configuration list for PBXProject "CTImageEdit" */ = { 604 | isa = XCConfigurationList; 605 | buildConfigurations = ( 606 | 6003F5BD195388D20070C39A /* Debug */, 607 | 6003F5BE195388D20070C39A /* Release */, 608 | ); 609 | defaultConfigurationIsVisible = 0; 610 | defaultConfigurationName = Release; 611 | }; 612 | 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CTImageEdit_Example" */ = { 613 | isa = XCConfigurationList; 614 | buildConfigurations = ( 615 | 6003F5C0195388D20070C39A /* Debug */, 616 | 6003F5C1195388D20070C39A /* Release */, 617 | ); 618 | defaultConfigurationIsVisible = 0; 619 | defaultConfigurationName = Release; 620 | }; 621 | 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CTImageEdit_Tests" */ = { 622 | isa = XCConfigurationList; 623 | buildConfigurations = ( 624 | 6003F5C3195388D20070C39A /* Debug */, 625 | 6003F5C4195388D20070C39A /* Release */, 626 | ); 627 | defaultConfigurationIsVisible = 0; 628 | defaultConfigurationName = Release; 629 | }; 630 | /* End XCConfigurationList section */ 631 | }; 632 | rootObject = 6003F582195388D10070C39A /* Project object */; 633 | } 634 | -------------------------------------------------------------------------------- /Example/CTImageEdit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/CTImageEdit.xcodeproj/xcshareddata/xcschemes/CTImageEdit-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Example/CTImageEdit.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/CTImageEdit/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/CTImageEdit/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/CTImageEdit/CTAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTAppDelegate.h 3 | // CTImageEdit 4 | // 5 | // Created by acct= on 02/24/2017. 6 | // Copyright (c) 2017 acct=. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface CTAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/CTImageEdit/CTAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTAppDelegate.m 3 | // CTImageEdit 4 | // 5 | // Created by acct= on 02/24/2017. 6 | // Copyright (c) 2017 acct=. All rights reserved. 7 | // 8 | 9 | #import "CTAppDelegate.h" 10 | 11 | @implementation CTAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/CTImageEdit/CTImageEdit-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/CTImageEdit/CTImageEdit-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/CTImageEdit/CTViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTViewController.h 3 | // CTImageEdit 4 | // 5 | // Created by acct= on 02/24/2017. 6 | // Copyright (c) 2017 acct=. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface CTViewController : UIViewController 12 | 13 | - (IBAction)click1:(id)sender; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/CTImageEdit/CTViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTViewController.m 3 | // CTImageEdit 4 | // 5 | // Created by acct= on 02/24/2017. 6 | // Copyright (c) 2017 acct=. All rights reserved. 7 | // 8 | 9 | #import "CTViewController.h" 10 | #import 11 | 12 | @interface CTViewController () 13 | 14 | @property (nonatomic,strong) UIImage *image; 15 | 16 | @property (nonatomic,strong) UIImageView *imageview; 17 | 18 | @end 19 | 20 | @implementation CTViewController 21 | 22 | - (void)viewDidLoad 23 | { 24 | [super viewDidLoad]; 25 | // Do any additional setup after loading the view, typically from a nib. 26 | 27 | self.image= [UIImage imageNamed:@"testimage"]; 28 | NSLog(@"%f",self.image.size.width); 29 | self.imageview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 100, self.view.bounds.size.width, self.view.bounds.size.width*523/375)]; 30 | self.imageview.image = self.image; 31 | [self.view addSubview:self.imageview]; 32 | } 33 | - (void)click1:(id)sender{ 34 | CTImageSmearViewController *ctr = [[CTImageSmearViewController alloc]init]; 35 | ctr.delegate = self; 36 | [ctr packageWithImage:self.image]; 37 | [self presentViewController:ctr animated:NO completion:nil]; 38 | } 39 | 40 | - (void)didReceiveMemoryWarning 41 | { 42 | [super didReceiveMemoryWarning]; 43 | // Dispose of any resources that can be recreated. 44 | } 45 | - (void)didSmearPhotoWithResultImage:(UIImage *)image{ 46 | self.image = image; 47 | self.imageview.image = self.image; 48 | } 49 | @end 50 | -------------------------------------------------------------------------------- /Example/CTImageEdit/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Example/CTImageEdit/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/CTImageEdit/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CTImageEdit 4 | // 5 | // Created by acct= on 02/24/2017. 6 | // Copyright (c) 2017 acct=. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "CTAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CTAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/CTImageEdit/testimage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangcheng1/CTImageEdit/336be3036994dae7a82c3d56e25f65f1b7dfde0b/Example/CTImageEdit/testimage@2x.png -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'CTImageEdit_Example' do 4 | pod 'CTImageEdit', :path => '../' 5 | 6 | target 'CTImageEdit_Tests' do 7 | inherit! :search_paths 8 | 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTImageEditTests.m 3 | // CTImageEditTests 4 | // 5 | // Created by acct= on 02/24/2017. 6 | // Copyright (c) 2017 acct=. All rights reserved. 7 | // 8 | 9 | @import XCTest; 10 | 11 | @interface Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 acct= <632306630@qq.com> 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 运行看效果。 3 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------