├── gif └── Untitle2.gif ├── PGG_OC_Image ├── Assets.xcassets │ ├── Contents.json │ ├── 国旗.imageset │ │ ├── 国旗.gif │ │ └── Contents.json │ ├── mohu.imageset │ │ ├── mohu.jpg │ │ └── Contents.json │ ├── textImage.imageset │ │ ├── textImage.jpg │ │ └── Contents.json │ ├── zhaoyihuan.imageset │ │ ├── zhaoyihuan.jpg │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── PGG_icon1024.png │ │ ├── PGG_icon20@2x.png │ │ ├── PGG_icon20@3x.png │ │ ├── PGG_icon29@2x.png │ │ ├── PGG_icon29@3x.png │ │ ├── PGG_icon40@2x.png │ │ ├── PGG_icon40@3x.png │ │ ├── PGG_icon60@2x.png │ │ ├── PGG_icon60@3x.png │ │ └── Contents.json │ └── Details_Btn_Up.imageset │ │ ├── Details_Btn_Up@2x.png │ │ ├── Details_Btn_Up@3x.png │ │ └── Contents.json ├── THScaleButton.h ├── THEmoticonView.h ├── ViewController.h ├── AnyCutViewController.h ├── GuaJiangViewController.h ├── AppDelegate.h ├── main.m ├── NextViewController.h ├── UIView+Frame.h ├── THScaleButton.m ├── GuaJiangViewController.m ├── Info.plist ├── AnyCutViewController.m ├── AppDelegate.m ├── UIView+Frame.m ├── ViewController.m ├── UIImage+Quart2D.h ├── NextViewController.m ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── THEmoticonView.m └── UIImage+Quart2D.m ├── PGG_OC_Image.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcuserdata │ └── chen.xcuserdatad │ │ ├── xcschemes │ │ └── xcschememanagement.plist │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist └── project.pbxproj ├── PGG_OC_ImageTests ├── Info.plist └── PGG_OC_ImageTests.m ├── PGG_OC_ImageUITests ├── Info.plist └── PGG_OC_ImageUITests.m └── README.md /gif/Untitle2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/gif/Untitle2.gif -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/国旗.imageset/国旗.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/国旗.imageset/国旗.gif -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/mohu.imageset/mohu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/mohu.imageset/mohu.jpg -------------------------------------------------------------------------------- /PGG_OC_Image/THScaleButton.h: -------------------------------------------------------------------------------- 1 | 2 | //https://github.com/penghero/PGG_OC_Image.git 3 | #import 4 | 5 | @interface THScaleButton : UIView 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/textImage.imageset/textImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/textImage.imageset/textImage.jpg -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/zhaoyihuan.imageset/zhaoyihuan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/zhaoyihuan.imageset/zhaoyihuan.jpg -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon1024.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon20@2x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon20@3x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon29@2x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon29@3x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon40@2x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon40@3x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon60@2x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/PGG_icon60@3x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/Details_Btn_Up.imageset/Details_Btn_Up@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/Details_Btn_Up.imageset/Details_Btn_Up@2x.png -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/Details_Btn_Up.imageset/Details_Btn_Up@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/penghero/PGG_OC_Image/HEAD/PGG_OC_Image/Assets.xcassets/Details_Btn_Up.imageset/Details_Btn_Up@3x.png -------------------------------------------------------------------------------- /PGG_OC_Image.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PGG_OC_Image/THEmoticonView.h: -------------------------------------------------------------------------------- 1 | //https://github.com/penghero/PGG_OC_Image.git 2 | 3 | #import 4 | 5 | @interface THEmoticonView : UIView 6 | - (instancetype)initWithImage:(UIImage *)image; 7 | + (void)setActiveEmoticonView:(THEmoticonView *)view; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /PGG_OC_Image/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /PGG_OC_Image/AnyCutViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AnyCutViewController.h 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import 10 | /** 11 | 任意裁剪 12 | */ 13 | @interface AnyCutViewController : UIViewController 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /PGG_OC_Image/GuaJiangViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GuaJiangViewController.h 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import 10 | 11 | /** 12 | 刮奖 13 | */ 14 | @interface GuaJiangViewController : UIViewController 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /PGG_OC_Image/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /PGG_OC_Image/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/mohu.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "mohu.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/国旗.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "国旗.gif", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/textImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "textImage.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/zhaoyihuan.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "zhaoyihuan.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /PGG_OC_Image.xcodeproj/xcuserdata/chen.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PGG_OC_Image.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/Details_Btn_Up.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Details_Btn_Up@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "Details_Btn_Up@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /PGG_OC_Image.xcodeproj/xcuserdata/chen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PGG_OC_Image/NextViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NextViewController.h 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import 10 | 11 | 12 | typedef NS_ENUM(NSUInteger, PGGImageType) { 13 | PGGImageTypeA = 0, 14 | PGGImageTypeB, 15 | PGGImageTypeC, 16 | PGGImageTypeD, 17 | PGGImageTypeE, 18 | PGGImageTypeF, 19 | PGGImageTypeG, 20 | PGGImageTypeH, 21 | PGGImageTypeI, 22 | PGGImageTypeJ, 23 | PGGImageTypeK, 24 | }; 25 | 26 | /** 27 | 普通展示 28 | */ 29 | @interface NextViewController : UIViewController 30 | 31 | @property (assign, nonatomic) PGGImageType *PGGType; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /PGG_OC_ImageTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /PGG_OC_ImageUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /PGG_OC_Image/UIView+Frame.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Frame.h 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/25. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import 10 | 11 | @interface UIView (Frame) 12 | 13 | @property (nonatomic, assign) CGFloat x; 14 | @property (nonatomic, assign) CGFloat y; 15 | @property (nonatomic, assign) CGFloat centerX; 16 | @property (nonatomic, assign) CGFloat centerY; 17 | @property (nonatomic, assign) CGFloat width; 18 | @property (nonatomic, assign) CGFloat height; 19 | @property (nonatomic, assign) CGSize size; 20 | @property (nonatomic, assign) CGPoint origin; 21 | 22 | @property (nonatomic) CGFloat top; 23 | @property (nonatomic) CGFloat bottom; 24 | @property (nonatomic) CGFloat right; 25 | @property (nonatomic) CGFloat left; 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /PGG_OC_ImageTests/PGG_OC_ImageTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGG_OC_ImageTests.m 3 | // PGG_OC_ImageTests 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PGG_OC_ImageTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PGG_OC_ImageTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /PGG_OC_Image/THScaleButton.m: -------------------------------------------------------------------------------- 1 | 2 | //https://github.com/penghero/PGG_OC_Image.git 3 | #import "THScaleButton.h" 4 | 5 | @implementation THScaleButton 6 | 7 | - (id)initWithFrame:(CGRect)frame 8 | { 9 | self = [super initWithFrame:frame]; 10 | if (self) { 11 | self.backgroundColor = [UIColor clearColor]; 12 | 13 | } 14 | return self; 15 | } 16 | 17 | - (void)drawRect:(CGRect)rect 18 | { 19 | CGContextRef context = UIGraphicsGetCurrentContext(); 20 | 21 | CGRect rct = self.bounds; 22 | CGFloat radius = 0.7; 23 | rct.origin.x = 0.5 * (rct.size.width - radius * rct.size.width); 24 | rct.origin.y = 0.5 * (rct.size.height - radius * rct.size.height); 25 | rct.size.width = radius * rct.size.width; 26 | rct.size.height = radius * rct.size.height; 27 | 28 | CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor); 29 | CGContextFillEllipseInRect(context, rct); 30 | 31 | CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor); 32 | CGContextSetLineWidth(context, 5); 33 | CGContextStrokeEllipseInRect(context, rct); 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /PGG_OC_ImageUITests/PGG_OC_ImageUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGG_OC_ImageUITests.m 3 | // PGG_OC_ImageUITests 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PGG_OC_ImageUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PGG_OC_ImageUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /PGG_OC_Image/GuaJiangViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // GuaJiangViewController.m 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import "GuaJiangViewController.h" 10 | #import "UIImage+Quart2D.h" 11 | 12 | @interface GuaJiangViewController () 13 | @property (strong, nonatomic) IBOutlet UIImageView *zhaoYHImage; 14 | @property (strong, nonatomic) IBOutlet UIImageView *moHuImage; 15 | 16 | @end 17 | 18 | @implementation GuaJiangViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view. 23 | // 添加拖动手势 模拟擦拭 24 | UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(wipePanGestureEvent:)]; 25 | [self.moHuImage addGestureRecognizer:pan]; 26 | } 27 | - (void)wipePanGestureEvent:(UIPanGestureRecognizer * )pan{ 28 | self.moHuImage.image = [UIImage wipeImageWithView:self.moHuImage currentPoint:[pan locationInView:self.moHuImage] size:CGSizeMake(30, 30)]; 29 | } 30 | - (void)didReceiveMemoryWarning { 31 | [super didReceiveMemoryWarning]; 32 | // Dispose of any resources that can be recreated. 33 | } 34 | 35 | /* 36 | #pragma mark - Navigation 37 | 38 | // In a storyboard-based application, you will often want to do a little preparation before navigation 39 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 40 | // Get the new view controller using [segue destinationViewController]. 41 | // Pass the selected object to the new view controller. 42 | } 43 | */ 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /PGG_OC_Image/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | PGG图片处理 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 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /PGG_OC_Image/AnyCutViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // AnyCutViewController.m 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import "AnyCutViewController.h" 10 | #import "THEmoticonView.h" 11 | #import "UIImage+Quart2D.h" 12 | 13 | @interface AnyCutViewController () 14 | 15 | @property (strong, nonatomic) IBOutlet UIView *mengBanView; 16 | @property (strong, nonatomic) IBOutlet UIImageView *zhaoYHImg; 17 | @property (strong, nonatomic) IBOutlet UIButton *resetBtn; 18 | @property (strong, nonatomic) IBOutlet UIButton *okBtn; 19 | @property (strong, nonatomic) THEmoticonView *cutImgView; 20 | @end 21 | 22 | @implementation AnyCutViewController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | // Do any additional setup after loading the view. 27 | self.cutImgView = [[THEmoticonView alloc] initWithImage:[UIImage createImageWithColor:[UIColor whiteColor] frame:CGRectMake(self.view.center.x, self.view.center.y, 100, 100)]]; 28 | [self.view addSubview:self.cutImgView]; 29 | } 30 | - (IBAction)resetBtnAction:(id)sender { 31 | self.zhaoYHImg.image = [UIImage imageNamed:@"zhaoyihuan"]; 32 | 33 | } 34 | - (IBAction)okBtnAction:(id)sender { 35 | UIImage *img = [UIImage imageFromImage:self.zhaoYHImg.image inRect:CGRectMake(self.cutImgView.center.x, self.cutImgView.center.y, self.cutImgView.frame.size.width, self.cutImgView.frame.size.height)]; 36 | self.zhaoYHImg.image = img; 37 | } 38 | 39 | - (void)didReceiveMemoryWarning { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | /* 45 | #pragma mark - Navigation 46 | 47 | // In a storyboard-based application, you will often want to do a little preparation before navigation 48 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 49 | // Get the new view controller using [segue destinationViewController]. 50 | // Pass the selected object to the new view controller. 51 | } 52 | */ 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /PGG_OC_Image/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /PGG_OC_Image/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "PGG_icon20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "PGG_icon20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "PGG_icon29@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "PGG_icon29@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "PGG_icon40@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "PGG_icon40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "PGG_icon60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "PGG_icon60@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "idiom" : "ipad", 53 | "size" : "20x20", 54 | "scale" : "1x" 55 | }, 56 | { 57 | "idiom" : "ipad", 58 | "size" : "20x20", 59 | "scale" : "2x" 60 | }, 61 | { 62 | "idiom" : "ipad", 63 | "size" : "29x29", 64 | "scale" : "1x" 65 | }, 66 | { 67 | "idiom" : "ipad", 68 | "size" : "29x29", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "idiom" : "ipad", 73 | "size" : "40x40", 74 | "scale" : "1x" 75 | }, 76 | { 77 | "idiom" : "ipad", 78 | "size" : "40x40", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "idiom" : "ipad", 83 | "size" : "76x76", 84 | "scale" : "1x" 85 | }, 86 | { 87 | "idiom" : "ipad", 88 | "size" : "76x76", 89 | "scale" : "2x" 90 | }, 91 | { 92 | "idiom" : "ipad", 93 | "size" : "83.5x83.5", 94 | "scale" : "2x" 95 | }, 96 | { 97 | "size" : "1024x1024", 98 | "idiom" : "ios-marketing", 99 | "filename" : "PGG_icon1024.png", 100 | "scale" : "1x" 101 | } 102 | ], 103 | "info" : { 104 | "version" : 1, 105 | "author" : "xcode" 106 | } 107 | } -------------------------------------------------------------------------------- /PGG_OC_Image/UIView+Frame.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Frame.m 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/25. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import "UIView+Frame.h" 10 | 11 | @implementation UIView (Frame) 12 | - (void)setX:(CGFloat)x 13 | { 14 | CGRect frame = self.frame; 15 | frame.origin.x = x; 16 | self.frame = frame; 17 | } 18 | 19 | - (void)setY:(CGFloat)y 20 | { 21 | CGRect frame = self.frame; 22 | frame.origin.y = y; 23 | self.frame = frame; 24 | } 25 | 26 | - (CGFloat)x 27 | { 28 | return self.frame.origin.x; 29 | } 30 | 31 | - (CGFloat)y 32 | { 33 | return self.frame.origin.y; 34 | } 35 | 36 | - (void)setCenterX:(CGFloat)centerX 37 | { 38 | CGPoint center = self.center; 39 | center.x = centerX; 40 | self.center = center; 41 | } 42 | 43 | - (CGFloat)centerX 44 | { 45 | return self.center.x; 46 | } 47 | 48 | - (void)setCenterY:(CGFloat)centerY 49 | { 50 | CGPoint center = self.center; 51 | center.y = centerY; 52 | self.center = center; 53 | } 54 | 55 | - (CGFloat)centerY 56 | { 57 | return self.center.y; 58 | } 59 | 60 | - (void)setWidth:(CGFloat)width 61 | { 62 | CGRect frame = self.frame; 63 | frame.size.width = width; 64 | self.frame = frame; 65 | } 66 | 67 | - (void)setHeight:(CGFloat)height 68 | { 69 | CGRect frame = self.frame; 70 | frame.size.height = height; 71 | self.frame = frame; 72 | } 73 | 74 | - (CGFloat)height 75 | { 76 | return self.frame.size.height; 77 | } 78 | 79 | - (CGFloat)width 80 | { 81 | return self.frame.size.width; 82 | } 83 | 84 | - (void)setSize:(CGSize)size 85 | { 86 | CGRect frame = self.frame; 87 | frame.size = size; 88 | self.frame = frame; 89 | } 90 | 91 | - (CGSize)size 92 | { 93 | return self.frame.size; 94 | } 95 | 96 | - (void)setOrigin:(CGPoint)origin 97 | { 98 | CGRect frame = self.frame; 99 | frame.origin = origin; 100 | self.frame = frame; 101 | } 102 | 103 | - (CGPoint)origin 104 | { 105 | return self.frame.origin; 106 | } 107 | 108 | - (CGFloat)top 109 | { 110 | return self.frame.origin.y; 111 | } 112 | 113 | - (void)setTop:(CGFloat)y 114 | { 115 | CGRect frame = self.frame; 116 | frame.origin.y = y; 117 | self.frame = frame; 118 | } 119 | 120 | - (CGFloat)right 121 | { 122 | return self.frame.origin.x + self.frame.size.width; 123 | } 124 | 125 | - (void)setRight:(CGFloat)right 126 | { 127 | CGRect frame = self.frame; 128 | frame.origin.x = right - self.frame.size.width; 129 | self.frame = frame; 130 | } 131 | 132 | - (CGFloat)bottom 133 | { 134 | return self.frame.origin.y + self.frame.size.height; 135 | } 136 | 137 | - (void)setBottom:(CGFloat)bottom 138 | { 139 | CGRect frame = self.frame; 140 | frame.origin.y = bottom - self.frame.size.height; 141 | self.frame = frame; 142 | } 143 | 144 | - (CGFloat)left 145 | { 146 | return self.frame.origin.x; 147 | } 148 | 149 | - (void)setLeft:(CGFloat)x 150 | { 151 | CGRect frame = self.frame; 152 | frame.origin.x = x; 153 | self.frame = frame; 154 | } 155 | @end 156 | -------------------------------------------------------------------------------- /PGG_OC_Image/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import "ViewController.h" 10 | #import "NextViewController.h" 11 | #import "GuaJiangViewController.h" 12 | #import "AnyCutViewController.h" 13 | 14 | @interface ViewController () 15 | 16 | @property (strong, nonatomic) IBOutlet UITableView *tableView; 17 | 18 | @property (strong, nonatomic) NSArray *ItemArray; 19 | 20 | @end 21 | 22 | static NSString *cellID = @"UITableViewCellID"; 23 | 24 | @implementation ViewController 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | // Do any additional setup after loading the view, typically from a nib. 29 | self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 30 | self.tableView.tableFooterView = [UIView new]; 31 | 32 | } 33 | - (NSArray *)ItemArray { 34 | if (!_ItemArray) { 35 | _ItemArray = [NSArray arrayWithObjects:@"PGG生成纯色图片",@"PGG给图片添加文字水印",@"PGG给图片添加图片水印",@"PGG裁剪圆形图片",@"PGG裁剪带边框的圆形图片",@"PGG截屏",@"PGG刮奖",@"PGG毛玻璃效果",@"PGG压缩成指定大小",@"PGG来任意裁剪试试",@"PGG缓存图片", nil]; 36 | } 37 | return _ItemArray; 38 | } 39 | 40 | #pragma mark - 代理 41 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 42 | return self.ItemArray.count; 43 | } 44 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 45 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; 46 | if (cell == nil) { 47 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; 48 | } 49 | cell.backgroundColor = [UIColor clearColor]; 50 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 51 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 52 | cell.textLabel.text = self.ItemArray[indexPath.row]; 53 | cell.textLabel.textColor = [UIColor whiteColor]; 54 | return cell; 55 | } 56 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 57 | 58 | switch (indexPath.row) { 59 | case 6: { 60 | GuaJiangViewController *guaJiang = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"guajiang"]; 61 | [self presentViewController:guaJiang animated:YES completion:nil]; 62 | break; 63 | } 64 | case 9: { 65 | AnyCutViewController *any = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"anycut"]; 66 | [self presentViewController:any animated:YES completion:nil]; 67 | break; 68 | } 69 | default: { 70 | NextViewController *next = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"next"]; 71 | next.PGGType = (long)indexPath.row; 72 | [self presentViewController:next animated:YES completion:nil]; 73 | break; } 74 | } 75 | } 76 | 77 | - (void)didReceiveMemoryWarning { 78 | [super didReceiveMemoryWarning]; 79 | // Dispose of any resources that can be recreated. 80 | } 81 | 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PGG_OC_Image 2 | 鹏哥哥OC版的图片处理 3 | # 效果演示GIF 4 | ![image](https://github.com/penghero/PGG_OC_Image/blob/master/gif/Untitle2.gif) 5 | # 部分讲解 6 | 主要类 UIImage+Quart2D(图片工具整理类) 7 | 主要方法 8 | ``` 9 | /** 10 | 压缩成指定大小的图片 11 | 12 | @param image <#image description#> 13 | @param maxLength <#maxLength description#> 14 | @return <#return value description#> 15 | */ 16 | + (UIImage *)compressImage:(UIImage *)image toByte:(NSUInteger)maxLength; 17 | /** 18 | 生成纯色图片 19 | @param color 颜色 20 | @param rect 大小 21 | @return 返回生成好的图片 22 | */ 23 | 24 | + (UIImage *)createImageWithColor:(UIColor *)color frame:(CGRect)rect; 25 | 26 | /** 27 | 按原图片名生成图片 28 | 29 | @param name <#name description#> 30 | @return <#return value description#> 31 | */ 32 | + (UIImage *)drawImageWithImageNamed:(NSString *)name; 33 | /** 34 | 添加文字水印的图片 35 | 36 | @param image <#image description#> 37 | @param text <#text description#> 38 | @param point <#point description#> 39 | @param attributed <#attributed description#> 40 | @return <#return value description#> 41 | */ 42 | + (UIImage *)waterImageWithImage:(UIImage *)image text:(NSString *)text textPoint:(CGPoint)point attributedString:(NSDictionary * )attributed; 43 | 44 | /** 45 | 添加图片水印的图片 46 | 47 | @param image <#image description#> 48 | @param waterImage <#waterImage description#> 49 | @param rect <#rect description#> 50 | @return <#return value description#> 51 | */ 52 | + (UIImage *)waterImageWithImage:(UIImage *)image waterImage:(UIImage *)waterImage waterImageRect:(CGRect)rect; 53 | 54 | /** 55 | 裁剪圆形图片 56 | 57 | @param image <#image description#> 58 | @param rect <#rect description#> 59 | @return <#return value description#> 60 | */ 61 | + (UIImage *)clipCircleImageWithImage:( UIImage *)image circleRect:(CGRect)rect; 62 | 63 | /** 64 | 裁剪带边框的圆形图片 65 | 66 | @param image <#image description#> 67 | @param rect <#rect description#> 68 | @param borderW <#borderW description#> 69 | @param borderColor <#borderColor description#> 70 | @return <#return value description#> 71 | */ 72 | + (UIImage *)clipCircleImageWithImage:( UIImage *)image circleRect:(CGRect)rect borderWidth:(CGFloat)borderW borderColor:( UIColor *)borderColor; 73 | 74 | /** 75 | 截屏 76 | 77 | @param view <#view description#> 78 | @param block <#block description#> 79 | */ 80 | + (void)cutScreenWithView:( UIView *)view successBlock:( void(^)(UIImage * image,NSData * imagedata))block; 81 | 82 | /** 83 | 图片擦除 类似于刮奖 84 | 85 | @param view <#view description#> 86 | @param nowPoint <#nowPoint description#> 87 | @param size <#size description#> 88 | @return <#return value description#> 89 | */ 90 | + (UIImage *)wipeImageWithView:(UIView *)view currentPoint:(CGPoint)nowPoint size:(CGSize)size; 91 | /** 92 | 高斯毛玻璃 93 | 94 | @param image 原图片 95 | @param blur 模糊程度 0-1 96 | @return 生成带有毛玻璃效果的图片 97 | */ 98 | + (UIImage *)boxblurImage:(UIImage *)image withBlurNumber:(CGFloat)blur; 99 | /** 100 | *从图片中按指定的位置大小截取图片的一部分 101 | * UIImage image 原始的图片 102 | * CGRect rect 要截取的区域 103 | */ 104 | + (UIImage *)imageFromImage:(UIImage *)image inRect:(CGRect)rect; 105 | 106 | /** 107 | *根据给定的size的宽高比自动缩放原图片、自动判断截取位置,进行图片截取 108 | * UIImage image 原始的图片 109 | * CGSize size 截取图片的size 110 | */ 111 | + (UIImage *)clipImage:(UIImage *)image toRect:(CGSize)size; 112 | /* 113 | 保存图片 114 | */ 115 | + (void)saveImageToPhotosAlbum:(UIImage*)image; 116 | ``` 117 | 118 | # 联系 119 | 896733185@qq.com 有任何疑问欢迎与我联系 我们共同进步 120 | # 感谢 121 | 感谢GitHub大神优秀开源代码 愿我们共同进步 122 | -------------------------------------------------------------------------------- /PGG_OC_Image/UIImage+Quart2D.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Quart2D.h 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/23. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import 10 | 11 | /** 12 | 图片工具整理类 13 | 14 | */ 15 | @interface UIImage (Quart2D) 16 | 17 | 18 | /** 19 | 压缩成指定大小的图片 20 | 21 | @param image <#image description#> 22 | @param maxLength <#maxLength description#> 23 | @return <#return value description#> 24 | */ 25 | + (UIImage *)compressImage:(UIImage *)image toByte:(NSUInteger)maxLength; 26 | /** 27 | 生成纯色图片 28 | @param color 颜色 29 | @param rect 大小 30 | @return 返回生成好的图片 31 | */ 32 | 33 | + (UIImage *)createImageWithColor:(UIColor *)color frame:(CGRect)rect; 34 | 35 | /** 36 | 按原图片名生成图片 37 | 38 | @param name <#name description#> 39 | @return <#return value description#> 40 | */ 41 | + (UIImage *)drawImageWithImageNamed:(NSString *)name; 42 | /** 43 | 添加文字水印的图片 44 | 45 | @param image <#image description#> 46 | @param text <#text description#> 47 | @param point <#point description#> 48 | @param attributed <#attributed description#> 49 | @return <#return value description#> 50 | */ 51 | + (UIImage *)waterImageWithImage:(UIImage *)image text:(NSString *)text textPoint:(CGPoint)point attributedString:(NSDictionary * )attributed; 52 | 53 | /** 54 | 添加图片水印的图片 55 | 56 | @param image <#image description#> 57 | @param waterImage <#waterImage description#> 58 | @param rect <#rect description#> 59 | @return <#return value description#> 60 | */ 61 | + (UIImage *)waterImageWithImage:(UIImage *)image waterImage:(UIImage *)waterImage waterImageRect:(CGRect)rect; 62 | 63 | /** 64 | 裁剪圆形图片 65 | 66 | @param image <#image description#> 67 | @param rect <#rect description#> 68 | @return <#return value description#> 69 | */ 70 | + (UIImage *)clipCircleImageWithImage:( UIImage *)image circleRect:(CGRect)rect; 71 | 72 | 73 | /** 74 | 裁剪带边框的圆形图片 75 | 76 | @param image <#image description#> 77 | @param rect <#rect description#> 78 | @param borderW <#borderW description#> 79 | @param borderColor <#borderColor description#> 80 | @return <#return value description#> 81 | */ 82 | + (UIImage *)clipCircleImageWithImage:( UIImage *)image circleRect:(CGRect)rect borderWidth:(CGFloat)borderW borderColor:( UIColor *)borderColor; 83 | 84 | /** 85 | 截屏 86 | 87 | @param view <#view description#> 88 | @param block <#block description#> 89 | */ 90 | + (void)cutScreenWithView:( UIView *)view successBlock:( void(^)(UIImage * image,NSData * imagedata))block; 91 | 92 | /** 93 | 图片擦除 类似于刮奖 94 | 95 | @param view <#view description#> 96 | @param nowPoint <#nowPoint description#> 97 | @param size <#size description#> 98 | @return <#return value description#> 99 | */ 100 | + (UIImage *)wipeImageWithView:(UIView *)view currentPoint:(CGPoint)nowPoint size:(CGSize)size; 101 | /** 102 | 高斯毛玻璃 103 | 104 | @param image 原图片 105 | @param blur 模糊程度 0-1 106 | @return 生成带有毛玻璃效果的图片 107 | */ 108 | + (UIImage *)boxblurImage:(UIImage *)image withBlurNumber:(CGFloat)blur; 109 | /** 110 | *从图片中按指定的位置大小截取图片的一部分 111 | * UIImage image 原始的图片 112 | * CGRect rect 要截取的区域 113 | */ 114 | + (UIImage *)imageFromImage:(UIImage *)image inRect:(CGRect)rect; 115 | 116 | /** 117 | *根据给定的size的宽高比自动缩放原图片、自动判断截取位置,进行图片截取 118 | * UIImage image 原始的图片 119 | * CGSize size 截取图片的size 120 | */ 121 | + (UIImage *)clipImage:(UIImage *)image toRect:(CGSize)size; 122 | /* 123 | 保存图片 124 | */ 125 | + (void)saveImageToPhotosAlbum:(UIImage*)image; 126 | @end 127 | -------------------------------------------------------------------------------- /PGG_OC_Image/NextViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NextViewController.m 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/24. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import "NextViewController.h" 10 | #import "UIImage+Quart2D.h" 11 | 12 | @interface NextViewController () 13 | 14 | @property (strong, nonatomic) IBOutlet UIImageView *oldImg; 15 | @property (strong, nonatomic) IBOutlet UIImageView *after_Img; 16 | @property (strong, nonatomic) IBOutlet UILabel *beforeData; 17 | @property (strong, nonatomic) IBOutlet UILabel *afterData; 18 | 19 | @end 20 | 21 | @implementation NextViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | // Do any additional setup after loading the view. 26 | } 27 | - (IBAction)showAction:(id)sender { 28 | NSInteger type = self.PGGType; 29 | switch (type) { 30 | case 0:{ 31 | self.after_Img.image = [UIImage createImageWithColor:[UIColor redColor] frame:self.view.frame]; 32 | break; } 33 | case 1: { 34 | //设置字体样式 35 | NSMutableDictionary * dict = [NSMutableDictionary dictionary]; 36 | //NSFontAttributeName:字体大小 37 | dict[NSFontAttributeName] = [UIFont systemFontOfSize:20]; 38 | //字体前景色 39 | dict[NSForegroundColorAttributeName] = [UIColor whiteColor]; 40 | //字体背景色 41 | dict[NSBackgroundColorAttributeName] = [UIColor clearColor]; 42 | //字体阴影 43 | NSShadow * shadow = [[NSShadow alloc]init]; 44 | //阴影偏移量 45 | shadow.shadowOffset = CGSizeMake(3, 5); 46 | //阴影颜色 47 | shadow.shadowColor = [UIColor greenColor]; 48 | //高斯模糊 49 | shadow.shadowBlurRadius = 5; 50 | dict[NSShadowAttributeName] = shadow; 51 | //字体间距 52 | dict[NSKernAttributeName] = @10; 53 | self.after_Img.image = [UIImage waterImageWithImage:[UIImage imageNamed:@"textImage"] text:@"鹏哥哥->水印" textPoint:CGPointMake(500, 500) attributedString:dict]; 54 | break; } 55 | case 2: { 56 | self.after_Img.image = [UIImage waterImageWithImage:[UIImage imageNamed:@"textImage"] waterImage:[UIImage imageNamed:@"textImage"] waterImageRect:CGRectMake(100, 100, 200, 200)]; 57 | break; } 58 | case 3: { 59 | UIImage *img = [UIImage imageNamed:@"textImage"]; 60 | self.after_Img.image = [UIImage clipCircleImageWithImage:img circleRect:CGRectMake(0, 0, img.size.width, img.size.height)]; 61 | break; } 62 | case 4: { 63 | UIImage *img = [UIImage imageNamed:@"textImage"]; 64 | self.after_Img.image = [UIImage clipCircleImageWithImage:img circleRect:CGRectMake(0, 0, img.size.width, img.size.height) borderWidth:5 borderColor:[UIColor redColor]]; 65 | break; } 66 | case 5: { 67 | [UIImage cutScreenWithView:self.view successBlock:^(UIImage *image, NSData *imagedata) { 68 | self.after_Img.image = image; 69 | }]; 70 | break; } 71 | case 6: { 72 | 73 | break; } 74 | case 7: { 75 | self.after_Img.image = [UIImage boxblurImage:[UIImage imageNamed:@"zhaoyihuan"] withBlurNumber:0.8]; 76 | break; } 77 | case 8: { 78 | UIImage *img = [UIImage imageNamed:@"textImage"]; 79 | NSData *beforeData = UIImageJPEGRepresentation(img,1); 80 | self.after_Img.image = [UIImage compressImage:img toByte:1000]; 81 | NSData *afterData = UIImageJPEGRepresentation(self.after_Img.image,1); 82 | [self.beforeData setHidden:NO]; 83 | [self.afterData setHidden:NO]; 84 | self.beforeData.text = [NSString stringWithFormat:@"压缩前:%lu k",(unsigned long)[beforeData length]/1024]; 85 | self.afterData.text = [NSString stringWithFormat:@"压缩后:%lu k",(unsigned long)[afterData length]/1024]; 86 | break; } 87 | case 9: { 88 | 89 | break; } 90 | case 10: { 91 | 92 | break; } 93 | } 94 | } 95 | 96 | - (void)didReceiveMemoryWarning { 97 | [super didReceiveMemoryWarning]; 98 | // Dispose of any resources that can be recreated. 99 | } 100 | 101 | /* 102 | #pragma mark - Navigation 103 | 104 | // In a storyboard-based application, you will often want to do a little preparation before navigation 105 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 106 | // Get the new view controller using [segue destinationViewController]. 107 | // Pass the selected object to the new view controller. 108 | } 109 | */ 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /PGG_OC_Image/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 | 30 | 39 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /PGG_OC_Image/THEmoticonView.m: -------------------------------------------------------------------------------- 1 | 2 | //https://github.com/penghero/PGG_OC_Image.git 3 | #import "THEmoticonView.h" 4 | #import "THScaleButton.h" 5 | #import "UIView+Frame.h" 6 | static const NSUInteger kDeleteBtnSize = 32; 7 | 8 | @interface THEmoticonView() 9 | { 10 | 11 | UIImageView *_imageView; //表情图片 12 | UIButton *_deleteButton; //删除按钮 13 | THScaleButton *_scaleBtn; 14 | 15 | CGFloat _scale; //当前缩放比例 16 | CGFloat _arg; //当前旋转比例 17 | 18 | CGPoint _initialPoint; //表情的中心点 19 | CGFloat _initialScale; //修改前的缩放比例 20 | CGFloat _initialArg; //修改前旋转比例 21 | } 22 | @end 23 | @implementation THEmoticonView 24 | + (void)setActiveEmoticonView:(THEmoticonView*)view 25 | { 26 | static THEmoticonView *activeView = nil; 27 | if(view != activeView){ 28 | [activeView setAvtive:NO]; //隐藏上一个表情的线和按钮 29 | activeView = view; 30 | //显示当前表情的线和按钮 31 | [activeView setAvtive:YES]; 32 | //显示在最上层 33 | [activeView.superview bringSubviewToFront:activeView]; 34 | } 35 | } 36 | 37 | - (instancetype)initWithImage:(UIImage *)image{ 38 | self = [super initWithFrame:CGRectMake(0, 0, image.size.width + kDeleteBtnSize, image.size.height+ kDeleteBtnSize)]; 39 | if (self) { 40 | _imageView = [[UIImageView alloc] initWithImage:image]; 41 | _imageView.layer.borderColor = [[UIColor blackColor] CGColor]; 42 | _imageView.layer.cornerRadius = 3; 43 | _imageView.center = self.center; 44 | [self addSubview:_imageView]; 45 | _imageView.userInteractionEnabled = YES; 46 | _deleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; 47 | 48 | [_deleteButton setImage:[UIImage imageNamed:@"btn_delete"] forState:UIControlStateNormal]; 49 | _deleteButton.frame = CGRectMake(0, 0, kDeleteBtnSize, kDeleteBtnSize); 50 | _deleteButton.center = _imageView.frame.origin; 51 | [_deleteButton addTarget:self action:@selector(clickDeleteBtn:) forControlEvents:UIControlEventTouchUpInside]; 52 | // [self addSubview:_deleteButton]; 53 | 54 | _scaleBtn = [[THScaleButton alloc] initWithFrame:CGRectMake(0, 0, kDeleteBtnSize, kDeleteBtnSize)]; 55 | _scaleBtn.center = CGPointMake(_imageView.width + _imageView.frame.origin.x, _imageView.height + _imageView.frame.origin.y); 56 | _scaleBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin; 57 | 58 | [self addSubview:_scaleBtn]; 59 | 60 | _scale = 1; 61 | _arg = 0; 62 | 63 | [self initGestures]; 64 | } 65 | return self; 66 | } 67 | 68 | - (void)initGestures 69 | { 70 | _imageView.userInteractionEnabled = YES; 71 | [_imageView addGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(imageDidPan:)]]; 72 | [_scaleBtn addGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(scaleBtnDidPan:)]]; 73 | } 74 | 75 | //删除 76 | - (void)clickDeleteBtn:(id)sender 77 | { 78 | THEmoticonView *nextTarget = nil; 79 | 80 | const NSInteger index = [self.superview.subviews indexOfObject:self]; 81 | 82 | for(NSInteger i=index+1; i=0; --i){ 92 | UIView *view = [self.superview.subviews objectAtIndex:i]; 93 | if([view isKindOfClass:[THEmoticonView class]]){ 94 | nextTarget = (THEmoticonView *)view; 95 | break; 96 | } 97 | } 98 | } 99 | 100 | [[self class] setActiveEmoticonView:nextTarget]; 101 | [self removeFromSuperview]; 102 | } 103 | 104 | - (void)setAvtive:(BOOL)active 105 | { 106 | _deleteButton.hidden = !active; 107 | _scaleBtn.hidden = !active; 108 | _imageView.layer.borderWidth = (active) ? 5/_scale : 0; 109 | _imageView.layer.borderColor = [UIColor whiteColor].CGColor; 110 | } 111 | 112 | - (void)setScale:(CGFloat)scale 113 | { 114 | _scale = scale; 115 | 116 | self.transform = CGAffineTransformIdentity; 117 | 118 | _imageView.transform = CGAffineTransformMakeScale(_scale, _scale); //缩放 119 | 120 | CGRect rct = self.frame; 121 | rct.origin.x += (rct.size.width - (_imageView.width + kDeleteBtnSize)) / 2; 122 | rct.origin.y += (rct.size.height - (_imageView.height + kDeleteBtnSize)) / 2; 123 | rct.size.width = _imageView.width + kDeleteBtnSize; 124 | rct.size.height = _imageView.height + kDeleteBtnSize; 125 | self.frame = rct; 126 | 127 | _imageView.center = CGPointMake(rct.size.width/2, rct.size.height/2); 128 | 129 | self.transform = CGAffineTransformMakeRotation(_arg); //旋转 130 | 131 | _imageView.layer.borderWidth = 5/_scale; 132 | _imageView.layer.cornerRadius = 3/_scale; 133 | } 134 | 135 | //拖动 136 | - (void)imageDidPan:(UIPanGestureRecognizer*)sender 137 | { 138 | [[self class] setActiveEmoticonView:self]; 139 | 140 | CGPoint p = [sender translationInView:self.superview]; 141 | 142 | if(sender.state == UIGestureRecognizerStateBegan){ 143 | _initialPoint = self.center; 144 | } 145 | self.center = CGPointMake(_initialPoint.x + p.x, _initialPoint.y + p.y); 146 | } 147 | 148 | //缩放 149 | - (void)scaleBtnDidPan:(UIPanGestureRecognizer*)sender 150 | { 151 | CGPoint p = [sender translationInView:self.superview]; 152 | 153 | static CGFloat tmpR = 1; //临时缩放值 154 | static CGFloat tmpA = 0; //临时旋转值 155 | if(sender.state == UIGestureRecognizerStateBegan){ 156 | //表情view中的缩放按钮相对与表情view父视图中的位置 157 | _initialPoint = [self.superview convertPoint:_scaleBtn.center fromView:_scaleBtn.superview]; 158 | 159 | CGPoint p = CGPointMake(_initialPoint.x - self.center.x, _initialPoint.y - self.center.y); 160 | //缩放按钮中点与表情view中点的直线距离 161 | tmpR = sqrt(p.x*p.x + p.y*p.y); //开根号 162 | //缩放按钮中点与表情view中点连线的斜率角度 163 | tmpA = atan2(p.y, p.x);//反正切函数 164 | 165 | _initialArg = _arg; 166 | _initialScale = _scale; 167 | } 168 | 169 | p = CGPointMake(_initialPoint.x + p.x - self.center.x, _initialPoint.y + p.y - self.center.y); 170 | CGFloat R = sqrt(p.x*p.x + p.y*p.y); //拖动后的距离 171 | CGFloat arg = atan2(p.y, p.x); // 拖动后的旋转角度 172 | //旋转角度 173 | _arg = _initialArg + arg - tmpA; //原始角度+拖动后的角度 - 拖动前的角度 174 | //放大缩小的值 175 | [self setScale:MAX(_initialScale * R / tmpR, 0.2)]; 176 | } 177 | @end 178 | -------------------------------------------------------------------------------- /PGG_OC_Image/UIImage+Quart2D.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Quart2D.m 3 | // PGG_OC_Image 4 | // 5 | // Created by 陈鹏 on 2018/1/23. 6 | // Copyright © 2018年 penggege.CP. All rights reserved. 7 | //https://github.com/penghero/PGG_OC_Image.git 8 | 9 | #import "UIImage+Quart2D.h" 10 | #import 11 | 12 | @implementation UIImage (Quart2D) 13 | /** 14 | *根据给定的size的宽高比自动缩放原图片、自动判断截取位置,进行图片截取 15 | * UIImage image 原始的图片 16 | * CGSize size 截取图片的size 17 | */ 18 | + (UIImage *)clipImage:(UIImage *)image toRect:(CGSize)size{ 19 | 20 | //被切图片宽比例比高比例小 或者相等,以图片宽进行放大 21 | if (image.size.width*size.height <= image.size.height*size.width) { 22 | 23 | //以被剪裁图片的宽度为基准,得到剪切范围的大小 24 | CGFloat width = image.size.width; 25 | CGFloat height = image.size.width * size.height / size.width; 26 | 27 | // 调用剪切方法 28 | // 这里是以中心位置剪切,也可以通过改变rect的x、y值调整剪切位置 29 | return [UIImage imageFromImage:image inRect:CGRectMake(0, (image.size.height -height)/2, width, height)]; 30 | 31 | }else{ //被切图片宽比例比高比例大,以图片高进行剪裁 32 | 33 | // 以被剪切图片的高度为基准,得到剪切范围的大小 34 | CGFloat width = image.size.height * size.width / size.height; 35 | CGFloat height = image.size.height; 36 | 37 | // 调用剪切方法 38 | // 这里是以中心位置剪切,也可以通过改变rect的x、y值调整剪切位置 39 | return [UIImage imageFromImage:image inRect:CGRectMake((image.size.width -width)/2, 0, width, height)]; 40 | } 41 | return nil; 42 | } 43 | 44 | 45 | /** 46 | *从图片中按指定的位置大小截取图片的一部分 47 | * UIImage image 原始的图片 48 | * CGRect rect 要截取的区域 49 | */ 50 | + (UIImage *)imageFromImage:(UIImage *)image inRect:(CGRect)rect{ 51 | 52 | //将UIImage转换成CGImageRef 53 | CGImageRef sourceImageRef = [image CGImage]; 54 | 55 | //按照给定的矩形区域进行剪裁 56 | CGImageRef newImageRef = CGImageCreateWithImageInRect(sourceImageRef, rect); 57 | 58 | //将CGImageRef转换成UIImage 59 | UIImage *newImage = [UIImage imageWithCGImage:newImageRef]; 60 | 61 | //返回剪裁后的图片 62 | return newImage; 63 | } 64 | 65 | 66 | + (UIImage *)compressImage:(UIImage *)image toByte:(NSUInteger)maxLength { 67 | CGFloat compression = 1; 68 | NSData *data = UIImageJPEGRepresentation(image, compression); 69 | if (data.length < maxLength) return image; 70 | 71 | CGFloat max = 1; 72 | CGFloat min = 0; 73 | for (int i = 0; i < 6; ++i) { 74 | compression = (max + min) / 2; 75 | data = UIImageJPEGRepresentation(image, compression); 76 | if (data.length < maxLength * 0.9) { 77 | min = compression; 78 | } else if (data.length > maxLength) { 79 | max = compression; 80 | } else { 81 | break; 82 | } 83 | } 84 | UIImage *resultImage = [UIImage imageWithData:data]; 85 | if (data.length < maxLength) return resultImage; 86 | 87 | NSUInteger lastDataLength = 0; 88 | while (data.length > maxLength && data.length != lastDataLength) { 89 | lastDataLength = data.length; 90 | CGFloat ratio = (CGFloat)maxLength / data.length; 91 | CGSize size = CGSizeMake((NSUInteger)(resultImage.size.width * sqrtf(ratio)), 92 | (NSUInteger)(resultImage.size.height * sqrtf(ratio))); 93 | UIGraphicsBeginImageContext(size); 94 | [resultImage drawInRect:CGRectMake(0, 0, size.width, size.height)]; 95 | resultImage = UIGraphicsGetImageFromCurrentImageContext(); 96 | UIGraphicsEndImageContext(); 97 | data = UIImageJPEGRepresentation(resultImage, compression); 98 | } 99 | return resultImage; 100 | } 101 | 102 | + (UIImage *)createImageWithColor:(UIColor *)color frame:(CGRect)rect{ 103 | UIGraphicsBeginImageContext(rect.size); 104 | CGContextRef context = UIGraphicsGetCurrentContext(); 105 | CGContextSetFillColorWithColor(context, [color CGColor]); 106 | CGContextFillRect(context, rect); 107 | UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); 108 | UIGraphicsEndImageContext(); 109 | return theImage; 110 | } 111 | 112 | + (UIImage *)drawImageWithImageNamed:(NSString *)name{ 113 | //1.获取图片 114 | UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:name ofType:nil]]; 115 | //2.开启图形上下文 116 | UIGraphicsBeginImageContext(image.size); 117 | //3.绘制到图形上下文中 118 | [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)]; 119 | //4.从上下文中获取图片 120 | UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext(); 121 | //5.关闭图形上下文 122 | UIGraphicsEndImageContext(); 123 | //返回图片 124 | return newImage; 125 | } 126 | 127 | + (UIImage *)waterImageWithImage:(UIImage *)image text:(NSString *)text textPoint:(CGPoint)point attributedString:(NSDictionary * )attributed{ 128 | //1.开启上下文 129 | UIGraphicsBeginImageContextWithOptions(image.size, NO, 0); 130 | //2.绘制图片 131 | [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)]; 132 | //3.添加水印文字 133 | [text drawAtPoint:point withAttributes:attributed]; 134 | //4.从上下文中获取新图片 135 | UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext(); 136 | //5.关闭图形上下文 137 | UIGraphicsEndImageContext(); 138 | //返回图片 139 | return newImage; 140 | 141 | } 142 | 143 | + (UIImage *)waterImageWithImage:(UIImage *)image waterImage:(UIImage *)waterImage waterImageRect:(CGRect)rect{ 144 | //1.开启上下文 145 | UIGraphicsBeginImageContextWithOptions(image.size, NO, 0); 146 | //2.绘制背景图片 147 | [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)]; 148 | //3.绘制水印图片到当前上下文 149 | [waterImage drawInRect:rect]; 150 | //4.从上下文中获取新图片 151 | UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext(); 152 | //5.关闭图形上下文 153 | UIGraphicsEndImageContext(); 154 | //返回图片 155 | return newImage; 156 | } 157 | 158 | + (UIImage *)clipCircleImageWithImage:( UIImage *)image circleRect:(CGRect)rect{ 159 | //1、开启上下文 160 | UIGraphicsBeginImageContextWithOptions(image.size, NO, 0); 161 | //2、设置裁剪区域 162 | UIBezierPath * path = [UIBezierPath bezierPathWithOvalInRect:rect]; 163 | [path addClip]; 164 | //3、绘制图片 165 | [image drawAtPoint:CGPointZero]; 166 | //4、获取新图片 167 | UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext(); 168 | //5、关闭上下文 169 | UIGraphicsEndImageContext(); 170 | //6、返回新图片 171 | return newImage; 172 | } 173 | 174 | + (UIImage *)clipCircleImageWithImage:( UIImage *)image circleRect:(CGRect)rect borderWidth:(CGFloat)borderW borderColor:( UIColor *)borderColor{ 175 | //1、开启上下文 176 | UIGraphicsBeginImageContext(image.size); 177 | //2、设置边框 178 | UIBezierPath * path = [UIBezierPath bezierPathWithOvalInRect:rect]; 179 | [borderColor setFill]; 180 | [path fill]; 181 | //3、设置裁剪区域 182 | UIBezierPath * clipPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(rect.origin.x + borderW , rect.origin.x + borderW , rect.size.width - borderW * 2, rect.size.height - borderW *2)]; 183 | [clipPath addClip]; 184 | //4、绘制图片 185 | [image drawAtPoint:CGPointZero]; 186 | //5、获取新图片 187 | UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext(); 188 | //6、关闭上下文 189 | UIGraphicsEndImageContext(); 190 | //7、返回新图片 191 | return newImage; 192 | } 193 | 194 | + (void)cutScreenWithView:( UIView *)view successBlock:( void(^)(UIImage * image,NSData * imagedata))block{ 195 | //1、开启上下文 196 | UIGraphicsBeginImageContext(view.bounds.size); 197 | //2.获取当前上下文 198 | CGContextRef ctx = UIGraphicsGetCurrentContext(); 199 | //3.截屏 200 | [view.layer renderInContext:ctx]; 201 | //4、获取新图片 202 | UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext(); 203 | //5.转化成为Data 204 | //compressionQuality:表示压缩比 0 - 1的取值范围 205 | NSData * data = UIImageJPEGRepresentation(newImage, 1); 206 | //6、关闭上下文 207 | UIGraphicsEndImageContext(); 208 | //7.回调 209 | block(newImage,data); 210 | } 211 | 212 | + (UIImage *)wipeImageWithView:(UIView *)view currentPoint:(CGPoint)nowPoint size:(CGSize)size{ 213 | //计算位置 214 | CGFloat offsetX = nowPoint.x - size.width * 0.5; 215 | CGFloat offsetY = nowPoint.y - size.height * 0.5; 216 | CGRect clipRect = CGRectMake(offsetX, offsetY, size.width, size.height); 217 | //开启上下文 218 | UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 1); 219 | //获取当前的上下文 220 | CGContextRef ctx = UIGraphicsGetCurrentContext(); 221 | //把图片绘制上去 222 | [view.layer renderInContext:ctx]; 223 | //把这一块设置为透明 224 | CGContextClearRect(ctx, clipRect); 225 | //获取新的图片 226 | UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext(); 227 | //关闭上下文 228 | UIGraphicsEndImageContext(); 229 | //重新赋值图片 230 | return newImage; 231 | } 232 | 233 | 234 | + (UIImage *)boxblurImage:(UIImage *)image withBlurNumber:(CGFloat)blur { 235 | if (blur < 0.f || blur > 1.f) { 236 | blur = 0.5f; 237 | } 238 | int boxSize = (int)(blur * 40); 239 | boxSize = boxSize - (boxSize % 2) + 1; 240 | CGImageRef img = image.CGImage; 241 | vImage_Buffer inBuffer, outBuffer; 242 | vImage_Error error; 243 | void *pixelBuffer; 244 | //从CGImage中获取数据 245 | CGDataProviderRef inProvider = CGImageGetDataProvider(img); 246 | CFDataRef inBitmapData = CGDataProviderCopyData(inProvider); 247 | //设置从CGImage获取对象的属性 248 | inBuffer.width = CGImageGetWidth(img); 249 | inBuffer.height = CGImageGetHeight(img); 250 | inBuffer.rowBytes = CGImageGetBytesPerRow(img); 251 | inBuffer.data = (void*)CFDataGetBytePtr(inBitmapData); 252 | pixelBuffer = malloc(CGImageGetBytesPerRow(img) * CGImageGetHeight(img)); 253 | if(pixelBuffer == NULL) 254 | NSLog(@"No pixelbuffer"); 255 | outBuffer.data = pixelBuffer; 256 | outBuffer.width = CGImageGetWidth(img); 257 | outBuffer.height = CGImageGetHeight(img); 258 | outBuffer.rowBytes = CGImageGetBytesPerRow(img); 259 | error = vImageBoxConvolve_ARGB8888(&inBuffer, &outBuffer, NULL, 0, 0, boxSize, boxSize, NULL, kvImageEdgeExtend); 260 | if (error) { 261 | NSLog(@"error from convolution %ld", error); 262 | } 263 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 264 | CGContextRef ctx = CGBitmapContextCreate( outBuffer.data, outBuffer.width, outBuffer.height, 8, outBuffer.rowBytes, colorSpace, kCGImageAlphaNoneSkipLast); 265 | CGImageRef imageRef = CGBitmapContextCreateImage (ctx); 266 | UIImage *returnImage = [UIImage imageWithCGImage:imageRef]; 267 | CGColorSpaceRelease(colorSpace); 268 | free(pixelBuffer); 269 | CFRelease(inBitmapData); 270 | CGColorSpaceRelease(colorSpace); 271 | CGImageRelease(imageRef); 272 | return returnImage; 273 | } 274 | 275 | // 保存图片 276 | + (void)saveImageToPhotosAlbum:(UIImage*)image{ 277 | UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL); 278 | } 279 | 280 | - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{ 281 | 282 | if(error != NULL){ 283 | // 保存图片失败 284 | 285 | }else{ 286 | // 保存图片成功 287 | 288 | } 289 | } 290 | 291 | @end 292 | -------------------------------------------------------------------------------- /PGG_OC_Image.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 742B5AC6201967BC004B1B39 /* UIView+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = 742B5AC5201967BC004B1B39 /* UIView+Frame.m */; }; 11 | 7466DA032022A1E10035B847 /* THEmoticonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7466D9FB2022A1E10035B847 /* THEmoticonView.m */; }; 12 | 7466DA052022A1E10035B847 /* THScaleButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 7466DA002022A1E10035B847 /* THScaleButton.m */; }; 13 | 74BCBCD720180F9100565165 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BCBCD620180F9100565165 /* AppDelegate.m */; }; 14 | 74BCBCDA20180F9100565165 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BCBCD920180F9100565165 /* ViewController.m */; }; 15 | 74BCBCDD20180F9100565165 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 74BCBCDB20180F9100565165 /* Main.storyboard */; }; 16 | 74BCBCDF20180F9100565165 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 74BCBCDE20180F9100565165 /* Assets.xcassets */; }; 17 | 74BCBCE220180F9100565165 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 74BCBCE020180F9100565165 /* LaunchScreen.storyboard */; }; 18 | 74BCBCE520180F9100565165 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BCBCE420180F9100565165 /* main.m */; }; 19 | 74BCBCEF20180F9100565165 /* PGG_OC_ImageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BCBCEE20180F9100565165 /* PGG_OC_ImageTests.m */; }; 20 | 74BCBCFA20180F9100565165 /* PGG_OC_ImageUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BCBCF920180F9100565165 /* PGG_OC_ImageUITests.m */; }; 21 | 74BCBD0920180FF500565165 /* UIImage+Quart2D.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BCBD0720180FF500565165 /* UIImage+Quart2D.m */; }; 22 | 74C78EAA201829E1004A8330 /* NextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 74C78EA9201829E1004A8330 /* NextViewController.m */; }; 23 | 74C78EAD20182A5A004A8330 /* AnyCutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 74C78EAC20182A5A004A8330 /* AnyCutViewController.m */; }; 24 | 74C78EB02018B925004A8330 /* GuaJiangViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 74C78EAF2018B924004A8330 /* GuaJiangViewController.m */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 74BCBCEB20180F9100565165 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 74BCBCCA20180F9100565165 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 74BCBCD120180F9100565165; 33 | remoteInfo = PGG_OC_Image; 34 | }; 35 | 74BCBCF620180F9100565165 /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 74BCBCCA20180F9100565165 /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = 74BCBCD120180F9100565165; 40 | remoteInfo = PGG_OC_Image; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 742B5AC4201967BC004B1B39 /* UIView+Frame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Frame.h"; sourceTree = ""; }; 46 | 742B5AC5201967BC004B1B39 /* UIView+Frame.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+Frame.m"; sourceTree = ""; }; 47 | 7466D9FB2022A1E10035B847 /* THEmoticonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = THEmoticonView.m; sourceTree = ""; }; 48 | 7466D9FE2022A1E10035B847 /* THScaleButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THScaleButton.h; sourceTree = ""; }; 49 | 7466D9FF2022A1E10035B847 /* THEmoticonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THEmoticonView.h; sourceTree = ""; }; 50 | 7466DA002022A1E10035B847 /* THScaleButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = THScaleButton.m; sourceTree = ""; }; 51 | 74BCBCD220180F9100565165 /* PGG_OC_Image.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PGG_OC_Image.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 74BCBCD520180F9100565165 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 53 | 74BCBCD620180F9100565165 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 54 | 74BCBCD820180F9100565165 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 55 | 74BCBCD920180F9100565165 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 56 | 74BCBCDC20180F9100565165 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 74BCBCDE20180F9100565165 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | 74BCBCE120180F9100565165 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | 74BCBCE320180F9100565165 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 74BCBCE420180F9100565165 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 61 | 74BCBCEA20180F9100565165 /* PGG_OC_ImageTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PGG_OC_ImageTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 74BCBCEE20180F9100565165 /* PGG_OC_ImageTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PGG_OC_ImageTests.m; sourceTree = ""; }; 63 | 74BCBCF020180F9100565165 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | 74BCBCF520180F9100565165 /* PGG_OC_ImageUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PGG_OC_ImageUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 65 | 74BCBCF920180F9100565165 /* PGG_OC_ImageUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PGG_OC_ImageUITests.m; sourceTree = ""; }; 66 | 74BCBCFB20180F9100565165 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 67 | 74BCBD0720180FF500565165 /* UIImage+Quart2D.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Quart2D.m"; sourceTree = ""; }; 68 | 74BCBD0820180FF500565165 /* UIImage+Quart2D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Quart2D.h"; sourceTree = ""; }; 69 | 74C78EA8201829E1004A8330 /* NextViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NextViewController.h; sourceTree = ""; }; 70 | 74C78EA9201829E1004A8330 /* NextViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NextViewController.m; sourceTree = ""; }; 71 | 74C78EAB20182A5A004A8330 /* AnyCutViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnyCutViewController.h; sourceTree = ""; }; 72 | 74C78EAC20182A5A004A8330 /* AnyCutViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnyCutViewController.m; sourceTree = ""; }; 73 | 74C78EAE2018B924004A8330 /* GuaJiangViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GuaJiangViewController.h; sourceTree = ""; }; 74 | 74C78EAF2018B924004A8330 /* GuaJiangViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GuaJiangViewController.m; sourceTree = ""; }; 75 | /* End PBXFileReference section */ 76 | 77 | /* Begin PBXFrameworksBuildPhase section */ 78 | 74BCBCCF20180F9100565165 /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | 74BCBCE720180F9100565165 /* Frameworks */ = { 86 | isa = PBXFrameworksBuildPhase; 87 | buildActionMask = 2147483647; 88 | files = ( 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | 74BCBCF220180F9100565165 /* Frameworks */ = { 93 | isa = PBXFrameworksBuildPhase; 94 | buildActionMask = 2147483647; 95 | files = ( 96 | ); 97 | runOnlyForDeploymentPostprocessing = 0; 98 | }; 99 | /* End PBXFrameworksBuildPhase section */ 100 | 101 | /* Begin PBXGroup section */ 102 | 74BCBCC920180F9100565165 = { 103 | isa = PBXGroup; 104 | children = ( 105 | 74BCBCD420180F9100565165 /* PGG_OC_Image */, 106 | 74BCBCED20180F9100565165 /* PGG_OC_ImageTests */, 107 | 74BCBCF820180F9100565165 /* PGG_OC_ImageUITests */, 108 | 74BCBCD320180F9100565165 /* Products */, 109 | ); 110 | sourceTree = ""; 111 | }; 112 | 74BCBCD320180F9100565165 /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 74BCBCD220180F9100565165 /* PGG_OC_Image.app */, 116 | 74BCBCEA20180F9100565165 /* PGG_OC_ImageTests.xctest */, 117 | 74BCBCF520180F9100565165 /* PGG_OC_ImageUITests.xctest */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 74BCBCD420180F9100565165 /* PGG_OC_Image */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 74BCBCD520180F9100565165 /* AppDelegate.h */, 126 | 74BCBCD620180F9100565165 /* AppDelegate.m */, 127 | 74BCBCD820180F9100565165 /* ViewController.h */, 128 | 74BCBCD920180F9100565165 /* ViewController.m */, 129 | 74C78EA8201829E1004A8330 /* NextViewController.h */, 130 | 74C78EA9201829E1004A8330 /* NextViewController.m */, 131 | 74C78EAE2018B924004A8330 /* GuaJiangViewController.h */, 132 | 74C78EAF2018B924004A8330 /* GuaJiangViewController.m */, 133 | 74C78EAB20182A5A004A8330 /* AnyCutViewController.h */, 134 | 74C78EAC20182A5A004A8330 /* AnyCutViewController.m */, 135 | 74BCBD0820180FF500565165 /* UIImage+Quart2D.h */, 136 | 74BCBD0720180FF500565165 /* UIImage+Quart2D.m */, 137 | 742B5AC4201967BC004B1B39 /* UIView+Frame.h */, 138 | 742B5AC5201967BC004B1B39 /* UIView+Frame.m */, 139 | 7466D9FF2022A1E10035B847 /* THEmoticonView.h */, 140 | 7466D9FB2022A1E10035B847 /* THEmoticonView.m */, 141 | 7466D9FE2022A1E10035B847 /* THScaleButton.h */, 142 | 7466DA002022A1E10035B847 /* THScaleButton.m */, 143 | 74BCBCDB20180F9100565165 /* Main.storyboard */, 144 | 74BCBCDE20180F9100565165 /* Assets.xcassets */, 145 | 74BCBCE020180F9100565165 /* LaunchScreen.storyboard */, 146 | 74BCBCE320180F9100565165 /* Info.plist */, 147 | 74BCBCE420180F9100565165 /* main.m */, 148 | ); 149 | path = PGG_OC_Image; 150 | sourceTree = ""; 151 | }; 152 | 74BCBCED20180F9100565165 /* PGG_OC_ImageTests */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 74BCBCEE20180F9100565165 /* PGG_OC_ImageTests.m */, 156 | 74BCBCF020180F9100565165 /* Info.plist */, 157 | ); 158 | path = PGG_OC_ImageTests; 159 | sourceTree = ""; 160 | }; 161 | 74BCBCF820180F9100565165 /* PGG_OC_ImageUITests */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 74BCBCF920180F9100565165 /* PGG_OC_ImageUITests.m */, 165 | 74BCBCFB20180F9100565165 /* Info.plist */, 166 | ); 167 | path = PGG_OC_ImageUITests; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXGroup section */ 171 | 172 | /* Begin PBXNativeTarget section */ 173 | 74BCBCD120180F9100565165 /* PGG_OC_Image */ = { 174 | isa = PBXNativeTarget; 175 | buildConfigurationList = 74BCBCFE20180F9100565165 /* Build configuration list for PBXNativeTarget "PGG_OC_Image" */; 176 | buildPhases = ( 177 | 74BCBCCE20180F9100565165 /* Sources */, 178 | 74BCBCCF20180F9100565165 /* Frameworks */, 179 | 74BCBCD020180F9100565165 /* Resources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | ); 185 | name = PGG_OC_Image; 186 | productName = PGG_OC_Image; 187 | productReference = 74BCBCD220180F9100565165 /* PGG_OC_Image.app */; 188 | productType = "com.apple.product-type.application"; 189 | }; 190 | 74BCBCE920180F9100565165 /* PGG_OC_ImageTests */ = { 191 | isa = PBXNativeTarget; 192 | buildConfigurationList = 74BCBD0120180F9100565165 /* Build configuration list for PBXNativeTarget "PGG_OC_ImageTests" */; 193 | buildPhases = ( 194 | 74BCBCE620180F9100565165 /* Sources */, 195 | 74BCBCE720180F9100565165 /* Frameworks */, 196 | 74BCBCE820180F9100565165 /* Resources */, 197 | ); 198 | buildRules = ( 199 | ); 200 | dependencies = ( 201 | 74BCBCEC20180F9100565165 /* PBXTargetDependency */, 202 | ); 203 | name = PGG_OC_ImageTests; 204 | productName = PGG_OC_ImageTests; 205 | productReference = 74BCBCEA20180F9100565165 /* PGG_OC_ImageTests.xctest */; 206 | productType = "com.apple.product-type.bundle.unit-test"; 207 | }; 208 | 74BCBCF420180F9100565165 /* PGG_OC_ImageUITests */ = { 209 | isa = PBXNativeTarget; 210 | buildConfigurationList = 74BCBD0420180F9100565165 /* Build configuration list for PBXNativeTarget "PGG_OC_ImageUITests" */; 211 | buildPhases = ( 212 | 74BCBCF120180F9100565165 /* Sources */, 213 | 74BCBCF220180F9100565165 /* Frameworks */, 214 | 74BCBCF320180F9100565165 /* Resources */, 215 | ); 216 | buildRules = ( 217 | ); 218 | dependencies = ( 219 | 74BCBCF720180F9100565165 /* PBXTargetDependency */, 220 | ); 221 | name = PGG_OC_ImageUITests; 222 | productName = PGG_OC_ImageUITests; 223 | productReference = 74BCBCF520180F9100565165 /* PGG_OC_ImageUITests.xctest */; 224 | productType = "com.apple.product-type.bundle.ui-testing"; 225 | }; 226 | /* End PBXNativeTarget section */ 227 | 228 | /* Begin PBXProject section */ 229 | 74BCBCCA20180F9100565165 /* Project object */ = { 230 | isa = PBXProject; 231 | attributes = { 232 | LastUpgradeCheck = 0920; 233 | ORGANIZATIONNAME = penggege.CP; 234 | TargetAttributes = { 235 | 74BCBCD120180F9100565165 = { 236 | CreatedOnToolsVersion = 9.2; 237 | ProvisioningStyle = Automatic; 238 | }; 239 | 74BCBCE920180F9100565165 = { 240 | CreatedOnToolsVersion = 9.2; 241 | ProvisioningStyle = Automatic; 242 | TestTargetID = 74BCBCD120180F9100565165; 243 | }; 244 | 74BCBCF420180F9100565165 = { 245 | CreatedOnToolsVersion = 9.2; 246 | ProvisioningStyle = Automatic; 247 | TestTargetID = 74BCBCD120180F9100565165; 248 | }; 249 | }; 250 | }; 251 | buildConfigurationList = 74BCBCCD20180F9100565165 /* Build configuration list for PBXProject "PGG_OC_Image" */; 252 | compatibilityVersion = "Xcode 8.0"; 253 | developmentRegion = en; 254 | hasScannedForEncodings = 0; 255 | knownRegions = ( 256 | en, 257 | Base, 258 | ); 259 | mainGroup = 74BCBCC920180F9100565165; 260 | productRefGroup = 74BCBCD320180F9100565165 /* Products */; 261 | projectDirPath = ""; 262 | projectRoot = ""; 263 | targets = ( 264 | 74BCBCD120180F9100565165 /* PGG_OC_Image */, 265 | 74BCBCE920180F9100565165 /* PGG_OC_ImageTests */, 266 | 74BCBCF420180F9100565165 /* PGG_OC_ImageUITests */, 267 | ); 268 | }; 269 | /* End PBXProject section */ 270 | 271 | /* Begin PBXResourcesBuildPhase section */ 272 | 74BCBCD020180F9100565165 /* Resources */ = { 273 | isa = PBXResourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | 74BCBCE220180F9100565165 /* LaunchScreen.storyboard in Resources */, 277 | 74BCBCDF20180F9100565165 /* Assets.xcassets in Resources */, 278 | 74BCBCDD20180F9100565165 /* Main.storyboard in Resources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | 74BCBCE820180F9100565165 /* Resources */ = { 283 | isa = PBXResourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | 74BCBCF320180F9100565165 /* Resources */ = { 290 | isa = PBXResourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | /* End PBXResourcesBuildPhase section */ 297 | 298 | /* Begin PBXSourcesBuildPhase section */ 299 | 74BCBCCE20180F9100565165 /* Sources */ = { 300 | isa = PBXSourcesBuildPhase; 301 | buildActionMask = 2147483647; 302 | files = ( 303 | 742B5AC6201967BC004B1B39 /* UIView+Frame.m in Sources */, 304 | 74C78EAD20182A5A004A8330 /* AnyCutViewController.m in Sources */, 305 | 7466DA052022A1E10035B847 /* THScaleButton.m in Sources */, 306 | 74C78EB02018B925004A8330 /* GuaJiangViewController.m in Sources */, 307 | 74C78EAA201829E1004A8330 /* NextViewController.m in Sources */, 308 | 74BCBCDA20180F9100565165 /* ViewController.m in Sources */, 309 | 74BCBCE520180F9100565165 /* main.m in Sources */, 310 | 7466DA032022A1E10035B847 /* THEmoticonView.m in Sources */, 311 | 74BCBCD720180F9100565165 /* AppDelegate.m in Sources */, 312 | 74BCBD0920180FF500565165 /* UIImage+Quart2D.m in Sources */, 313 | ); 314 | runOnlyForDeploymentPostprocessing = 0; 315 | }; 316 | 74BCBCE620180F9100565165 /* Sources */ = { 317 | isa = PBXSourcesBuildPhase; 318 | buildActionMask = 2147483647; 319 | files = ( 320 | 74BCBCEF20180F9100565165 /* PGG_OC_ImageTests.m in Sources */, 321 | ); 322 | runOnlyForDeploymentPostprocessing = 0; 323 | }; 324 | 74BCBCF120180F9100565165 /* Sources */ = { 325 | isa = PBXSourcesBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | 74BCBCFA20180F9100565165 /* PGG_OC_ImageUITests.m in Sources */, 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | }; 332 | /* End PBXSourcesBuildPhase section */ 333 | 334 | /* Begin PBXTargetDependency section */ 335 | 74BCBCEC20180F9100565165 /* PBXTargetDependency */ = { 336 | isa = PBXTargetDependency; 337 | target = 74BCBCD120180F9100565165 /* PGG_OC_Image */; 338 | targetProxy = 74BCBCEB20180F9100565165 /* PBXContainerItemProxy */; 339 | }; 340 | 74BCBCF720180F9100565165 /* PBXTargetDependency */ = { 341 | isa = PBXTargetDependency; 342 | target = 74BCBCD120180F9100565165 /* PGG_OC_Image */; 343 | targetProxy = 74BCBCF620180F9100565165 /* PBXContainerItemProxy */; 344 | }; 345 | /* End PBXTargetDependency section */ 346 | 347 | /* Begin PBXVariantGroup section */ 348 | 74BCBCDB20180F9100565165 /* Main.storyboard */ = { 349 | isa = PBXVariantGroup; 350 | children = ( 351 | 74BCBCDC20180F9100565165 /* Base */, 352 | ); 353 | name = Main.storyboard; 354 | sourceTree = ""; 355 | }; 356 | 74BCBCE020180F9100565165 /* LaunchScreen.storyboard */ = { 357 | isa = PBXVariantGroup; 358 | children = ( 359 | 74BCBCE120180F9100565165 /* Base */, 360 | ); 361 | name = LaunchScreen.storyboard; 362 | sourceTree = ""; 363 | }; 364 | /* End PBXVariantGroup section */ 365 | 366 | /* Begin XCBuildConfiguration section */ 367 | 74BCBCFC20180F9100565165 /* Debug */ = { 368 | isa = XCBuildConfiguration; 369 | buildSettings = { 370 | ALWAYS_SEARCH_USER_PATHS = NO; 371 | CLANG_ANALYZER_NONNULL = YES; 372 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 373 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 374 | CLANG_CXX_LIBRARY = "libc++"; 375 | CLANG_ENABLE_MODULES = YES; 376 | CLANG_ENABLE_OBJC_ARC = YES; 377 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 378 | CLANG_WARN_BOOL_CONVERSION = YES; 379 | CLANG_WARN_COMMA = YES; 380 | CLANG_WARN_CONSTANT_CONVERSION = YES; 381 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 382 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 383 | CLANG_WARN_EMPTY_BODY = YES; 384 | CLANG_WARN_ENUM_CONVERSION = YES; 385 | CLANG_WARN_INFINITE_RECURSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 388 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 389 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 390 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 391 | CLANG_WARN_STRICT_PROTOTYPES = YES; 392 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 393 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 394 | CLANG_WARN_UNREACHABLE_CODE = YES; 395 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 396 | CODE_SIGN_IDENTITY = "iPhone Developer"; 397 | COPY_PHASE_STRIP = NO; 398 | DEBUG_INFORMATION_FORMAT = dwarf; 399 | ENABLE_STRICT_OBJC_MSGSEND = YES; 400 | ENABLE_TESTABILITY = YES; 401 | GCC_C_LANGUAGE_STANDARD = gnu11; 402 | GCC_DYNAMIC_NO_PIC = NO; 403 | GCC_NO_COMMON_BLOCKS = YES; 404 | GCC_OPTIMIZATION_LEVEL = 0; 405 | GCC_PREPROCESSOR_DEFINITIONS = ( 406 | "DEBUG=1", 407 | "$(inherited)", 408 | ); 409 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 410 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 411 | GCC_WARN_UNDECLARED_SELECTOR = YES; 412 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 413 | GCC_WARN_UNUSED_FUNCTION = YES; 414 | GCC_WARN_UNUSED_VARIABLE = YES; 415 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 416 | MTL_ENABLE_DEBUG_INFO = YES; 417 | ONLY_ACTIVE_ARCH = YES; 418 | SDKROOT = iphoneos; 419 | }; 420 | name = Debug; 421 | }; 422 | 74BCBCFD20180F9100565165 /* Release */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ALWAYS_SEARCH_USER_PATHS = NO; 426 | CLANG_ANALYZER_NONNULL = YES; 427 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 428 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 429 | CLANG_CXX_LIBRARY = "libc++"; 430 | CLANG_ENABLE_MODULES = YES; 431 | CLANG_ENABLE_OBJC_ARC = YES; 432 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 433 | CLANG_WARN_BOOL_CONVERSION = YES; 434 | CLANG_WARN_COMMA = YES; 435 | CLANG_WARN_CONSTANT_CONVERSION = YES; 436 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 437 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 438 | CLANG_WARN_EMPTY_BODY = YES; 439 | CLANG_WARN_ENUM_CONVERSION = YES; 440 | CLANG_WARN_INFINITE_RECURSION = YES; 441 | CLANG_WARN_INT_CONVERSION = YES; 442 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 443 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 444 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 445 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 446 | CLANG_WARN_STRICT_PROTOTYPES = YES; 447 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 448 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 449 | CLANG_WARN_UNREACHABLE_CODE = YES; 450 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 451 | CODE_SIGN_IDENTITY = "iPhone Developer"; 452 | COPY_PHASE_STRIP = NO; 453 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 454 | ENABLE_NS_ASSERTIONS = NO; 455 | ENABLE_STRICT_OBJC_MSGSEND = YES; 456 | GCC_C_LANGUAGE_STANDARD = gnu11; 457 | GCC_NO_COMMON_BLOCKS = YES; 458 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 459 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 460 | GCC_WARN_UNDECLARED_SELECTOR = YES; 461 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 462 | GCC_WARN_UNUSED_FUNCTION = YES; 463 | GCC_WARN_UNUSED_VARIABLE = YES; 464 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 465 | MTL_ENABLE_DEBUG_INFO = NO; 466 | SDKROOT = iphoneos; 467 | VALIDATE_PRODUCT = YES; 468 | }; 469 | name = Release; 470 | }; 471 | 74BCBCFF20180F9100565165 /* Debug */ = { 472 | isa = XCBuildConfiguration; 473 | buildSettings = { 474 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 475 | CODE_SIGN_STYLE = Automatic; 476 | DEVELOPMENT_TEAM = M2R4253LC5; 477 | INFOPLIST_FILE = PGG_OC_Image/Info.plist; 478 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 479 | PRODUCT_BUNDLE_IDENTIFIER = "com.penggege.PGG-OC-Image"; 480 | PRODUCT_NAME = "$(TARGET_NAME)"; 481 | TARGETED_DEVICE_FAMILY = "1,2"; 482 | }; 483 | name = Debug; 484 | }; 485 | 74BCBD0020180F9100565165 /* Release */ = { 486 | isa = XCBuildConfiguration; 487 | buildSettings = { 488 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 489 | CODE_SIGN_STYLE = Automatic; 490 | DEVELOPMENT_TEAM = M2R4253LC5; 491 | INFOPLIST_FILE = PGG_OC_Image/Info.plist; 492 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 493 | PRODUCT_BUNDLE_IDENTIFIER = "com.penggege.PGG-OC-Image"; 494 | PRODUCT_NAME = "$(TARGET_NAME)"; 495 | TARGETED_DEVICE_FAMILY = "1,2"; 496 | }; 497 | name = Release; 498 | }; 499 | 74BCBD0220180F9100565165 /* Debug */ = { 500 | isa = XCBuildConfiguration; 501 | buildSettings = { 502 | BUNDLE_LOADER = "$(TEST_HOST)"; 503 | CODE_SIGN_STYLE = Automatic; 504 | DEVELOPMENT_TEAM = M2R4253LC5; 505 | INFOPLIST_FILE = PGG_OC_ImageTests/Info.plist; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 507 | PRODUCT_BUNDLE_IDENTIFIER = "com.penggege.PGG-OC-ImageTests"; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | TARGETED_DEVICE_FAMILY = "1,2"; 510 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PGG_OC_Image.app/PGG_OC_Image"; 511 | }; 512 | name = Debug; 513 | }; 514 | 74BCBD0320180F9100565165 /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | BUNDLE_LOADER = "$(TEST_HOST)"; 518 | CODE_SIGN_STYLE = Automatic; 519 | DEVELOPMENT_TEAM = M2R4253LC5; 520 | INFOPLIST_FILE = PGG_OC_ImageTests/Info.plist; 521 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 522 | PRODUCT_BUNDLE_IDENTIFIER = "com.penggege.PGG-OC-ImageTests"; 523 | PRODUCT_NAME = "$(TARGET_NAME)"; 524 | TARGETED_DEVICE_FAMILY = "1,2"; 525 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PGG_OC_Image.app/PGG_OC_Image"; 526 | }; 527 | name = Release; 528 | }; 529 | 74BCBD0520180F9100565165 /* Debug */ = { 530 | isa = XCBuildConfiguration; 531 | buildSettings = { 532 | CODE_SIGN_STYLE = Automatic; 533 | DEVELOPMENT_TEAM = M2R4253LC5; 534 | INFOPLIST_FILE = PGG_OC_ImageUITests/Info.plist; 535 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 536 | PRODUCT_BUNDLE_IDENTIFIER = "com.penggege.PGG-OC-ImageUITests"; 537 | PRODUCT_NAME = "$(TARGET_NAME)"; 538 | TARGETED_DEVICE_FAMILY = "1,2"; 539 | TEST_TARGET_NAME = PGG_OC_Image; 540 | }; 541 | name = Debug; 542 | }; 543 | 74BCBD0620180F9100565165 /* Release */ = { 544 | isa = XCBuildConfiguration; 545 | buildSettings = { 546 | CODE_SIGN_STYLE = Automatic; 547 | DEVELOPMENT_TEAM = M2R4253LC5; 548 | INFOPLIST_FILE = PGG_OC_ImageUITests/Info.plist; 549 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 550 | PRODUCT_BUNDLE_IDENTIFIER = "com.penggege.PGG-OC-ImageUITests"; 551 | PRODUCT_NAME = "$(TARGET_NAME)"; 552 | TARGETED_DEVICE_FAMILY = "1,2"; 553 | TEST_TARGET_NAME = PGG_OC_Image; 554 | }; 555 | name = Release; 556 | }; 557 | /* End XCBuildConfiguration section */ 558 | 559 | /* Begin XCConfigurationList section */ 560 | 74BCBCCD20180F9100565165 /* Build configuration list for PBXProject "PGG_OC_Image" */ = { 561 | isa = XCConfigurationList; 562 | buildConfigurations = ( 563 | 74BCBCFC20180F9100565165 /* Debug */, 564 | 74BCBCFD20180F9100565165 /* Release */, 565 | ); 566 | defaultConfigurationIsVisible = 0; 567 | defaultConfigurationName = Release; 568 | }; 569 | 74BCBCFE20180F9100565165 /* Build configuration list for PBXNativeTarget "PGG_OC_Image" */ = { 570 | isa = XCConfigurationList; 571 | buildConfigurations = ( 572 | 74BCBCFF20180F9100565165 /* Debug */, 573 | 74BCBD0020180F9100565165 /* Release */, 574 | ); 575 | defaultConfigurationIsVisible = 0; 576 | defaultConfigurationName = Release; 577 | }; 578 | 74BCBD0120180F9100565165 /* Build configuration list for PBXNativeTarget "PGG_OC_ImageTests" */ = { 579 | isa = XCConfigurationList; 580 | buildConfigurations = ( 581 | 74BCBD0220180F9100565165 /* Debug */, 582 | 74BCBD0320180F9100565165 /* Release */, 583 | ); 584 | defaultConfigurationIsVisible = 0; 585 | defaultConfigurationName = Release; 586 | }; 587 | 74BCBD0420180F9100565165 /* Build configuration list for PBXNativeTarget "PGG_OC_ImageUITests" */ = { 588 | isa = XCConfigurationList; 589 | buildConfigurations = ( 590 | 74BCBD0520180F9100565165 /* Debug */, 591 | 74BCBD0620180F9100565165 /* Release */, 592 | ); 593 | defaultConfigurationIsVisible = 0; 594 | defaultConfigurationName = Release; 595 | }; 596 | /* End XCConfigurationList section */ 597 | }; 598 | rootObject = 74BCBCCA20180F9100565165 /* Project object */; 599 | } 600 | -------------------------------------------------------------------------------- /PGG_OC_Image/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 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 84 | 97 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 174 | 184 | 194 | 208 | 219 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | --------------------------------------------------------------------------------