diff --git a/ALCameraViewController.xcodeproj/project.pbxproj b/ALCameraViewController.xcodeproj/project.pbxproj index 947182ed..409003f1 100644 --- a/ALCameraViewController.xcodeproj/project.pbxproj +++ b/ALCameraViewController.xcodeproj/project.pbxproj @@ -7,13 +7,24 @@ objects = { /* Begin PBXBuildFile section */ + B2357AB21FA50D51003F9ACF /* FilterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2357AB01FA50D51003F9ACF /* FilterViewController.swift */; }; + B255EDB41FA6648A00681E70 /* UIImageView+Filter.m in Sources */ = {isa = PBXBuildFile; fileRef = B2357AB61FA51155003F9ACF /* UIImageView+Filter.m */; }; + B255EDB51FA6648A00681E70 /* UIImageView+Filter.m in Sources */ = {isa = PBXBuildFile; fileRef = B2357AB61FA51155003F9ACF /* UIImageView+Filter.m */; }; + B255EDB61FA6648E00681E70 /* UIImageView+Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = B2357AB51FA51155003F9ACF /* UIImageView+Filter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B255EDB71FA6649000681E70 /* UIImage+Filter.m in Sources */ = {isa = PBXBuildFile; fileRef = B2357AB71FA51156003F9ACF /* UIImage+Filter.m */; }; + B255EDB81FA6649000681E70 /* UIImage+Filter.m in Sources */ = {isa = PBXBuildFile; fileRef = B2357AB71FA51156003F9ACF /* UIImage+Filter.m */; }; + B255EDB91FA6649300681E70 /* UIImage+Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = B2357AB81FA51156003F9ACF /* UIImage+Filter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B255EDBB1FA6674F00681E70 /* FilterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2357AB01FA50D51003F9ACF /* FilterViewController.swift */; }; + BF5861F31F613FB800B406F6 /* CropViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF5861F61F613FB800B406F6 /* CropViewController.xib */; }; + BF5861F41F613FB800B406F6 /* CropViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF5861F61F613FB800B406F6 /* CropViewController.xib */; }; + BF5861F81F61404C00B406F6 /* ConfirmViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF5861FB1F61404C00B406F6 /* ConfirmViewController.xib */; }; + BF5861F91F61404C00B406F6 /* ConfirmViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF5861FB1F61404C00B406F6 /* ConfirmViewController.xib */; }; + BF5861FE1F625D0F00B406F6 /* CameraView.strings in Resources */ = {isa = PBXBuildFile; fileRef = BF5862011F625D0F00B406F6 /* CameraView.strings */; }; + BF5861FF1F625D0F00B406F6 /* CameraView.strings in Resources */ = {isa = PBXBuildFile; fileRef = BF5862011F625D0F00B406F6 /* CameraView.strings */; }; C40665441C73A47C00EB9751 /* SingleImageSaver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40665431C73A47C00EB9751 /* SingleImageSaver.swift */; }; C40665461C73A94100EB9751 /* CameraGlobals.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40665451C73A94100EB9751 /* CameraGlobals.swift */; }; C40665481C73B72D00EB9751 /* SingleImageFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40665471C73B72D00EB9751 /* SingleImageFetcher.swift */; }; C44543211CA68DDE00644380 /* VolumeControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = C44543201CA68DDE00644380 /* VolumeControl.swift */; }; - C4768C001CAF2EA100A084F8 /* ConfirmViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4768BFF1CAF2EA100A084F8 /* ConfirmViewController.xib */; }; - C4768C011CAF2EAA00A084F8 /* ConfirmViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4768BFF1CAF2EA100A084F8 /* ConfirmViewController.xib */; }; - C4829FFE1CAEB16C00541D08 /* CameraViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C4829FFD1CAEB16C00541D08 /* CameraViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; C482A0031CAEB18D00541D08 /* ImageFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB50BF01B413E8C009905B9 /* ImageFetcher.swift */; }; C482A0041CAEB18D00541D08 /* SingleImageSaver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40665431C73A47C00EB9751 /* SingleImageSaver.swift */; }; C482A0051CAEB18D00541D08 /* SingleImageFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40665471C73B72D00EB9751 /* SingleImageFetcher.swift */; }; @@ -25,26 +36,42 @@ C482A00B1CAEB18D00541D08 /* UIButtonExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D9BA461CA73163004F70F7 /* UIButtonExtensions.swift */; }; C482A00C1CAEB18D00541D08 /* PhotoLibraryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB50BF91B413E8C009905B9 /* PhotoLibraryViewController.swift */; }; C482A00D1CAEB18D00541D08 /* CameraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF058651B316695008E5592 /* CameraViewController.swift */; }; - C482A00E1CAEB18D00541D08 /* ConfirmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7E6B9A1B429012000E1B14 /* ConfirmViewController.swift */; }; + C482A00E1CAEB18D00541D08 /* CropViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7E6B9A1B429012000E1B14 /* CropViewController.swift */; }; C482A00F1CAEB18D00541D08 /* ImageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB50BEE1B413E8C009905B9 /* ImageCell.swift */; }; C482A0101CAEB18D00541D08 /* PermissionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA5FA3421B3AFA2B00497C62 /* PermissionsView.swift */; }; C482A0111CAEB18D00541D08 /* CameraView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF058671B3175C5008E5592 /* CameraView.swift */; }; C482A0121CAEB18D00541D08 /* CropOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA787F1B1B4326F100B6B86E /* CropOverlay.swift */; }; - C482A0141CAEB1B100541D08 /* CameraView.strings in Resources */ = {isa = PBXBuildFile; fileRef = FA8231371B3BF8F700A837BE /* CameraView.strings */; }; C482A0151CAEB1B100541D08 /* CameraViewAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA5FA3441B3AFEB300497C62 /* CameraViewAssets.xcassets */; }; C484580B1D0AA44400ECDB15 /* UIViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBFE097C1CAF1D1A00A8C637 /* UIViewExtensions.swift */; }; - C484580C1D0AA44400ECDB15 /* CameraViewControllerConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBF7829B1CB2C04300DE3E63 /* CameraViewControllerConstraint.swift */; }; C4D9BA451CA7224B004F70F7 /* PhotoLibraryAuthorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D9BA441CA7224B004F70F7 /* PhotoLibraryAuthorizer.swift */; }; C4D9BA471CA73163004F70F7 /* UIButtonExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D9BA461CA73163004F70F7 /* UIButtonExtensions.swift */; }; - EBF7829C1CB2C04300DE3E63 /* CameraViewControllerConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBF7829B1CB2C04300DE3E63 /* CameraViewControllerConstraint.swift */; }; + E335B4832015ADC7007DC281 /* FilterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E335B4862015ADC7007DC281 /* FilterViewController.xib */; }; + E335B4842015ADC7007DC281 /* FilterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E335B4862015ADC7007DC281 /* FilterViewController.xib */; }; + E33BE71D1F5134C1005842DC /* CIImage+Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = E33BE71B1F5134C1005842DC /* CIImage+Utilities.m */; }; + E33BE71E1F5134C1005842DC /* CIImage+Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = E33BE71B1F5134C1005842DC /* CIImage+Utilities.m */; }; + E33BE71F1F5134C1005842DC /* CIImage+Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = E33BE71C1F5134C1005842DC /* CIImage+Utilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E33BE7271F546920005842DC /* IRLRectangleFeature+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = E33BE7251F546920005842DC /* IRLRectangleFeature+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E33BE7281F546920005842DC /* IRLRectangleFeature+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = E33BE7261F546920005842DC /* IRLRectangleFeature+Extensions.m */; }; + E33BE7291F546920005842DC /* IRLRectangleFeature+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = E33BE7261F546920005842DC /* IRLRectangleFeature+Extensions.m */; }; + E33BE72E1F5494EC005842DC /* CameraViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C4829FFD1CAEB16C00541D08 /* CameraViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E35A24061F509CDC001047FD /* OverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35A24051F509CDC001047FD /* OverlayView.swift */; }; + E35A24071F509CDC001047FD /* OverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35A24051F509CDC001047FD /* OverlayView.swift */; }; + E35A24091F509FBD001047FD /* CGRectExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35A24081F509FBD001047FD /* CGRectExtensions.swift */; }; + E35A240A1F509FBD001047FD /* CGRectExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35A24081F509FBD001047FD /* CGRectExtensions.swift */; }; + E35A240C1F509FFC001047FD /* CGPointExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35A240B1F509FFC001047FD /* CGPointExtensions.swift */; }; + E35A240D1F509FFC001047FD /* CGPointExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35A240B1F509FFC001047FD /* CGPointExtensions.swift */; }; + E35A240F1F50B49A001047FD /* ConfirmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35A240E1F50B49A001047FD /* ConfirmViewController.swift */; }; + E35A24101F50B49A001047FD /* ConfirmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35A240E1F50B49A001047FD /* ConfirmViewController.swift */; }; + E3669CC11F96848D00CCDD01 /* CameraViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E3669CC41F96848D00CCDD01 /* CameraViewController.xib */; }; + E3669CC21F96848D00CCDD01 /* CameraViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E3669CC41F96848D00CCDD01 /* CameraViewController.xib */; }; + E36A37BF1FABBB7E00485FD4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E36A37BE1FABBB7E00485FD4 /* LaunchScreen.storyboard */; }; EBFE097D1CAF1D1A00A8C637 /* UIViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBFE097C1CAF1D1A00A8C637 /* UIViewExtensions.swift */; }; FA52EE0B1B44129B00E16B6F /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA52EE0A1B44129B00E16B6F /* ViewController.xib */; }; FA5FA3431B3AFA2B00497C62 /* PermissionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA5FA3421B3AFA2B00497C62 /* PermissionsView.swift */; }; FA5FA3451B3AFEB300497C62 /* CameraViewAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA5FA3441B3AFEB300497C62 /* CameraViewAssets.xcassets */; }; FA778A411B8319D8005807E7 /* image.jpg in Resources */ = {isa = PBXBuildFile; fileRef = FA778A401B8319D8005807E7 /* image.jpg */; }; FA787F1C1B4326F100B6B86E /* CropOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA787F1B1B4326F100B6B86E /* CropOverlay.swift */; }; - FA7E6B9B1B429012000E1B14 /* ConfirmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7E6B9A1B429012000E1B14 /* ConfirmViewController.swift */; }; - FA8231381B3BF8F700A837BE /* CameraView.strings in Resources */ = {isa = PBXBuildFile; fileRef = FA8231371B3BF8F700A837BE /* CameraView.strings */; }; + FA7E6B9B1B429012000E1B14 /* CropViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7E6B9A1B429012000E1B14 /* CropViewController.swift */; }; FA82313A1B3C296C00A837BE /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8231391B3C296C00A837BE /* Utilities.swift */; }; FAB50BFB1B413E8C009905B9 /* ImageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB50BEE1B413E8C009905B9 /* ImageCell.swift */; }; FAB50BFC1B413E8C009905B9 /* ImageFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB50BF01B413E8C009905B9 /* ImageFetcher.swift */; }; @@ -58,25 +85,47 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + B2357AB01FA50D51003F9ACF /* FilterViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FilterViewController.swift; sourceTree = ""; }; + B2357AB51FA51155003F9ACF /* UIImageView+Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+Filter.h"; sourceTree = ""; }; + B2357AB61FA51155003F9ACF /* UIImageView+Filter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+Filter.m"; sourceTree = ""; }; + B2357AB71FA51156003F9ACF /* UIImage+Filter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Filter.m"; sourceTree = ""; }; + B2357AB81FA51156003F9ACF /* UIImage+Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Filter.h"; sourceTree = ""; }; + BF5862001F625D0F00B406F6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/CameraView.strings; sourceTree = ""; }; + BF5862021F625D1200B406F6 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/CameraView.strings"; sourceTree = ""; }; C40665431C73A47C00EB9751 /* SingleImageSaver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleImageSaver.swift; sourceTree = ""; }; C40665451C73A94100EB9751 /* CameraGlobals.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraGlobals.swift; sourceTree = ""; }; C40665471C73B72D00EB9751 /* SingleImageFetcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleImageFetcher.swift; sourceTree = ""; }; C44543201CA68DDE00644380 /* VolumeControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VolumeControl.swift; sourceTree = ""; }; - C4768BFF1CAF2EA100A084F8 /* ConfirmViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConfirmViewController.xib; sourceTree = ""; }; C4829FFB1CAEB16C00541D08 /* CameraViewController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CameraViewController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C4829FFD1CAEB16C00541D08 /* CameraViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CameraViewController.h; sourceTree = ""; }; C4829FFF1CAEB16C00541D08 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C4D9BA441CA7224B004F70F7 /* PhotoLibraryAuthorizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoLibraryAuthorizer.swift; sourceTree = ""; }; C4D9BA461CA73163004F70F7 /* UIButtonExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIButtonExtensions.swift; sourceTree = ""; }; - EBF7829B1CB2C04300DE3E63 /* CameraViewControllerConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = CameraViewControllerConstraint.swift; sourceTree = ""; tabWidth = 4; }; + E335B4852015ADC7007DC281 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/FilterViewController.xib; sourceTree = ""; }; + E335B4882015ADC9007DC281 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/FilterViewController.strings"; sourceTree = ""; }; + E33BE71B1F5134C1005842DC /* CIImage+Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CIImage+Utilities.m"; sourceTree = ""; }; + E33BE71C1F5134C1005842DC /* CIImage+Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CIImage+Utilities.h"; sourceTree = ""; }; + E33BE7251F546920005842DC /* IRLRectangleFeature+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "IRLRectangleFeature+Extensions.h"; sourceTree = ""; }; + E33BE7261F546920005842DC /* IRLRectangleFeature+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "IRLRectangleFeature+Extensions.m"; sourceTree = ""; }; + E33BE72F1F54955E005842DC /* CameraViewController-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CameraViewController-Bridging-Header.h"; sourceTree = ""; }; + E35A24051F509CDC001047FD /* OverlayView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverlayView.swift; sourceTree = ""; }; + E35A24081F509FBD001047FD /* CGRectExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGRectExtensions.swift; sourceTree = ""; }; + E35A240B1F509FFC001047FD /* CGPointExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGPointExtensions.swift; sourceTree = ""; }; + E35A240E1F50B49A001047FD /* ConfirmViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfirmViewController.swift; sourceTree = ""; }; + E3669CC01F96847E00CCDD01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CropViewController.xib; sourceTree = ""; }; + E3669CC31F96848D00CCDD01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CameraViewController.xib; sourceTree = ""; }; + E3669CC61F96849700CCDD01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ConfirmViewController.xib; sourceTree = ""; }; + E3669CC91F96855500CCDD01 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/CropViewController.strings"; sourceTree = ""; }; + E3669CCB1F96859000CCDD01 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/CameraViewController.strings"; sourceTree = ""; }; + E3669CCD1F96859A00CCDD01 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ConfirmViewController.strings"; sourceTree = ""; }; + E36A37BE1FABBB7E00485FD4 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; EBFE097C1CAF1D1A00A8C637 /* UIViewExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewExtensions.swift; sourceTree = ""; }; FA52EE0A1B44129B00E16B6F /* ViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ViewController.xib; sourceTree = ""; }; FA5FA3421B3AFA2B00497C62 /* PermissionsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PermissionsView.swift; sourceTree = ""; }; FA5FA3441B3AFEB300497C62 /* CameraViewAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = CameraViewAssets.xcassets; sourceTree = ""; }; FA778A401B8319D8005807E7 /* image.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image.jpg; sourceTree = ""; }; FA787F1B1B4326F100B6B86E /* CropOverlay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropOverlay.swift; sourceTree = ""; }; - FA7E6B9A1B429012000E1B14 /* ConfirmViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfirmViewController.swift; sourceTree = ""; }; - FA8231371B3BF8F700A837BE /* CameraView.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = CameraView.strings; sourceTree = ""; }; + FA7E6B9A1B429012000E1B14 /* CropViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropViewController.swift; sourceTree = ""; }; FA8231391B3C296C00A837BE /* Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = ""; tabWidth = 4; }; FAB50BEE1B413E8C009905B9 /* ImageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = ImageCell.swift; sourceTree = ""; tabWidth = 4; }; FAB50BF01B413E8C009905B9 /* ImageFetcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageFetcher.swift; sourceTree = ""; }; @@ -112,6 +161,7 @@ C4829FFC1CAEB16C00541D08 /* CameraViewController */ = { isa = PBXGroup; children = ( + E33BE72F1F54955E005842DC /* CameraViewController-Bridging-Header.h */, C4829FFD1CAEB16C00541D08 /* CameraViewController.h */, C4829FFF1CAEB16C00541D08 /* Info.plist */, ); @@ -123,9 +173,13 @@ children = ( FAB50BF91B413E8C009905B9 /* PhotoLibraryViewController.swift */, FAF058651B316695008E5592 /* CameraViewController.swift */, - FA7E6B9A1B429012000E1B14 /* ConfirmViewController.swift */, - C4768BFF1CAF2EA100A084F8 /* ConfirmViewController.xib */, - EBF7829B1CB2C04300DE3E63 /* CameraViewControllerConstraint.swift */, + E3669CC41F96848D00CCDD01 /* CameraViewController.xib */, + FA7E6B9A1B429012000E1B14 /* CropViewController.swift */, + BF5861F61F613FB800B406F6 /* CropViewController.xib */, + B2357AB01FA50D51003F9ACF /* FilterViewController.swift */, + E335B4862015ADC7007DC281 /* FilterViewController.xib */, + E35A240E1F50B49A001047FD /* ConfirmViewController.swift */, + BF5861FB1F61404C00B406F6 /* ConfirmViewController.xib */, ); path = ViewController; sourceTree = ""; @@ -133,6 +187,7 @@ FAB50BEB1B413E4E009905B9 /* Views */ = { isa = PBXGroup; children = ( + E35A24051F509CDC001047FD /* OverlayView.swift */, FAB50BEE1B413E8C009905B9 /* ImageCell.swift */, FA5FA3421B3AFA2B00497C62 /* PermissionsView.swift */, FAF058671B3175C5008E5592 /* CameraView.swift */, @@ -144,6 +199,12 @@ FAB50C021B4140AB009905B9 /* Utilities */ = { isa = PBXGroup; children = ( + E33BE71B1F5134C1005842DC /* CIImage+Utilities.m */, + E33BE71C1F5134C1005842DC /* CIImage+Utilities.h */, + B2357AB81FA51156003F9ACF /* UIImage+Filter.h */, + B2357AB71FA51156003F9ACF /* UIImage+Filter.m */, + B2357AB51FA51155003F9ACF /* UIImageView+Filter.h */, + B2357AB61FA51155003F9ACF /* UIImageView+Filter.m */, FAB50BF01B413E8C009905B9 /* ImageFetcher.swift */, C40665431C73A47C00EB9751 /* SingleImageSaver.swift */, C40665471C73B72D00EB9751 /* SingleImageFetcher.swift */, @@ -154,6 +215,10 @@ C4D9BA441CA7224B004F70F7 /* PhotoLibraryAuthorizer.swift */, C4D9BA461CA73163004F70F7 /* UIButtonExtensions.swift */, EBFE097C1CAF1D1A00A8C637 /* UIViewExtensions.swift */, + E35A24081F509FBD001047FD /* CGRectExtensions.swift */, + E35A240B1F509FFC001047FD /* CGPointExtensions.swift */, + E33BE7251F546920005842DC /* IRLRectangleFeature+Extensions.h */, + E33BE7261F546920005842DC /* IRLRectangleFeature+Extensions.m */, ); path = Utilities; sourceTree = ""; @@ -183,7 +248,7 @@ FAB50C021B4140AB009905B9 /* Utilities */, FAB50BEA1B413E41009905B9 /* ViewController */, FAB50BEB1B413E4E009905B9 /* Views */, - FA8231371B3BF8F700A837BE /* CameraView.strings */, + BF5862011F625D0F00B406F6 /* CameraView.strings */, FA5FA3441B3AFEB300497C62 /* CameraViewAssets.xcassets */, ); path = ALCameraViewController; @@ -192,6 +257,7 @@ FAF058421B31618D008E5592 /* Supporting Files */ = { isa = PBXGroup; children = ( + E36A37BE1FABBB7E00485FD4 /* LaunchScreen.storyboard */, FAF0584B1B31618D008E5592 /* Images.xcassets */, FAF058431B31618D008E5592 /* Info.plist */, ); @@ -217,7 +283,11 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - C4829FFE1CAEB16C00541D08 /* CameraViewController.h in Headers */, + E33BE7271F546920005842DC /* IRLRectangleFeature+Extensions.h in Headers */, + E33BE71F1F5134C1005842DC /* CIImage+Utilities.h in Headers */, + E33BE72E1F5494EC005842DC /* CameraViewController.h in Headers */, + B255EDB91FA6649300681E70 /* UIImage+Filter.h in Headers */, + B255EDB61FA6648E00681E70 /* UIImageView+Filter.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -272,12 +342,12 @@ TargetAttributes = { C4829FFA1CAEB16C00541D08 = { CreatedOnToolsVersion = 7.3; - LastSwiftMigration = 0800; + LastSwiftMigration = 0830; }; FAF0583E1B31618D008E5592 = { CreatedOnToolsVersion = 6.3.2; - DevelopmentTeam = GAPQH4AM76; - LastSwiftMigration = 0800; + DevelopmentTeam = 3TYX9FV267; + LastSwiftMigration = 0830; ProvisioningStyle = Automatic; }; }; @@ -289,6 +359,7 @@ knownRegions = ( en, Base, + "zh-Hans", ); mainGroup = FAF058361B31618D008E5592; productRefGroup = FAF058401B31618D008E5592 /* Products */; @@ -306,9 +377,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - C482A0141CAEB1B100541D08 /* CameraView.strings in Resources */, + BF5861FF1F625D0F00B406F6 /* CameraView.strings in Resources */, + E3669CC21F96848D00CCDD01 /* CameraViewController.xib in Resources */, + BF5861F91F61404C00B406F6 /* ConfirmViewController.xib in Resources */, C482A0151CAEB1B100541D08 /* CameraViewAssets.xcassets in Resources */, - C4768C011CAF2EAA00A084F8 /* ConfirmViewController.xib in Resources */, + E335B4842015ADC7007DC281 /* FilterViewController.xib in Resources */, + BF5861F41F613FB800B406F6 /* CropViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -316,12 +390,16 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + E3669CC11F96848D00CCDD01 /* CameraViewController.xib in Resources */, FA52EE0B1B44129B00E16B6F /* ViewController.xib in Resources */, - FA8231381B3BF8F700A837BE /* CameraView.strings in Resources */, + BF5861FE1F625D0F00B406F6 /* CameraView.strings in Resources */, FA5FA3451B3AFEB300497C62 /* CameraViewAssets.xcassets in Resources */, FAF0584C1B31618D008E5592 /* Images.xcassets in Resources */, FA778A411B8319D8005807E7 /* image.jpg in Resources */, - C4768C001CAF2EA100A084F8 /* ConfirmViewController.xib in Resources */, + BF5861F31F613FB800B406F6 /* CropViewController.xib in Resources */, + E335B4832015ADC7007DC281 /* FilterViewController.xib in Resources */, + E36A37BF1FABBB7E00485FD4 /* LaunchScreen.storyboard in Resources */, + BF5861F81F61404C00B406F6 /* ConfirmViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -333,19 +411,27 @@ buildActionMask = 2147483647; files = ( C484580B1D0AA44400ECDB15 /* UIViewExtensions.swift in Sources */, - C484580C1D0AA44400ECDB15 /* CameraViewControllerConstraint.swift in Sources */, C482A0031CAEB18D00541D08 /* ImageFetcher.swift in Sources */, + E35A240D1F509FFC001047FD /* CGPointExtensions.swift in Sources */, C482A0041CAEB18D00541D08 /* SingleImageSaver.swift in Sources */, C482A0051CAEB18D00541D08 /* SingleImageFetcher.swift in Sources */, C482A0061CAEB18D00541D08 /* Utilities.swift in Sources */, + E33BE71E1F5134C1005842DC /* CIImage+Utilities.m in Sources */, C482A0071CAEB18D00541D08 /* CameraShot.swift in Sources */, + E35A240A1F509FBD001047FD /* CGRectExtensions.swift in Sources */, + E33BE7291F546920005842DC /* IRLRectangleFeature+Extensions.m in Sources */, C482A0081CAEB18D00541D08 /* CameraGlobals.swift in Sources */, + B255EDB81FA6649000681E70 /* UIImage+Filter.m in Sources */, C482A0091CAEB18D00541D08 /* VolumeControl.swift in Sources */, C482A00A1CAEB18D00541D08 /* PhotoLibraryAuthorizer.swift in Sources */, + E35A24071F509CDC001047FD /* OverlayView.swift in Sources */, + B255EDB51FA6648A00681E70 /* UIImageView+Filter.m in Sources */, + E35A24101F50B49A001047FD /* ConfirmViewController.swift in Sources */, C482A00B1CAEB18D00541D08 /* UIButtonExtensions.swift in Sources */, C482A00C1CAEB18D00541D08 /* PhotoLibraryViewController.swift in Sources */, C482A00D1CAEB18D00541D08 /* CameraViewController.swift in Sources */, - C482A00E1CAEB18D00541D08 /* ConfirmViewController.swift in Sources */, + B255EDBB1FA6674F00681E70 /* FilterViewController.swift in Sources */, + C482A00E1CAEB18D00541D08 /* CropViewController.swift in Sources */, C482A00F1CAEB18D00541D08 /* ImageCell.swift in Sources */, C482A0101CAEB18D00541D08 /* PermissionsView.swift in Sources */, C482A0111CAEB18D00541D08 /* CameraView.swift in Sources */, @@ -358,14 +444,20 @@ buildActionMask = 2147483647; files = ( C44543211CA68DDE00644380 /* VolumeControl.swift in Sources */, - FA7E6B9B1B429012000E1B14 /* ConfirmViewController.swift in Sources */, + FA7E6B9B1B429012000E1B14 /* CropViewController.swift in Sources */, + E35A240F1F50B49A001047FD /* ConfirmViewController.swift in Sources */, FA5FA3431B3AFA2B00497C62 /* PermissionsView.swift in Sources */, FAB50BFC1B413E8C009905B9 /* ImageFetcher.swift in Sources */, - EBF7829C1CB2C04300DE3E63 /* CameraViewControllerConstraint.swift in Sources */, + B255EDB71FA6649000681E70 /* UIImage+Filter.m in Sources */, + E35A24091F509FBD001047FD /* CGRectExtensions.swift in Sources */, FA82313A1B3C296C00A837BE /* Utilities.swift in Sources */, FAB50C001B413E8C009905B9 /* PhotoLibraryViewController.swift in Sources */, + E33BE7281F546920005842DC /* IRLRectangleFeature+Extensions.m in Sources */, + B255EDB41FA6648A00681E70 /* UIImageView+Filter.m in Sources */, FAF0586A1B317894008E5592 /* CameraShot.swift in Sources */, + E35A240C1F509FFC001047FD /* CGPointExtensions.swift in Sources */, FAF058661B316695008E5592 /* CameraViewController.swift in Sources */, + E35A24061F509CDC001047FD /* OverlayView.swift in Sources */, C4D9BA451CA7224B004F70F7 /* PhotoLibraryAuthorizer.swift in Sources */, FAB50BFB1B413E8C009905B9 /* ImageCell.swift in Sources */, EBFE097D1CAF1D1A00A8C637 /* UIViewExtensions.swift in Sources */, @@ -373,20 +465,71 @@ FAF058471B31618D008E5592 /* ViewController.swift in Sources */, FAF058681B3175C5008E5592 /* CameraView.swift in Sources */, C4D9BA471CA73163004F70F7 /* UIButtonExtensions.swift in Sources */, + B2357AB21FA50D51003F9ACF /* FilterViewController.swift in Sources */, C40665461C73A94100EB9751 /* CameraGlobals.swift in Sources */, FAF058451B31618D008E5592 /* AppDelegate.swift in Sources */, C40665441C73A47C00EB9751 /* SingleImageSaver.swift in Sources */, + E33BE71D1F5134C1005842DC /* CIImage+Utilities.m in Sources */, FA787F1C1B4326F100B6B86E /* CropOverlay.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + BF5861F61F613FB800B406F6 /* CropViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + E3669CC01F96847E00CCDD01 /* Base */, + E3669CC91F96855500CCDD01 /* zh-Hans */, + ); + name = CropViewController.xib; + sourceTree = ""; + }; + BF5861FB1F61404C00B406F6 /* ConfirmViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + E3669CC61F96849700CCDD01 /* Base */, + E3669CCD1F96859A00CCDD01 /* zh-Hans */, + ); + name = ConfirmViewController.xib; + sourceTree = ""; + }; + BF5862011F625D0F00B406F6 /* CameraView.strings */ = { + isa = PBXVariantGroup; + children = ( + BF5862001F625D0F00B406F6 /* en */, + BF5862021F625D1200B406F6 /* zh-Hans */, + ); + name = CameraView.strings; + sourceTree = ""; + }; + E335B4862015ADC7007DC281 /* FilterViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + E335B4852015ADC7007DC281 /* Base */, + E335B4882015ADC9007DC281 /* zh-Hans */, + ); + name = FilterViewController.xib; + sourceTree = ""; + }; + E3669CC41F96848D00CCDD01 /* CameraViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + E3669CC31F96848D00CCDD01 /* Base */, + E3669CCB1F96859000CCDD01 /* zh-Hans */, + ); + name = CameraViewController.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ C482A0011CAEB16C00541D08 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; + CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; @@ -394,13 +537,19 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); INFOPLIST_FILE = CameraViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.zero.CameraViewController; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -411,19 +560,25 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; + CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); INFOPLIST_FILE = CameraViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.zero.CameraViewController; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_VERSION = 3.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -434,6 +589,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -482,6 +638,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -524,13 +681,20 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = GAPQH4AM76; + DEVELOPMENT_TEAM = 3TYX9FV267; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); INFOPLIST_FILE = "Example/Supporting Files/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.zero.CameraViewController; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "CameraViewController/CameraViewController-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; }; name = Debug; @@ -540,13 +704,19 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = GAPQH4AM76; + DEVELOPMENT_TEAM = 3TYX9FV267; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); INFOPLIST_FILE = "Example/Supporting Files/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.zero.CameraViewController; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "CameraViewController/CameraViewController-Bridging-Header.h"; SWIFT_VERSION = 3.0; }; name = Release; diff --git a/ALCameraViewController/CameraViewAssets.xcassets/Line.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/Line.imageset/Contents.json new file mode 100644 index 00000000..466a19fe --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/Line.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Line.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/Line.imageset/Line.pdf b/ALCameraViewController/CameraViewAssets.xcassets/Line.imageset/Line.pdf new file mode 100644 index 00000000..72e0398b Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/Line.imageset/Line.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/anchorButton.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/anchorButton.imageset/Contents.json new file mode 100644 index 00000000..73caa1db --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/anchorButton.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "anchorbutton.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/anchorButton.imageset/anchorbutton.pdf b/ALCameraViewController/CameraViewAssets.xcassets/anchorButton.imageset/anchorbutton.pdf new file mode 100644 index 00000000..4821677b Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/anchorButton.imageset/anchorbutton.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/Contents.json deleted file mode 100644 index 174a0b3c..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "cameraButton.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "cameraButton@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "cameraButton@3x.png" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton.png b/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton.png deleted file mode 100644 index 82fe0866..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton@2x.png deleted file mode 100644 index 3687d024..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton@3x.png deleted file mode 100644 index 47f05806..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/cameraButton.imageset/cameraButton@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/Contents.json deleted file mode 100644 index 6c78aba0..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "cameraButtonHighlighted.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "cameraButtonHighlighted@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "cameraButtonHighlighted@3x.png" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted.png b/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted.png deleted file mode 100644 index c6a63711..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted@2x.png deleted file mode 100644 index 4792c852..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted@3x.png deleted file mode 100644 index 089430d9..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/cameraButtonHighlighted.imageset/cameraButtonHighlighted@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_capture.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_capture.imageset/Contents.json new file mode 100644 index 00000000..20cf3949 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_capture.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_capture.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_capture.imageset/camera_capture.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_capture.imageset/camera_capture.pdf new file mode 100644 index 00000000..af9589d5 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_capture.imageset/camera_capture.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_capture_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_capture_highlight.imageset/Contents.json new file mode 100644 index 00000000..a7cd7e89 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_capture_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_capture_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_capture_highlight.imageset/camera_capture_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_capture_highlight.imageset/camera_capture_highlight.pdf new file mode 100644 index 00000000..3ec17754 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_capture_highlight.imageset/camera_capture_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_close.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_close.imageset/Contents.json new file mode 100644 index 00000000..a81a8d20 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_close.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_cancel.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_close.imageset/camera_cancel.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_close.imageset/camera_cancel.pdf new file mode 100644 index 00000000..de6323fb Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_close.imageset/camera_cancel.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_close_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_close_highlight.imageset/Contents.json new file mode 100644 index 00000000..83e800a0 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_close_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_cancel_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_close_highlight.imageset/camera_cancel_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_close_highlight.imageset/camera_cancel_highlight.pdf new file mode 100644 index 00000000..6d7d0d7e Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_close_highlight.imageset/camera_cancel_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto.imageset/Contents.json new file mode 100644 index 00000000..12197fca --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_flash_auto.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto.imageset/camera_flash_auto.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto.imageset/camera_flash_auto.pdf new file mode 100644 index 00000000..2c2dcdf5 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto.imageset/camera_flash_auto.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto_highlight.imageset/Contents.json new file mode 100644 index 00000000..57da47b0 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_flash_auto_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto_highlight.imageset/camera_flash_auto_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto_highlight.imageset/camera_flash_auto_highlight.pdf new file mode 100644 index 00000000..821da0e5 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_auto_highlight.imageset/camera_flash_auto_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off.imageset/Contents.json new file mode 100644 index 00000000..8fc3a1f0 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_flash_off.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off.imageset/camera_flash_off.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off.imageset/camera_flash_off.pdf new file mode 100644 index 00000000..5cd071ff Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off.imageset/camera_flash_off.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off_highlight.imageset/Contents.json new file mode 100644 index 00000000..3270efa2 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_flash_off_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off_highlight.imageset/camera_flash_off_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off_highlight.imageset/camera_flash_off_highlight.pdf new file mode 100644 index 00000000..6ec3b5cc Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_off_highlight.imageset/camera_flash_off_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on.imageset/Contents.json new file mode 100644 index 00000000..770d95c7 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_flash_on.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on.imageset/camera_flash_on.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on.imageset/camera_flash_on.pdf new file mode 100644 index 00000000..307e42a0 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on.imageset/camera_flash_on.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on_highlight.imageset/Contents.json new file mode 100644 index 00000000..8d578b28 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_flash_on_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on_highlight.imageset/camera_flash_on_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on_highlight.imageset/camera_flash_on_highlight.pdf new file mode 100644 index 00000000..cc7ee3fd Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_flash_on_highlight.imageset/camera_flash_on_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_library.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_library.imageset/Contents.json new file mode 100644 index 00000000..6ed011d6 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_library.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_library.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_library.imageset/camera_library.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_library.imageset/camera_library.pdf new file mode 100644 index 00000000..c76ff6d9 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_library.imageset/camera_library.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_library_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_library_highlight.imageset/Contents.json new file mode 100644 index 00000000..6a2a3037 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_library_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_library_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_library_highlight.imageset/camera_library_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_library_highlight.imageset/camera_library_highlight.pdf new file mode 100644 index 00000000..37b0fa67 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_library_highlight.imageset/camera_library_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_swap.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_swap.imageset/Contents.json new file mode 100644 index 00000000..9acfb710 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_swap.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_switch.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_swap.imageset/camera_switch.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_swap.imageset/camera_switch.pdf new file mode 100644 index 00000000..1996a378 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_swap.imageset/camera_switch.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_swap_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/camera_swap_highlight.imageset/Contents.json new file mode 100644 index 00000000..ae5764f0 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/camera_swap_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "camera_switch_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/camera_swap_highlight.imageset/camera_switch_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/camera_swap_highlight.imageset/camera_switch_highlight.pdf new file mode 100644 index 00000000..1e69108c Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/camera_swap_highlight.imageset/camera_switch_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/Contents.json deleted file mode 100644 index 71896cea..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "closeButton.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "closeButton@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "closeButton@3x.png" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton.png b/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton.png deleted file mode 100644 index 545c364f..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton@2x.png deleted file mode 100644 index 50e44fc6..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton@3x.png deleted file mode 100644 index 45bf9bac..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/closeButton.imageset/closeButton@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/Contents.json deleted file mode 100644 index b1455e12..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "confirmButton.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "confirmButton@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "confirmButton@3x.png" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton.png b/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton.png deleted file mode 100644 index 4b68cf57..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton@2x.png deleted file mode 100644 index c0a54480..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton@3x.png deleted file mode 100644 index fc1104cb..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/confirmButton.imageset/confirmButton@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_a4_paper_normal.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/crop_a4_paper_normal.imageset/Contents.json new file mode 100644 index 00000000..9979076c --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/crop_a4_paper_normal.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "crop_a4.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_a4_paper_normal.imageset/crop_a4.pdf b/ALCameraViewController/CameraViewAssets.xcassets/crop_a4_paper_normal.imageset/crop_a4.pdf new file mode 100644 index 00000000..7c78dc62 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/crop_a4_paper_normal.imageset/crop_a4.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_detect_border_normal.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/crop_detect_border_normal.imageset/Contents.json new file mode 100644 index 00000000..8df73b6e --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/crop_detect_border_normal.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "crop_border.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_detect_border_normal.imageset/crop_border.pdf b/ALCameraViewController/CameraViewAssets.xcassets/crop_detect_border_normal.imageset/crop_border.pdf new file mode 100644 index 00000000..ac464cd9 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/crop_detect_border_normal.imageset/crop_border.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_full_image_normal.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/crop_full_image_normal.imageset/Contents.json new file mode 100644 index 00000000..57ce8b24 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/crop_full_image_normal.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "crop_full.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_full_image_normal.imageset/crop_full.pdf b/ALCameraViewController/CameraViewAssets.xcassets/crop_full_image_normal.imageset/crop_full.pdf new file mode 100644 index 00000000..39921d5c Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/crop_full_image_normal.imageset/crop_full.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_no_statusbar_normal.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/crop_no_statusbar_normal.imageset/Contents.json new file mode 100644 index 00000000..7c31f322 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/crop_no_statusbar_normal.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "crop_screenshot.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_no_statusbar_normal.imageset/crop_screenshot.pdf b/ALCameraViewController/CameraViewAssets.xcassets/crop_no_statusbar_normal.imageset/crop_screenshot.pdf new file mode 100644 index 00000000..02b454ed Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/crop_no_statusbar_normal.imageset/crop_screenshot.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_square_normal.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/crop_square_normal.imageset/Contents.json new file mode 100644 index 00000000..657f8892 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/crop_square_normal.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "crop_square.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/crop_square_normal.imageset/crop_square.pdf b/ALCameraViewController/CameraViewAssets.xcassets/crop_square_normal.imageset/crop_square.pdf new file mode 100644 index 00000000..086a906d Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/crop_square_normal.imageset/crop_square.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_bw.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/filter_bw.imageset/Contents.json new file mode 100644 index 00000000..efcc62f2 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/filter_bw.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "filter_bw.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_bw.imageset/filter_bw.pdf b/ALCameraViewController/CameraViewAssets.xcassets/filter_bw.imageset/filter_bw.pdf new file mode 100644 index 00000000..aa6f0c2e Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/filter_bw.imageset/filter_bw.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_bw_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/filter_bw_highlight.imageset/Contents.json new file mode 100644 index 00000000..fc25e758 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/filter_bw_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "filter_bw_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_bw_highlight.imageset/filter_bw_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/filter_bw_highlight.imageset/filter_bw_highlight.pdf new file mode 100644 index 00000000..cb065a0c Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/filter_bw_highlight.imageset/filter_bw_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_color.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/filter_color.imageset/Contents.json new file mode 100644 index 00000000..33dc6740 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/filter_color.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "filter_color.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_color.imageset/filter_color.pdf b/ALCameraViewController/CameraViewAssets.xcassets/filter_color.imageset/filter_color.pdf new file mode 100644 index 00000000..4a3b9b07 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/filter_color.imageset/filter_color.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_color_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/filter_color_highlight.imageset/Contents.json new file mode 100644 index 00000000..11f3b8ef --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/filter_color_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "filter_color_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_color_highlight.imageset/filter_color_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/filter_color_highlight.imageset/filter_color_highlight.pdf new file mode 100644 index 00000000..fbe8de37 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/filter_color_highlight.imageset/filter_color_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure.imageset/Contents.json new file mode 100644 index 00000000..6abfd966 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "filter_exposure.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure.imageset/filter_exposure.pdf b/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure.imageset/filter_exposure.pdf new file mode 100644 index 00000000..911e5a2d Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure.imageset/filter_exposure.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure_highlight.imageset/Contents.json new file mode 100644 index 00000000..74d78f33 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "filter_exposure_hightlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure_highlight.imageset/filter_exposure_hightlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure_highlight.imageset/filter_exposure_hightlight.pdf new file mode 100644 index 00000000..5609d0e1 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/filter_exposure_highlight.imageset/filter_exposure_hightlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_gray.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/filter_gray.imageset/Contents.json new file mode 100644 index 00000000..3f35ed86 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/filter_gray.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "filter_gray.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_gray.imageset/filter_gray.pdf b/ALCameraViewController/CameraViewAssets.xcassets/filter_gray.imageset/filter_gray.pdf new file mode 100644 index 00000000..83b5f750 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/filter_gray.imageset/filter_gray.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_gray_highlight.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/filter_gray_highlight.imageset/Contents.json new file mode 100644 index 00000000..cf9bafb5 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/filter_gray_highlight.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "filter_gray_highlight.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/filter_gray_highlight.imageset/filter_gray_highlight.pdf b/ALCameraViewController/CameraViewAssets.xcassets/filter_gray_highlight.imageset/filter_gray_highlight.pdf new file mode 100644 index 00000000..7d41943a Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/filter_gray_highlight.imageset/filter_gray_highlight.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/Contents.json deleted file mode 100644 index 6433d028..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "flashAutoIcon.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "flashAutoIcon@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "flashAutoIcon@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon.png b/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon.png deleted file mode 100644 index bd372e5b..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon@2x.png deleted file mode 100644 index 0b81037c..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon@3x.png deleted file mode 100644 index f780e169..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashAutoIcon.imageset/flashAutoIcon@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/Contents.json deleted file mode 100644 index 11564017..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "flashOffIcon.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "flashOffIcon@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "flashOffIcon@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon.png b/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon.png deleted file mode 100644 index 6c1377f8..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon@2x.png deleted file mode 100644 index 41f9e2c0..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon@3x.png deleted file mode 100644 index 8d9de324..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashOffIcon.imageset/flashOffIcon@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/Contents.json deleted file mode 100644 index 4a2a5a59..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "flashOnIcon.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "flashOnIcon@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "flashOnIcon@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon.png b/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon.png deleted file mode 100644 index 227ccce9..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon@2x.png deleted file mode 100644 index 5eb993a5..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon@3x.png deleted file mode 100644 index 2278010b..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/flashOnIcon.imageset/flashOnIcon@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/Contents.json deleted file mode 100644 index b0c8a6af..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "libraryButton.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "libraryButton@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "libraryButton@3x.png" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton.png deleted file mode 100644 index 3890e36e..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton@2x.png deleted file mode 100644 index 35d2aeba..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton@3x.png deleted file mode 100644 index ffe3c797..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryButton.imageset/libraryButton@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/Contents.json index 6ac29af6..b35ea032 100644 --- a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/Contents.json +++ b/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/Contents.json @@ -2,18 +2,7 @@ "images" : [ { "idiom" : "universal", - "scale" : "1x", - "filename" : "libraryCancel.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "libraryCancel@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "libraryCancel@3x.png" + "filename" : "libraryCancel.pdf" } ], "info" : { diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel.pdf b/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel.pdf new file mode 100644 index 00000000..88b8b0e4 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel.png deleted file mode 100644 index a7205d04..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel@2x.png deleted file mode 100644 index e6a9a9e8..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel@3x.png deleted file mode 100644 index 74b4b6f1..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryCancel.imageset/libraryCancel@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/Contents.json index 064ab6a6..3a092e5c 100644 --- a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/Contents.json +++ b/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/Contents.json @@ -2,18 +2,7 @@ "images" : [ { "idiom" : "universal", - "scale" : "1x", - "filename" : "libraryConfirm.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "libraryConfirm@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "libraryConfirm@3x.png" + "filename" : "libraryConfirm.pdf" } ], "info" : { diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm.pdf b/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm.pdf new file mode 100644 index 00000000..fcf9f348 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm.png deleted file mode 100644 index b4281100..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm@2x.png deleted file mode 100644 index 377d7cd2..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm@3x.png deleted file mode 100644 index a7f0959b..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/libraryConfirm.imageset/libraryConfirm@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/nav_back.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/nav_back.imageset/Contents.json new file mode 100644 index 00000000..910d7a3e --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/nav_back.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "nav_back.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/nav_back.imageset/nav_back.pdf b/ALCameraViewController/CameraViewAssets.xcassets/nav_back.imageset/nav_back.pdf new file mode 100644 index 00000000..8033d490 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/nav_back.imageset/nav_back.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/Contents.json index dbd696ed..c6040a9c 100644 --- a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/Contents.json +++ b/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/Contents.json @@ -2,18 +2,7 @@ "images" : [ { "idiom" : "universal", - "scale" : "1x", - "filename" : "retakeButton.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "retakeButton@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "retakeButton@3x.png" + "filename" : "retakeButton.pdf" } ], "info" : { diff --git a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton.pdf b/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton.pdf new file mode 100644 index 00000000..88b8b0e4 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton.png b/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton.png deleted file mode 100644 index c46c955c..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton@2x.png deleted file mode 100644 index 39da6fce..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton@3x.png deleted file mode 100644 index 391c7670..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/retakeButton.imageset/retakeButton@3x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/separator.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/separator.imageset/Contents.json new file mode 100644 index 00000000..0ebd95b8 --- /dev/null +++ b/ALCameraViewController/CameraViewAssets.xcassets/separator.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "separator.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/separator.imageset/separator.pdf b/ALCameraViewController/CameraViewAssets.xcassets/separator.imageset/separator.pdf new file mode 100644 index 00000000..8a2c09b2 Binary files /dev/null and b/ALCameraViewController/CameraViewAssets.xcassets/separator.imageset/separator.pdf differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/Contents.json b/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/Contents.json deleted file mode 100644 index a9a94654..00000000 --- a/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "swapButton.png" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "swapButton@2x.png" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "swapButton@3x.png" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton.png b/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton.png deleted file mode 100644 index 137243eb..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton@2x.png b/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton@2x.png deleted file mode 100644 index 7bdba075..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton@2x.png and /dev/null differ diff --git a/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton@3x.png b/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton@3x.png deleted file mode 100644 index bcbd31ee..00000000 Binary files a/ALCameraViewController/CameraViewAssets.xcassets/swapButton.imageset/swapButton@3x.png and /dev/null differ diff --git a/ALCameraViewController/Utilities/CGPointExtensions.swift b/ALCameraViewController/Utilities/CGPointExtensions.swift new file mode 100644 index 00000000..32f00ec3 --- /dev/null +++ b/ALCameraViewController/Utilities/CGPointExtensions.swift @@ -0,0 +1,42 @@ +// +// CGPointExtensions.swift +// ALCameraViewController +// +// Created by Zhu Wu on 8/25/17. +// Copyright © 2017 zero. All rights reserved. +// + +import Foundation + +extension CGPoint { + internal func translate(_ dx: CGFloat, dy: CGFloat) -> CGPoint { + return CGPoint(x: self.x+dx, y: self.y+dy) + } + + internal func transform(_ t: CGAffineTransform) -> CGPoint { + return self.applying(t) + } + + internal func transform(_ t: CATransform3D) -> CGPoint { + return self.applying(CATransform3DGetAffineTransform(t)) + } + + internal func distance(_ b: CGPoint) -> CGFloat { + return sqrt(pow(self.x - b.x, 2) + pow(self.y - b.y, 2)) + } + + internal func cgPointIn(_ ciSize: CGSize) -> CGPoint { + var t = CGAffineTransform(scaleX: 1, y: -1) + t = t.translatedBy(x: 0, y: -ciSize.height) + + return self.applying(t) + } + + internal func ciPointIn(_ cgSize: CGSize) -> CGPoint { + var t = CGAffineTransform(scaleX: 1, y: -1) + t = t.translatedBy(x: 0, y: -cgSize.height) + + return self.applying(t) + } + +} diff --git a/ALCameraViewController/Utilities/CGRectExtensions.swift b/ALCameraViewController/Utilities/CGRectExtensions.swift new file mode 100644 index 00000000..b883467f --- /dev/null +++ b/ALCameraViewController/Utilities/CGRectExtensions.swift @@ -0,0 +1,34 @@ +// +// CGRectExtensions.swift +// ALCameraViewController +// +// Created by Zhu Wu on 8/25/17. +// Copyright © 2017 zero. All rights reserved. +// + +import Foundation + +extension CGRect { + internal var topLeft: CGPoint { + return self.origin + } + internal var topRight: CGPoint { + return self.origin.translate(self.size.width, dy: 0) + } + internal var bottomLeft: CGPoint { + return self.origin.translate(0, dy: self.size.height) + } + internal var bottomRight: CGPoint { + return self.origin.translate(self.size.width, dy: self.size.height) + } + internal var center: CGPoint { + return CGPoint(x: origin.x + size.width/2, y: origin.y + size.height/2) + } + internal var bounds: CGRect { + return CGRect(origin: CGPoint.zero, size: size) + } + init(center: CGPoint, size: CGSize) { + self.init(x: center.x - size.width/2, y: center.y - size.height/2, width: size.width, height: size.height) + } +} + diff --git a/ALCameraViewController/Utilities/CIImage+Utilities.h b/ALCameraViewController/Utilities/CIImage+Utilities.h new file mode 100644 index 00000000..f6743b26 --- /dev/null +++ b/ALCameraViewController/Utilities/CIImage+Utilities.h @@ -0,0 +1,35 @@ +// +// CIImage+Utilities.h +// +// Modified by Denis Martin on 12/07/2015 +// Copyright (c) 2015 iRLMobile. All rights reserved. +// Based on IPDFCameraViewController: https://github.com/mmackh/IPDFCameraViewController/tree/master/IPDFCameraViewController +// Copyright (c) 2015 mackh ag. All rights reserved. +// + +@import UIKit; +@import CoreImage; + +@class IRLRectangleFeature; +@protocol IRLRectangleFeatureProtocol; + +@interface CIImage (Utilities) + ++ (CIImage *)imageGradientImage:(CGFloat)threshold; + +- (UIImage*)makeUIImageWithContext:(CIContext*)context; +- (UIImage *)orientationCorrecterUIImage; + +// Filters +- (CIImage *)filteredImageUsingUltraContrastWithGradient:(CIImage *)gradient ; +- (CIImage *)filteredImageUsingEnhanceFilter ; +- (CIImage *)filteredImageUsingContrastFilter ; + +- (CIImage *)cropBordersWithMargin:(CGFloat)margin; +- (CIImage *)correctPerspectiveWithCGPoints:(NSArray*)points; +- (CIImage *)drawHighlightOverlayWithcolor:(UIColor*)color CIRectangleFeature:(id)rectangle; +- (CIImage *)drawCenterOverlayWithColor:(UIColor*)color point:(CGPoint)point; +- (CIImage *)drawFocusOverlayWithColor:(UIColor*)color point:(CGPoint)point amplitude:(CGFloat)amplitude; + +@end + diff --git a/ALCameraViewController/Utilities/CIImage+Utilities.m b/ALCameraViewController/Utilities/CIImage+Utilities.m new file mode 100644 index 00000000..92964856 --- /dev/null +++ b/ALCameraViewController/Utilities/CIImage+Utilities.m @@ -0,0 +1,269 @@ +// +// CIImage+Utilities.m +// +// Modified by Denis Martin on 12/07/2015 +// Copyright (c) 2015 iRLMobile. All rights reserved. +// Based on IPDFCameraViewController: https://github.com/mmackh/IPDFCameraViewController/tree/master/IPDFCameraViewController +// Copyright (c) 2015 mackh ag. All rights reserved. +// + +#import "CIImage+Utilities.h" +#import "IRLRectangleFeature+Extensions.h" + +@implementation CIImage (Utilities) + + ++ (CIImage *)imageGradientImage:(CGFloat)threshold { + CGSize size = CGSizeMake(256.0, 1.0); + CGRect r = CGRectZero; + r.size = size; + CGRect copy = r; + UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); + + int points = 200; + [[UIColor whiteColor] setFill]; + [[UIBezierPath bezierPathWithRect:r] fill]; + r.size.width = r.size.width * threshold; + for (int i=0;i)rectangle { + + // Create the Overlay + CIImage *image = self; + CIColor *ciColor = [[CIColor alloc] initWithColor:color]; + CIImage *overlay = [CIImage imageWithColor:ciColor]; + + overlay = [overlay imageByCroppingToRect:image.extent]; + + overlay = [overlay imageByApplyingFilter:@"CIPerspectiveTransformWithExtent" + withInputParameters:@{ + @"inputExtent" : [CIVector vectorWithCGRect:image.extent], + @"inputTopLeft" : [CIVector vectorWithCGPoint:rectangle.topLeft], + @"inputTopRight" : [CIVector vectorWithCGPoint:rectangle.topRight], + @"inputBottomLeft" : [CIVector vectorWithCGPoint:rectangle.bottomLeft], + @"inputBottomRight" : [CIVector vectorWithCGPoint:rectangle.bottomRight] + }]; + + return [overlay imageByCompositingOverImage:image]; +} + +- (CIImage *)drawCenterOverlayWithColor:(UIColor*)color + point:(CGPoint)point { + + // Create the Overlay + CIImage *image = self; + CIColor *ciColor = [[CIColor alloc] initWithColor:color]; + CIImage *overlay = [CIImage imageWithColor:ciColor]; + overlay = [overlay imageByCroppingToRect:image.extent]; + + overlay = [overlay imageByApplyingFilter:@"CIPerspectiveTransformWithExtent" + withInputParameters:@{ + @"inputExtent" : [CIVector vectorWithCGRect:image.extent], + @"inputTopLeft" : [CIVector vectorWithCGPoint:CGPointMake(point.x-5, point.y-5)], + @"inputTopRight" : [CIVector vectorWithCGPoint:CGPointMake(point.x+5, point.y-5)], + @"inputBottomLeft" : [CIVector vectorWithCGPoint:CGPointMake(point.x-5, point.y+5)], + @"inputBottomRight" : [CIVector vectorWithCGPoint:CGPointMake(point.x+5, point.y+5)] + }]; + + return [overlay imageByCompositingOverImage:image]; +} + +- (CIImage *)drawFocusOverlayWithColor:(UIColor*)color + point:(CGPoint)point + amplitude:(CGFloat)amplitude +{ + + // Create the Overlay + CIImage *image = self; + CIColor *ciColor = [[CIColor alloc] initWithColor:color]; + CIImage *overlay = [CIImage imageWithColor:ciColor]; + overlay = [overlay imageByCroppingToRect:image.extent]; + + overlay = [overlay imageByApplyingFilter:@"CIPerspectiveTransformWithExtent" + withInputParameters:@{ + @"inputExtent" : [CIVector vectorWithCGRect:image.extent], + @"inputTopLeft" : [CIVector vectorWithCGPoint:CGPointMake(point.x-amplitude, point.y-amplitude)], + @"inputTopRight" : [CIVector vectorWithCGPoint:CGPointMake(point.x+amplitude, point.y-amplitude)], + @"inputBottomLeft" : [CIVector vectorWithCGPoint:CGPointMake(point.x-amplitude, point.y+amplitude)], + @"inputBottomRight" : [CIVector vectorWithCGPoint:CGPointMake(point.x+amplitude, point.y+amplitude)] + }]; + + return [overlay imageByCompositingOverImage:image]; +} + + + +@end + diff --git a/ALCameraViewController/Utilities/IRLRectangleFeature+Extensions.h b/ALCameraViewController/Utilities/IRLRectangleFeature+Extensions.h new file mode 100644 index 00000000..ba1e8538 --- /dev/null +++ b/ALCameraViewController/Utilities/IRLRectangleFeature+Extensions.h @@ -0,0 +1,32 @@ +// +// IRLRectangleFeatureExtensions.h +// ALCameraViewController +// +// Created by Zhu Wu on 8/28/17. +// Copyright © 2017 zero. All rights reserved. +// + +@import UIKit; +@import CoreImage; + +@protocol IRLRectangleFeatureProtocol +@property (readonly) CGPoint topLeft; +@property (readonly) CGPoint topRight; +@property (readonly) CGPoint bottomLeft; +@property (readonly) CGPoint bottomRight; +@end + +@interface CIRectangleFeature() +@end + + +@interface IRLRectangleFeature : CIFeature +@property (readwrite) CGPoint topLeft; +@property (readwrite) CGPoint topRight; +@property (readwrite) CGPoint bottomLeft; +@property (readwrite) CGPoint bottomRight; +@end + +@interface IRLRectangleFeature (IRLRectangleFeatureExtensions) + +@end diff --git a/ALCameraViewController/Utilities/IRLRectangleFeature+Extensions.m b/ALCameraViewController/Utilities/IRLRectangleFeature+Extensions.m new file mode 100644 index 00000000..cee57e70 --- /dev/null +++ b/ALCameraViewController/Utilities/IRLRectangleFeature+Extensions.m @@ -0,0 +1,13 @@ +// +// IRLRectangleFeatureExtensions.m +// ALCameraViewController +// +// Created by Zhu Wu on 8/28/17. +// Copyright © 2017 zero. All rights reserved. +// + +#import "IRLRectangleFeature+Extensions.h" + +@implementation IRLRectangleFeature + +@end diff --git a/ALCameraViewController/Utilities/UIButtonExtensions.swift b/ALCameraViewController/Utilities/UIButtonExtensions.swift index 8294c5ad..1c3f5cbf 100644 --- a/ALCameraViewController/Utilities/UIButtonExtensions.swift +++ b/ALCameraViewController/Utilities/UIButtonExtensions.swift @@ -52,3 +52,46 @@ extension UIButton { } } +extension UIBarButtonItem { + + private struct AssociatedKeys { + static var ActionKey = "ActionKey" + } + + private class ActionWrapper { + let action: ButtonAction + init(action: @escaping ButtonAction) { + self.action = action + } + } + + var itemAction: ButtonAction? { + set(newValue) { + target = nil + action = nil + var wrapper: ActionWrapper? = nil + if let newValue = newValue { + wrapper = ActionWrapper(action: newValue) + target = self + action = #selector(performAction) + } + + objc_setAssociatedObject(self, &AssociatedKeys.ActionKey, wrapper, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + } + get { + guard let wrapper = objc_getAssociatedObject(self, &AssociatedKeys.ActionKey) as? ActionWrapper else { + return nil + } + + return wrapper.action + } + } + + func performAction() { + guard let action = itemAction else { + return + } + + action() + } +} diff --git a/ALCameraViewController/Utilities/UIImage+Filter.h b/ALCameraViewController/Utilities/UIImage+Filter.h new file mode 100755 index 00000000..0da00061 --- /dev/null +++ b/ALCameraViewController/Utilities/UIImage+Filter.h @@ -0,0 +1,45 @@ +// +// UIImage+Filter.h +// Updates +// +// Created by Nebojsa Petrovic on 4/16/13. +// Copyright (c) 2013 Nebojsa Petrovic. All rights reserved. +// + +#import + +typedef enum { + ImageFilterPresetOriginal = 0, + ImageFilterPresetBlackAndWhite, + ImageFilterPresetEnhanceColor, + ImageFilterPresetEnhanceExposure, + ImageFilterPresetGrayScale +} ImageFilterPreset; + +@interface UIImage (Filter) + +/* + Asynchronously applies 'filter' to the target image and + returns the filtered image in the block. + The target image remains unchanged. + */ +- (void)applyFilter:(CIFilter *)filter + completion:(void (^)(UIImage *filteredImage))completionBlock; + +/* + Returns a UIImage from the filter. + */ +- (UIImage *)imageWithFilter:(CIFilter *)filter; + +/* + Returns a UIImage from a filter preset + */ +- (UIImage *)imageWithFilterPreset:(ImageFilterPreset)preset intensity:(float)intensity; + +/* + Returns a filter using a common preset, and intensity value, ranging from 0 to 1 + */ +- (CIFilter *)filterWithPreset:(ImageFilterPreset)preset; +- (CIFilter *)filterWithPreset:(ImageFilterPreset)preset intensity:(float)intensity; + +@end diff --git a/ALCameraViewController/Utilities/UIImage+Filter.m b/ALCameraViewController/Utilities/UIImage+Filter.m new file mode 100755 index 00000000..094fe45f --- /dev/null +++ b/ALCameraViewController/Utilities/UIImage+Filter.m @@ -0,0 +1,241 @@ +// +// UIImage+Filter.m +// Updates +// +// Created by Nebojsa Petrovic on 4/16/13. +// Copyright (c) 2013 Nebojsa Petrovic. All rights reserved. +// + +#import "UIImage+Filter.h" + +@interface ValueRange : NSObject + +@property(nonatomic) float low; +@property(nonatomic) float high; + +- (id)initWithLow:(float)low high:(float)high; +- (NSNumber*)valueWithIntensity:(float)intensity; ++ (id)valueWithLow:(float)low high:(float)high; + +@end + + +@implementation ValueRange + ++ (id)valueWithLow:(float)low high:(float)high { + return [[self alloc] initWithLow:low high:high]; +} + +- (id)initWithLow:(float)low high:(float)high { + if ( self = [super init] ) { + self.low = low; + self.high = high; + } + + return self; +} + +- (NSNumber*)valueWithIntensity:(float)intensity { + return [NSNumber numberWithFloat:self.low + (self.high-self.low)*intensity]; +} +@end + + +@implementation UIImage (Filter) + +- (void)applyFilter:(CIFilter *)filter + completion:(void (^)(UIImage *filteredImage))completionBlock { + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + CIContext *context = [CIContext contextWithOptions:nil]; + CIImage *outputImage = filter.outputImage; + CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]]; + UIImage *newImg = [UIImage imageWithCGImage:cgimg]; + CGImageRelease(cgimg); + + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(newImg); + }); + }); + +} + +- (UIImage *)imageWithFilter:(CIFilter *)filter { + CIContext *context = [CIContext contextWithOptions:nil]; + CIImage *outputImage = filter.outputImage; + CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]]; + UIImage *newImg = [UIImage imageWithCGImage:cgimg]; + CGImageRelease(cgimg); + return newImg; +} + +- (UIImage *)imageWithFilterPreset:(ImageFilterPreset)preset { + return [self imageWithFilterPreset:preset intensity:0.3]; +} + +- (UIImage *)imageWithFilterPreset:(ImageFilterPreset)preset intensity:(float)intensity{ + if (preset == ImageFilterPresetOriginal) { + return self; + } + + return [self imageWithFilter:[self filterWithPreset:preset intensity:intensity]]; +} + +- (CIFilter *)filterWithPreset:(ImageFilterPreset)preset { + return [self filterWithPreset:preset intensity:0.3]; +} + +- (CIFilter *)filterWithPreset:(ImageFilterPreset)preset intensity:(float)intensity { + CIImage *image = [CIImage imageWithCGImage:self.CGImage]; + CIFilter *filter = nil; + + switch (preset) { + case ImageFilterPresetBlackAndWhite: { + CIFilter* colorControl = [CIFilter filterWithName:@"CIColorControls" + keysAndValues:kCIInputImageKey, image, nil]; + [self setValueForPreset:preset filter:colorControl intensity:intensity]; + + + CIFilter* sharpMask = [CIFilter filterWithName:@"CIUnsharpMask" + keysAndValues:kCIInputImageKey, colorControl.outputImage, nil]; + [self setValueForPreset:preset filter:sharpMask intensity:intensity]; + + filter = [CIFilter filterWithName:@"CIExposureAdjust" + keysAndValues:kCIInputImageKey, sharpMask.outputImage, nil]; + [self setValueForPreset:preset filter:filter intensity:intensity]; + + } + break; + case ImageFilterPresetGrayScale: { + CIFilter* unsharpMask = [CIFilter filterWithName:@"CIUnsharpMask" + keysAndValues:kCIInputImageKey, image, nil]; + [self setValueForPreset:preset filter:unsharpMask intensity:intensity]; + + filter = [CIFilter filterWithName:@"CIColorControls" + keysAndValues:kCIInputImageKey, unsharpMask.outputImage, nil]; + [self setValueForPreset:preset filter:filter intensity:intensity]; + + + } + break; + case ImageFilterPresetEnhanceColor: { + CIFilter* colorControl = [CIFilter filterWithName:@"CIColorControls" + keysAndValues:kCIInputImageKey, image, nil]; + [self setValueForPreset:preset filter:colorControl intensity:intensity]; + + + filter = [CIFilter filterWithName:@"CIUnsharpMask" + keysAndValues:kCIInputImageKey, colorControl.outputImage, nil]; + [self setValueForPreset:preset filter:filter intensity:intensity]; + + } + break; + case ImageFilterPresetEnhanceExposure: { + CIFilter* exposure = [CIFilter filterWithName:@"CIExposureAdjust" + keysAndValues:kCIInputImageKey, image, nil]; + [self setValueForPreset:preset filter:exposure intensity:intensity]; + + CIFilter* gamma = [CIFilter filterWithName:@"CIGammaAdjust" + keysAndValues:kCIInputImageKey, exposure.outputImage, nil]; + [self setValueForPreset:preset filter:gamma intensity:intensity]; + + + + CIFilter* noiseReduction = [CIFilter filterWithName:@"CINoiseReduction" + keysAndValues:kCIInputImageKey, gamma.outputImage, nil]; + [self setValueForPreset:preset filter:noiseReduction intensity:intensity]; + + + filter = [CIFilter filterWithName:@"CIColorControls" + keysAndValues:kCIInputImageKey, noiseReduction.outputImage, nil]; + [self setValueForPreset:preset filter:filter intensity:intensity]; + + } + break; + default: + break; + } + + return filter; +} + ++(NSDictionary*)presetParameters { + static NSDictionary *inst = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + inst = @{ + @(ImageFilterPresetEnhanceExposure): @{ @"CIExposureAdjust" : @{ + @"inputEV": [ValueRange valueWithLow:0 high:5] + }, + @"CIGammaAdjust": @{ + @"inputPower": [ValueRange valueWithLow:1 high:0.7] + } , + @"CINoiseReduction": @{ + @"inputNoiseLevel": [ValueRange valueWithLow:0 high:0.01], + @"inputSharpness": [ValueRange valueWithLow:0.3 high:1.1] + }, + @"CIColorControls": @{ + @"inputSaturation": [ValueRange valueWithLow:1 high:1], + @"inputBrightness": [ValueRange valueWithLow:0 high:0], + @"inputContrast": [ValueRange valueWithLow:1 high:1.3] + } + }, + @(ImageFilterPresetEnhanceColor): @{ @"CIColorControls" : @{ + @"inputSaturation": [ValueRange valueWithLow:1 high:1.9], + @"inputBrightness": [ValueRange valueWithLow:0 high:0.1], + @"inputContrast": [ValueRange valueWithLow:1 high:1.2] + }, + @"CIUnsharpMask": @{ + @"inputRadius": [ValueRange valueWithLow:0 high:2.5], + @"inputIntensity": [ValueRange valueWithLow:0 high:0.5] + } + }, + @(ImageFilterPresetGrayScale): @{ @"CIColorControls" : @{ + @"inputSaturation": [ValueRange valueWithLow:1 high:0], + @"inputBrightness": [ValueRange valueWithLow:0 high:0], + @"inputContrast": [ValueRange valueWithLow:1 high:1] + }, + @"CIUnsharpMask": @{ + @"inputRadius": [ValueRange valueWithLow:0 high:2.5], + @"inputIntensity": [ValueRange valueWithLow:0 high:0.15] + } + }, + @(ImageFilterPresetBlackAndWhite): @{ @"CIExposureAdjust" : @{ + @"inputEV": [ValueRange valueWithLow:0 high:2.3] + }, + @"CIUnsharpMask" : @{ + @"inputRadius": [ValueRange valueWithLow:0 high:75.0], + @"inputIntensity": [ValueRange valueWithLow:0 high:2.0] + }, + @"CIColorControls": @{ + @"inputSaturation": [ValueRange valueWithLow:1 high:0], + @"inputBrightness": [ValueRange valueWithLow:0 high:0.15], + @"inputContrast": [ValueRange valueWithLow:1 high:1.3] + } + } + }; + }); + return inst; +} + +-(void)setValueForPreset:(ImageFilterPreset)preset filter:(CIFilter*)filter intensity:(float)intensity{ + NSDictionary* presetDict = [[[self class] presetParameters] objectForKey:@(preset)]; + + NSDictionary *subDict = presetDict[[filter name]]; + + for (NSString* key in [subDict allKeys]) { + ValueRange *value = subDict[key]; + [filter setValue:[value valueWithIntensity:intensity] forKey:key]; + } + +} + +@end + + + + + + + + diff --git a/ALCameraViewController/Utilities/UIImageView+Filter.h b/ALCameraViewController/Utilities/UIImageView+Filter.h new file mode 100755 index 00000000..ec34f46a --- /dev/null +++ b/ALCameraViewController/Utilities/UIImageView+Filter.h @@ -0,0 +1,65 @@ +// +// UIImageView+Filter.h +// Updates +// +// Created by Nebojsa Petrovic on 4/14/13. +// Copyright (c) 2013 Nebojsa Petrovic. All rights reserved. +// + +#import +#import "UIImage+Filter.h" + +@interface UIImageView (Filter) + +/* + Apply 'filter' to the image view's image. + The filter application can be animated with custom duration + and options. + When the filter has finished being applied, the completionBlock is called. + */ +- (void)applyFilter:(CIFilter *)filter + animationDuration:(NSTimeInterval)animationDuration + animationOptions:(UIViewAnimationOptions)animationOptions + completion:(void (^)(void))completionBlock; +- (void)applyFilterWithPreset:(ImageFilterPreset)preset + intensity:(float)intensity + animationDuration:(NSTimeInterval)animationDuration + animationOptions:(UIViewAnimationOptions)animationOptions + completion:(void (^)(void))completionBlock; + +/* + Apply 'filter' to the image view's image. + If 'animated' is YES, the filter application is animated + with a cross-disolve effect for a duration of 0.3 seconds. + When the filter has finished being applied, the completionBlock is called. + */ +- (void)applyFilter:(CIFilter *)filter + animated:(BOOL)animated + completion:(void (^)(void))completionBlock; +- (void)applyFilterWithPreset:(ImageFilterPreset)preset + intensity:(float)intensity + animated:(BOOL)animated + completion:(void (^)(void))completionBlock; + +/* + Apply 'filter' to the image view's image without animation. + When the filter has finished being applied, the completionBlock is called. + */ +- (void)applyFilter:(CIFilter *)filter + completion:(void (^)(void))completionBlock; +- (void)applyFilterWithPreset:(ImageFilterPreset)preset + intensity:(float)intensity + completion:(void (^)(void))completionBlock; + +/* + Apply 'filter' to the image view's image without animation. + */ +- (void)applyFilter:(CIFilter *)filter; +- (void)applyFilterWithPreset:(ImageFilterPreset)preset intensity:(float)intensity; + +/* + Remove any filters applied. This bring back the original image. + */ +- (void)removeFilter; + +@end diff --git a/ALCameraViewController/Utilities/UIImageView+Filter.m b/ALCameraViewController/Utilities/UIImageView+Filter.m new file mode 100755 index 00000000..6c8655cb --- /dev/null +++ b/ALCameraViewController/Utilities/UIImageView+Filter.m @@ -0,0 +1,129 @@ +// +// UIImageView+Filter.m +// Updates +// +// Created by Nebojsa Petrovic on 4/14/13. +// Copyright (c) 2013 Nebojsa Petrovic. All rights reserved. +// + +#import "UIImageView+Filter.h" +#import + +// Arbitrary tag so that we can identify filtered images. +// Otherwise we risk removing a custom subview that isn't a filter. +#define IMAGE_FILTER_TAG 123454321 + +@implementation UIImageView (Filter) + +- (void)applyFilter:(CIFilter *)filter + animationDuration:(NSTimeInterval)animationDuration + animationOptions:(UIViewAnimationOptions)animationOptions + completion:(void (^)(void))completionBlock { + + [self.image applyFilter:filter completion:^(UIImage *filteredImage) { + // Remove any previous filters + [self removeFilter]; + + // Add the filtered image on top of the original image. + UIImageView *filteredImageView = [[UIImageView alloc] initWithFrame:self.bounds]; + filteredImageView.tag = IMAGE_FILTER_TAG; + filteredImageView.contentMode = self.contentMode; + [self addSubview:filteredImageView]; + + // No animation + if (animationDuration == 0.0f) { + filteredImageView.image = filteredImage; + if (completionBlock) { + completionBlock(); + } + return; + } + + // Animation + [UIView transitionWithView:self + duration:animationDuration + options:animationOptions + animations:^{ + filteredImageView.image = filteredImage; + } completion:^(BOOL finished) { + if (completionBlock) { + completionBlock(); + } + }]; + }]; +} + +- (void)applyFilterWithPreset:(ImageFilterPreset)preset + animationDuration:(NSTimeInterval)animationDuration + animationOptions:(UIViewAnimationOptions)animationOptions + completion:(void (^)(void))completionBlock { + CIFilter *filter = [self.image filterWithPreset:preset]; + [self applyFilter:filter + animationDuration:animationDuration + animationOptions:animationOptions + completion:completionBlock]; +} + +- (void)applyFilterWithPreset:(ImageFilterPreset)preset + intensity:(float)intensity + animationDuration:(NSTimeInterval)animationDuration + animationOptions:(UIViewAnimationOptions)animationOptions + completion:(void (^)(void))completionBlock { + CIFilter *filter = [self.image filterWithPreset:preset intensity:intensity]; + [self applyFilter:filter + animationDuration:animationDuration + animationOptions:animationOptions + completion:completionBlock]; +} + +- (void)applyFilter:(CIFilter *)filter + animated:(BOOL)animated + completion:(void (^)(void))completionBlock { + [self applyFilter:filter + animationDuration:animated ? 0.3f : 0.0f + animationOptions:UIViewAnimationOptionTransitionCrossDissolve + completion:completionBlock]; +} + +- (void)applyFilterWithPreset:(ImageFilterPreset)preset + intensity:(float)intensity + animated:(BOOL)animated + completion:(void (^)(void))completionBlock { + CIFilter *filter = [self.image filterWithPreset:preset intensity:intensity]; + [self applyFilter:filter + animated:animated + completion:completionBlock]; +} + +- (void)applyFilter:(CIFilter *)filter + completion:(void (^)(void))completionBlock { + [self applyFilter:filter animated:NO completion:completionBlock]; +} + +- (void)applyFilterWithPreset:(ImageFilterPreset)preset + intensity:(float)intensity + completion:(void (^)(void))completionBlock { + CIFilter *filter = [self.image filterWithPreset:preset intensity:intensity]; + [self applyFilter:filter + completion:completionBlock]; +} + +- (void)applyFilter:(CIFilter *)filter { + [self applyFilter:filter completion:nil]; +} + +- (void)applyFilterWithPreset:(ImageFilterPreset)preset intensity:(float)intensity{ + CIFilter *filter = [self.image filterWithPreset:preset intensity:intensity]; + [self applyFilter:filter]; +} + +- (void)removeFilter { + for (UIView *subview in self.subviews) { + if ([subview isKindOfClass:[UIImageView class]] && + subview.tag == IMAGE_FILTER_TAG) { + [subview removeFromSuperview]; + } + } +} + +@end diff --git a/ALCameraViewController/Utilities/Utilities.swift b/ALCameraViewController/Utilities/Utilities.swift index 45e19e85..0e58c17a 100644 --- a/ALCameraViewController/Utilities/Utilities.swift +++ b/ALCameraViewController/Utilities/Utilities.swift @@ -28,8 +28,8 @@ internal func currentRotation(_ oldOrientation: UIInterfaceOrientation, newOrien switch oldOrientation { case .portrait: switch newOrientation { - case .landscapeLeft: return 90 - case .landscapeRight: return -90 + case .landscapeLeft: return -90 + case .landscapeRight: return 90 case .portraitUpsideDown: return 180 default: return 0 } @@ -54,6 +54,7 @@ internal func currentRotation(_ oldOrientation: UIInterfaceOrientation, newOrien } } + internal func largestPhotoSize() -> CGSize { let scale = UIScreen.main.scale let screenSize = UIScreen.main.bounds.size @@ -95,11 +96,24 @@ internal func flashImage(_ mode: AVCaptureFlashMode) -> String { let image: String switch mode { case .auto: - image = "flashAutoIcon" + image = "camera_flash_auto" + case .on: + image = "camera_flash_on" + case .off: + image = "camera_flash_off" + } + return image +} + +internal func flashHighlightImage(_ mode: AVCaptureFlashMode) -> String { + let image: String + switch mode { + case .auto: + image = "camera_flash_auto_highlight" case .on: - image = "flashOnIcon" + image = "camera_flash_on_highlight" case .off: - image = "flashOffIcon" + image = "camera_flash_off_highlight" } return image } diff --git a/ALCameraViewController/ViewController/Base.lproj/CameraViewController.xib b/ALCameraViewController/ViewController/Base.lproj/CameraViewController.xib new file mode 100644 index 00000000..5be8b28b --- /dev/null +++ b/ALCameraViewController/ViewController/Base.lproj/CameraViewController.xib @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ALCameraViewController/ViewController/Base.lproj/ConfirmViewController.xib b/ALCameraViewController/ViewController/Base.lproj/ConfirmViewController.xib new file mode 100644 index 00000000..5b3caa7e --- /dev/null +++ b/ALCameraViewController/ViewController/Base.lproj/ConfirmViewController.xib @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ALCameraViewController/ViewController/Base.lproj/CropViewController.xib b/ALCameraViewController/ViewController/Base.lproj/CropViewController.xib new file mode 100644 index 00000000..b25d59dc --- /dev/null +++ b/ALCameraViewController/ViewController/Base.lproj/CropViewController.xib @@ -0,0 +1,266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ALCameraViewController/ViewController/Base.lproj/FilterViewController.xib b/ALCameraViewController/ViewController/Base.lproj/FilterViewController.xib new file mode 100644 index 00000000..d83446b5 --- /dev/null +++ b/ALCameraViewController/ViewController/Base.lproj/FilterViewController.xib @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ALCameraViewController/ViewController/CameraViewController.swift b/ALCameraViewController/ViewController/CameraViewController.swift index 42d5cdcb..dd3a7925 100644 --- a/ALCameraViewController/ViewController/CameraViewController.swift +++ b/ALCameraViewController/ViewController/CameraViewController.swift @@ -9,37 +9,40 @@ import UIKit import AVFoundation import Photos +import CoreMotion public typealias CameraViewCompletion = (UIImage?, PHAsset?) -> Void public extension CameraViewController { /// Provides an image picker wrapped inside a UINavigationController instance - public class func imagePickerViewController(croppingEnabled: Bool, completion: @escaping CameraViewCompletion) -> UINavigationController { + public class func imagePickerViewController(croppingEnabled: Bool, completion: @escaping CameraViewCompletion) -> PhotoLibraryViewController { let imagePicker = PhotoLibraryViewController() - let navigationController = UINavigationController(rootViewController: imagePicker) - navigationController.navigationBar.barTintColor = UIColor.black - navigationController.navigationBar.barStyle = UIBarStyle.black - navigationController.modalTransitionStyle = UIModalTransitionStyle.crossDissolve + +// self.navigationController?.navigationBar.barTintColor = UIColor.white +// self.navigationController?.navigationBar.tintColor = UIColor.black +// self.navigationController?.navigationBar.barStyle = UIBarStyle.black +// self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.black] +// self.navigationController?.modalTransitionStyle = UIModalTransitionStyle.crossDissolve imagePicker.onSelectionComplete = { [weak imagePicker] asset in if let asset = asset { - let confirmController = ConfirmViewController(asset: asset, allowsCropping: croppingEnabled) - confirmController.onComplete = { [weak imagePicker] image, asset in + let cropViewController = CropViewController(asset: asset, allowsCropping: croppingEnabled) + cropViewController.onComplete = { [weak imagePicker] image, asset in if let image = image, let asset = asset { completion(image, asset) } else { imagePicker?.dismiss(animated: true, completion: nil) } } - confirmController.modalTransitionStyle = UIModalTransitionStyle.crossDissolve - imagePicker?.present(confirmController, animated: true, completion: nil) + + imagePicker?.navigationController?.pushViewController(cropViewController, animated: true) } else { completion(nil, nil) } } - return navigationController + return imagePicker } } @@ -49,7 +52,7 @@ open class CameraViewController: UIViewController { var allowCropping = false var animationRunning = false - var lastInterfaceOrientation : UIInterfaceOrientation? + var lastInterfaceOrientation : UIInterfaceOrientation? = UIApplication.shared.statusBarOrientation open var onCompletion: CameraViewCompletion? var volumeControl: VolumeControl? @@ -83,95 +86,108 @@ open class CameraViewController: UIViewController { var cameraOverlayWidthConstraint: NSLayoutConstraint? var cameraOverlayCenterConstraint: NSLayoutConstraint? - let cameraView : CameraView = { - let cameraView = CameraView() - cameraView.translatesAutoresizingMaskIntoConstraints = false - return cameraView + let motionManager : CMMotionManager = { + let motionManager = CMMotionManager() + motionManager.deviceMotionUpdateInterval = 0.2 + return motionManager }() + @IBOutlet weak var cameraView: CameraView! + +// let cameraView : CameraView = { +// let cameraView = CameraView() +// cameraView.translatesAutoresizingMaskIntoConstraints = false +// return cameraView +// }() + let cameraOverlay : CropOverlay = { let cameraOverlay = CropOverlay() cameraOverlay.translatesAutoresizingMaskIntoConstraints = false return cameraOverlay }() + + @IBOutlet weak var cameraButton: UIButton! + - let cameraButton : UIButton = { - let button = UIButton(frame: CGRect(x: 0, y: 0, width: 64, height: 64)) - button.translatesAutoresizingMaskIntoConstraints = false - button.isEnabled = false - button.setImage(UIImage(named: "cameraButton", - in: CameraGlobals.shared.bundle, - compatibleWith: nil), - for: .normal) - button.setImage(UIImage(named: "cameraButtonHighlighted", - in: CameraGlobals.shared.bundle, - compatibleWith: nil), - for: .highlighted) - return button - }() - - let closeButton : UIButton = { - let button = UIButton() - button.translatesAutoresizingMaskIntoConstraints = false - button.setImage(UIImage(named: "closeButton", - in: CameraGlobals.shared.bundle, - compatibleWith: nil), - for: .normal) - return button - }() - - let swapButton : UIButton = { - let button = UIButton() - button.translatesAutoresizingMaskIntoConstraints = false - button.setImage(UIImage(named: "swapButton", - in: CameraGlobals.shared.bundle, - compatibleWith: nil), - for: .normal) - return button - }() - - let libraryButton : UIButton = { - let button = UIButton() - button.translatesAutoresizingMaskIntoConstraints = false - button.setImage(UIImage(named: "libraryButton", - in: CameraGlobals.shared.bundle, - compatibleWith: nil), - for: .normal) - return button - }() - - let flashButton : UIButton = { - let button = UIButton(frame: CGRect(x: 0, y: 0, width: 44, height: 44)) - button.translatesAutoresizingMaskIntoConstraints = false - button.setImage(UIImage(named: "flashAutoIcon", - in: CameraGlobals.shared.bundle, - compatibleWith: nil), - for: .normal) - return button - }() - - let containerSwapLibraryButton : UIView = { - let view = UIView() - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() +// let cameraButton : UIButton = { +// let button = UIButton(frame: CGRect(x: 0, y: 0, width: 64, height: 64)) +// button.translatesAutoresizingMaskIntoConstraints = false +// button.isEnabled = false +// button.setImage(UIImage(named: "cameraButton", +// in: CameraGlobals.shared.bundle, +// compatibleWith: nil), +// for: .normal) +// button.setImage(UIImage(named: "cameraButtonHighlighted", +// in: CameraGlobals.shared.bundle, +// compatibleWith: nil), +// for: .highlighted) +// return button +// }() + + @IBOutlet weak var closeButton: UIButton! +// let closeButton : UIButton = { +// let button = UIButton() +// button.translatesAutoresizingMaskIntoConstraints = false +// button.setImage(UIImage(named: "closeButton", +// in: CameraGlobals.shared.bundle, +// compatibleWith: nil), +// for: .normal) +// return button +// }() + + @IBOutlet weak var swapButton: UIButton! +// let swapButton : UIButton = { +// let button = UIButton() +// button.translatesAutoresizingMaskIntoConstraints = false +// button.setImage(UIImage(named: "swapButton", +// in: CameraGlobals.shared.bundle, +// compatibleWith: nil), +// for: .normal) +// return button +// }() + + @IBOutlet weak var libraryButton: UIButton! +// let libraryButton : UIButton = { +// let button = UIButton() +// button.translatesAutoresizingMaskIntoConstraints = false +// button.setImage(UIImage(named: "libraryButton", +// in: CameraGlobals.shared.bundle, +// compatibleWith: nil), +// for: .normal) +// return button +// }() + + @IBOutlet weak var flashButton: UIButton! +// let flashButton : UIButton = { +// let button = UIButton(frame: CGRect(x: 0, y: 0, width: 44, height: 44)) +// button.translatesAutoresizingMaskIntoConstraints = false +// button.setImage(UIImage(named: "flashAutoIcon", +// in: CameraGlobals.shared.bundle, +// compatibleWith: nil), +// for: .normal) +// return button +// }() +// +// let containerSwapLibraryButton : UIView = { +// let view = UIView() +// view.translatesAutoresizingMaskIntoConstraints = false +// return view +// }() private let allowsLibraryAccess: Bool + private var allowsSwapCamera: Bool = true public init(croppingEnabled: Bool, allowsLibraryAccess: Bool = true, allowsSwapCameraOrientation: Bool = true, completion: @escaping CameraViewCompletion) { self.allowsLibraryAccess = allowsLibraryAccess - super.init(nibName: nil, bundle: nil) + super.init(nibName: "CameraViewController", bundle: CameraGlobals.shared.bundle) onCompletion = completion allowCropping = croppingEnabled - cameraOverlay.isHidden = !allowCropping - libraryButton.isEnabled = allowsLibraryAccess - libraryButton.isHidden = !allowsLibraryAccess - swapButton.isEnabled = allowsSwapCameraOrientation - swapButton.isHidden = !allowsSwapCameraOrientation + allowsSwapCamera = allowsSwapCameraOrientation } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + allowsLibraryAccess = true + super.init(coder: aDecoder) } open override var prefersStatusBarHidden: Bool { @@ -182,74 +198,8 @@ open class CameraViewController: UIViewController { return UIStatusBarAnimation.slide } - /** - * Configure the background of the superview to black - * and add the views on this superview. Then, request - * the update of constraints for this superview. - */ - open override func loadView() { - super.loadView() - view.backgroundColor = UIColor.black - [cameraView, - cameraOverlay, - cameraButton, - closeButton, - flashButton, - containerSwapLibraryButton].forEach({ view.addSubview($0) }) - [swapButton, libraryButton].forEach({ containerSwapLibraryButton.addSubview($0) }) - view.setNeedsUpdateConstraints() - } - - /** - * Setup the constraints when the app is starting or rotating - * the screen. - * To avoid the override/conflict of stable constraint, these - * stable constraint are one time configurable. - * Any other dynamic constraint are configurable when the - * device is rotating, based on the device orientation. - */ - override open func updateViewConstraints() { - - if !didUpdateViews { - configCameraViewConstraints() - didUpdateViews = true - } - - let statusBarOrientation = UIApplication.shared.statusBarOrientation - let portrait = statusBarOrientation.isPortrait - - configCameraButtonEdgeConstraint(statusBarOrientation) - configCameraButtonGravityConstraint(portrait) - - removeCloseButtonConstraints() - configCloseButtonEdgeConstraint(statusBarOrientation) - configCloseButtonGravityConstraint(statusBarOrientation) - - removeContainerConstraints() - configContainerEdgeConstraint(statusBarOrientation) - configContainerGravityConstraint(statusBarOrientation) - - removeSwapButtonConstraints() - configSwapButtonEdgeConstraint(statusBarOrientation) - configSwapButtonGravityConstraint(portrait) - - removeLibraryButtonConstraints() - configLibraryEdgeButtonConstraint(statusBarOrientation) - configLibraryGravityButtonConstraint(portrait) - - configFlashEdgeButtonConstraint(statusBarOrientation) - configFlashGravityButtonConstraint(statusBarOrientation) - - let padding : CGFloat = portrait ? 16.0 : -16.0 - removeCameraOverlayEdgesConstraints() - configCameraOverlayEdgeOneContraint(portrait, padding: padding) - configCameraOverlayEdgeTwoConstraint(portrait, padding: padding) - configCameraOverlayWidthConstraint(portrait) - configCameraOverlayCenterConstraint(portrait) - - rotate(actualInterfaceOrientation: statusBarOrientation) - - super.updateViewConstraints() + open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return .portrait } /** @@ -263,6 +213,13 @@ open class CameraViewController: UIViewController { */ open override func viewDidLoad() { super.viewDidLoad() + + cameraOverlay.isHidden = !allowCropping + libraryButton.isEnabled = allowsLibraryAccess + libraryButton.isHidden = !allowsLibraryAccess + swapButton.isEnabled = allowsSwapCamera + swapButton.isHidden = !allowsSwapCamera + setupActions() checkPermissions() cameraView.configureFocus() @@ -273,6 +230,7 @@ open class CameraViewController: UIViewController { */ open override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + self.navigationController?.isNavigationBarHidden = true cameraView.startSession() addCameraObserver() addRotateObserver() @@ -292,6 +250,8 @@ open class CameraViewController: UIViewController { open override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) + self.navigationController?.isNavigationBarHidden = false + self.cameraView.stopSession() NotificationCenter.default.removeObserver(self) volumeControl = nil } @@ -334,11 +294,49 @@ open class CameraViewController: UIViewController { * orientation of CameraView. */ private func addRotateObserver() { - NotificationCenter.default.addObserver( - self, - selector: #selector(rotateCameraView), - name: NSNotification.Name.UIDeviceOrientationDidChange, - object: nil) + if motionManager.isDeviceMotionAvailable { + let queue = OperationQueue() + motionManager.startDeviceMotionUpdates(to: queue) { + [weak self] (data: CMDeviceMotion?, error: Error?) in + if let gravity = data?.gravity { + if let orientation = self?.calcOrientation(gravity) { + OperationQueue.main.addOperation { + // update UI here + self?.rotate(actualInterfaceOrientation: orientation) + } + } + } + } + } + + } + + func calcOrientation(_ acceleration: CMAcceleration) -> UIInterfaceOrientation? { + var orientationNew:UIInterfaceOrientation?; + + if (acceleration.x >= 0.75) { + orientationNew = .landscapeLeft + } + else if (acceleration.x <= -0.75) { + orientationNew = .landscapeRight + } + else if (acceleration.y <= -0.75) { + orientationNew = .portrait; + } + else if (acceleration.y >= 0.75) { + orientationNew = .portraitUpsideDown; + } + + guard let _ = orientationNew else { + return nil + } + + if (orientationNew == lastInterfaceOrientation) { + return nil + } + + lastInterfaceOrientation = orientationNew + return orientationNew } internal func notifyCameraReady() { @@ -380,8 +378,8 @@ open class CameraViewController: UIViewController { libraryButton].forEach({ $0.isEnabled = enabled }) } - func rotateCameraView() { - cameraView.rotatePreview() + func rotateCameraView(_ orientation:UIInterfaceOrientation) { + cameraView.rotatePreview(orientation) } /** @@ -389,14 +387,8 @@ open class CameraViewController: UIViewController { * the last and actual orientation of the device. */ internal func rotate(actualInterfaceOrientation: UIInterfaceOrientation) { - - if lastInterfaceOrientation != nil { - let lastTransform = CGAffineTransform(rotationAngle: radians(currentRotation( - lastInterfaceOrientation!, newOrientation: actualInterfaceOrientation))) - setTransform(transform: lastTransform) - } - - let transform = CGAffineTransform(rotationAngle: 0) + let transform = CGAffineTransform(rotationAngle: radians(currentRotation( + .portrait, newOrientation: actualInterfaceOrientation))) animationRunning = true /** @@ -408,30 +400,21 @@ open class CameraViewController: UIViewController { let spring = animationSpring let options = rotateAnimation - let time: DispatchTime = DispatchTime.now() + Double(1 * UInt64(NSEC_PER_SEC)/10) - DispatchQueue.main.asyncAfter(deadline: time) { [weak self] in - - guard let _ = self else { - return - } - - CATransaction.begin() - CATransaction.setDisableActions(false) - CATransaction.commit() - - UIView.animate( - withDuration: duration, - delay: 0.1, - usingSpringWithDamping: spring, - initialSpringVelocity: 0, - options: options, - animations: { [weak self] in + CATransaction.begin() + CATransaction.setDisableActions(false) + CATransaction.commit() + + UIView.animate( + withDuration: duration, + delay: 0.1, + usingSpringWithDamping: spring, + initialSpringVelocity: 0, + options: options, + animations: { [weak self] in self?.setTransform(transform: transform) - }, completion: { [weak self] _ in - self?.animationRunning = false - }) - - } + }, completion: { [weak self] _ in + self?.animationRunning = false + }) } func setTransform(transform: CGAffineTransform) { @@ -493,13 +476,13 @@ open class CameraViewController: UIViewController { if connection.isEnabled { toggleButtons(enabled: false) - cameraView.capturePhoto { [weak self] image in + cameraView.capturePhoto(lastInterfaceOrientation!, { [weak self] (image) in guard let image = image else { self?.toggleButtons(enabled: true) return } self?.saveImage(image: image) - } + }) } } @@ -545,9 +528,11 @@ open class CameraViewController: UIViewController { self?.onCompletion?(image, asset) } - present(imagePicker, animated: true) { [weak self] in - self?.cameraView.stopSession() - } + navigationController?.pushViewController(imagePicker, animated: true) + +// present(imagePicker, animated: true) { [weak self] in +// self?.cameraView.stopSession() +// } } internal func toggleFlash() { @@ -562,6 +547,11 @@ open class CameraViewController: UIViewController { compatibleWith: nil) flashButton.setImage(image, for: .normal) + + let highlight = UIImage(named: flashHighlightImage(device.flashMode), + in: CameraGlobals.shared.bundle, + compatibleWith: nil) + flashButton.setImage(highlight, for: .highlighted) } internal func swapCamera() { @@ -571,19 +561,20 @@ open class CameraViewController: UIViewController { internal func layoutCameraResult(uiImage: UIImage) { cameraView.stopSession() - startConfirmController(uiImage: uiImage) + startCropController(uiImage: uiImage) toggleButtons(enabled: true) } internal func layoutCameraResult(asset: PHAsset) { cameraView.stopSession() - startConfirmController(asset: asset) + startCropController(asset: asset) toggleButtons(enabled: true) } - private func startConfirmController(uiImage: UIImage) { - let confirmViewController = ConfirmViewController(image: uiImage, allowsCropping: allowCropping) - confirmViewController.onComplete = { [weak self] image, asset in + private func startCropController(uiImage: UIImage) { + + let cropViewController = CropViewController(image: uiImage, allowsCropping: allowCropping) + cropViewController.onComplete = { [weak self] image, asset in defer { self?.dismiss(animated: true, completion: nil) } @@ -595,13 +586,23 @@ open class CameraViewController: UIViewController { self?.onCompletion?(image, asset) self?.onCompletion = nil } - confirmViewController.modalTransitionStyle = UIModalTransitionStyle.crossDissolve - present(confirmViewController, animated: true, completion: nil) + +// let navigationController = UINavigationController(rootViewController: cropViewController) +// +// navigationController.navigationBar.barTintColor = UIColor.white +// navigationController.navigationBar.tintColor = UIColor.black +// navigationController.navigationBar.barStyle = UIBarStyle.black +// navigationController.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.black] +// +// navigationController.modalTransitionStyle = UIModalTransitionStyle.crossDissolve +// +// present(navigationController, animated: true, completion: nil) + navigationController?.pushViewController(cropViewController, animated: true) } - private func startConfirmController(asset: PHAsset) { - let confirmViewController = ConfirmViewController(asset: asset, allowsCropping: allowCropping) - confirmViewController.onComplete = { [weak self] image, asset in + private func startCropController(asset: PHAsset) { + let cropViewController = CropViewController(asset: asset, allowsCropping: allowCropping) + cropViewController.onComplete = { [weak self] image, asset in defer { self?.dismiss(animated: true, completion: nil) } @@ -613,14 +614,26 @@ open class CameraViewController: UIViewController { self?.onCompletion?(image, asset) self?.onCompletion = nil } - confirmViewController.modalTransitionStyle = UIModalTransitionStyle.crossDissolve - present(confirmViewController, animated: true, completion: nil) + +// let navigationController = UINavigationController(rootViewController: cropViewController) +// +// navigationController.navigationBar.barTintColor = UIColor.white +// navigationController.navigationBar.tintColor = UIColor.black +// navigationController.navigationBar.barStyle = UIBarStyle.black +// navigationController.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.black] +// +// navigationController.modalTransitionStyle = UIModalTransitionStyle.crossDissolve +// +// present(navigationController, animated: true, completion: nil) + navigationController?.pushViewController(cropViewController, animated: true) + } private func showSpinner() -> UIActivityIndicatorView { let spinner = UIActivityIndicatorView() spinner.activityIndicatorViewStyle = .white spinner.center = view.center + spinner.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin] spinner.startAnimating() view.addSubview(spinner) diff --git a/ALCameraViewController/ViewController/CameraViewControllerConstraint.swift b/ALCameraViewController/ViewController/CameraViewControllerConstraint.swift deleted file mode 100644 index 4b485532..00000000 --- a/ALCameraViewController/ViewController/CameraViewControllerConstraint.swift +++ /dev/null @@ -1,528 +0,0 @@ -// -// CameraViewControllerConstraint.swift -// CameraViewControllerConstraint -// -// Created by Pedro Paulo de Amorim. -// Copyright (c) 2016 zero. All rights reserved. -// - -import UIKit -import AVFoundation - -/** - * This extension provides the configuration of - * constraints for CameraViewController. - */ -extension CameraViewController { - - /** - * To attach the view to the edges of the superview, it needs - to be pinned on the sides of the self.view, based on the - edges of this superview. - * This configure the cameraView to show, in real time, the - * camera. - */ - func configCameraViewConstraints() { - [.left, .right, .top, .bottom].forEach({ - view.addConstraint(NSLayoutConstraint( - item: cameraView, - attribute: $0, - relatedBy: .equal, - toItem: view, - attribute: $0, - multiplier: 1.0, - constant: 0)) - }) - } - - /** - * Add the constraints based on the device orientation, - * this pin the button on the bottom part of the screen - * when the device is portrait, when landscape, pin - * the button on the right part of the screen. - */ - func configCameraButtonEdgeConstraint(_ statusBarOrientation: UIInterfaceOrientation) { - view.autoRemoveConstraint(cameraButtonEdgeConstraint) - - let attribute : NSLayoutAttribute = { - switch statusBarOrientation { - case .portrait: return .bottom - case .landscapeRight: return .right - case .landscapeLeft: return .left - default: return .top - } - }() - - cameraButtonEdgeConstraint = NSLayoutConstraint( - item: cameraButton, - attribute: attribute, - relatedBy: .equal, - toItem: view, - attribute: attribute, - multiplier: 1.0, - constant: attribute == .right || attribute == .bottom ? -8 : 8) - view.addConstraint(cameraButtonEdgeConstraint!) - } - - /** - * Add the constraints based on the device orientation, - * centerX the button based on the width of screen. - * When the device is landscape orientation, centerY - * the button based on the height of screen. - */ - func configCameraButtonGravityConstraint(_ portrait: Bool) { - view.autoRemoveConstraint(cameraButtonGravityConstraint) - let attribute : NSLayoutAttribute = portrait ? .centerX : .centerY - cameraButtonGravityConstraint = NSLayoutConstraint( - item: cameraButton, - attribute: attribute, - relatedBy: .equal, - toItem: view, - attribute: attribute, - multiplier: 1.0, - constant: 0) - view.addConstraint(cameraButtonGravityConstraint!) - } - - /** - * Remove the constraints of container. - */ - func removeContainerConstraints() { - view.autoRemoveConstraint(containerButtonsEdgeOneConstraint) - view.autoRemoveConstraint(containerButtonsEdgeTwoConstraint) - view.autoRemoveConstraint(containerButtonsGravityConstraint) - } - - /** - * Configure the edges constraints of container that - * handle the center position of SwapButton and - * LibraryButton. - */ - func configContainerEdgeConstraint(_ statusBarOrientation : UIInterfaceOrientation) { - - let attributeOne : NSLayoutAttribute - let attributeTwo : NSLayoutAttribute - - switch statusBarOrientation { - case .portrait: - attributeOne = .left - attributeTwo = .right - break - case .landscapeRight: - attributeOne = .bottom - attributeTwo = .top - break - case .landscapeLeft: - attributeOne = .top - attributeTwo = .bottom - break - default: - attributeOne = .right - attributeTwo = .left - break - } - - containerButtonsEdgeOneConstraint = NSLayoutConstraint( - item: containerSwapLibraryButton, - attribute: attributeOne, - relatedBy: .equal, - toItem: cameraButton, - attribute: attributeTwo, - multiplier: 1.0, - constant: 0) - view.addConstraint(containerButtonsEdgeOneConstraint!) - - containerButtonsEdgeTwoConstraint = NSLayoutConstraint( - item: containerSwapLibraryButton, - attribute: attributeTwo, - relatedBy: .equal, - toItem: view, - attribute: attributeTwo, - multiplier: 1.0, - constant: 0) - view.addConstraint(containerButtonsEdgeTwoConstraint!) - - } - - /** - * Configure the gravity of container, based on the - * orientation of the device. - */ - func configContainerGravityConstraint(_ statusBarOrientation : UIInterfaceOrientation) { - let attributeCenter : NSLayoutAttribute = statusBarOrientation.isPortrait ? .centerY : .centerX - containerButtonsGravityConstraint = NSLayoutConstraint( - item: containerSwapLibraryButton, - attribute: attributeCenter, - relatedBy: .equal, - toItem: cameraButton, - attribute: attributeCenter, - multiplier: 1.0, - constant: 0) - view.addConstraint(containerButtonsGravityConstraint!) - } - - /** - * Remove the SwapButton constraints to be updated when - * the device was rotated. - */ - func removeSwapButtonConstraints() { - view.autoRemoveConstraint(swapButtonEdgeOneConstraint) - view.autoRemoveConstraint(swapButtonEdgeTwoConstraint) - view.autoRemoveConstraint(swapButtonGravityConstraint) - } - - /** - * If the device is portrait, pin the SwapButton on the - * right side of the CameraButton. - * If landscape, pin the SwapButton on the top of the - * CameraButton. - */ - func configSwapButtonEdgeConstraint(_ statusBarOrientation : UIInterfaceOrientation) { - - let attributeOne : NSLayoutAttribute - let attributeTwo : NSLayoutAttribute - - switch statusBarOrientation { - case .portrait: - attributeOne = .top - attributeTwo = .bottom - break - case .landscapeRight: - attributeOne = .left - attributeTwo = .right - break - case .landscapeLeft: - attributeOne = .right - attributeTwo = .left - break - default: - attributeOne = .bottom - attributeTwo = .top - break - } - - swapButtonEdgeOneConstraint = NSLayoutConstraint( - item: swapButton, - attribute: attributeOne, - relatedBy: .equal, - toItem: containerSwapLibraryButton, - attribute: attributeOne, - multiplier: 1.0, - constant: 0) - view.addConstraint(swapButtonEdgeOneConstraint!) - - swapButtonEdgeTwoConstraint = NSLayoutConstraint( - item: swapButton, - attribute: attributeTwo, - relatedBy: .equal, - toItem: containerSwapLibraryButton, - attribute: attributeTwo, - multiplier: 1.0, - constant: 0) - view.addConstraint(swapButtonEdgeTwoConstraint!) - - } - - /** - * Configure the center of SwapButton, based on the - * axis center of CameraButton. - */ - func configSwapButtonGravityConstraint(_ portrait: Bool) { - swapButtonGravityConstraint = NSLayoutConstraint( - item: swapButton, - attribute: portrait ? .right : .bottom, - relatedBy: .lessThanOrEqual, - toItem: containerSwapLibraryButton, - attribute: portrait ? .centerX : .centerY, - multiplier: 1.0, - constant: -4.0 * DeviceConfig.SCREEN_MULTIPLIER) - view.addConstraint(swapButtonGravityConstraint!) - } - - func removeCloseButtonConstraints() { - view.autoRemoveConstraint(closeButtonEdgeConstraint) - view.autoRemoveConstraint(closeButtonGravityConstraint) - } - - /** - * Pin the close button to the left of the superview. - */ - func configCloseButtonEdgeConstraint(_ statusBarOrientation : UIInterfaceOrientation) { - - let attribute : NSLayoutAttribute = { - switch statusBarOrientation { - case .portrait: return .left - case .landscapeRight, .landscapeLeft: return .centerX - default: return .right - } - }() - - closeButtonEdgeConstraint = NSLayoutConstraint( - item: closeButton, - attribute: attribute, - relatedBy: .equal, - toItem: attribute != .centerX ? view : cameraButton, - attribute: attribute, - multiplier: 1.0, - constant: attribute != .centerX ? 16 : 0) - view.addConstraint(closeButtonEdgeConstraint!) - } - - /** - * Add the constraint for the CloseButton, based on - * the device orientation. - * If portrait, it pin the CloseButton on the CenterY - * of the CameraButton. - * Else if landscape, pin this button on the Bottom - * of superview. - */ - func configCloseButtonGravityConstraint(_ statusBarOrientation : UIInterfaceOrientation) { - - let attribute : NSLayoutAttribute - let constant : CGFloat - - switch statusBarOrientation { - case .portrait: - attribute = .centerY - constant = 0.0 - break - case .landscapeRight: - attribute = .bottom - constant = -16.0 - break - case .landscapeLeft: - attribute = .top - constant = 16.0 - break - default: - attribute = .centerX - constant = 0.0 - break - } - - closeButtonGravityConstraint = NSLayoutConstraint( - item: closeButton, - attribute: attribute, - relatedBy: .equal, - toItem: attribute == .bottom || attribute == .top ? view : cameraButton, - attribute: attribute, - multiplier: 1.0, - constant: constant) - - view.addConstraint(closeButtonGravityConstraint!) - } - - /** - * Remove the LibraryButton constraints to be updated when - * the device was rotated. - */ - func removeLibraryButtonConstraints() { - view.autoRemoveConstraint(libraryButtonEdgeOneConstraint) - view.autoRemoveConstraint(libraryButtonEdgeTwoConstraint) - view.autoRemoveConstraint(libraryButtonGravityConstraint) - } - - /** - * Add the constraint of the LibraryButton, if the device - * orientation is portrait, pin the right side of SwapButton - * to the left side of LibraryButton. - * If landscape, pin the bottom side of CameraButton on the - * top side of LibraryButton. - */ - func configLibraryEdgeButtonConstraint(_ statusBarOrientation : UIInterfaceOrientation) { - - let attributeOne : NSLayoutAttribute - let attributeTwo : NSLayoutAttribute - - switch statusBarOrientation { - case .portrait: - attributeOne = .top - attributeTwo = .bottom - break - case .landscapeRight: - attributeOne = .left - attributeTwo = .right - break - case .landscapeLeft: - attributeOne = .right - attributeTwo = .left - break - default: - attributeOne = .bottom - attributeTwo = .top - break - } - - libraryButtonEdgeOneConstraint = NSLayoutConstraint( - item: libraryButton, - attribute: attributeOne, - relatedBy: .equal, - toItem: containerSwapLibraryButton, - attribute: attributeOne, - multiplier: 1.0, - constant: 0) - view.addConstraint(libraryButtonEdgeOneConstraint!) - - libraryButtonEdgeTwoConstraint = NSLayoutConstraint( - item: libraryButton, - attribute: attributeTwo, - relatedBy: .equal, - toItem: containerSwapLibraryButton, - attribute: attributeTwo, - multiplier: 1.0, - constant: 0) - view.addConstraint(libraryButtonEdgeTwoConstraint!) - - } - - /** - * Set the center gravity of the LibraryButton based - * on the position of CameraButton. - */ - func configLibraryGravityButtonConstraint(_ portrait: Bool) { - libraryButtonGravityConstraint = NSLayoutConstraint( - item: libraryButton, - attribute: portrait ? .left : .top, - relatedBy: .lessThanOrEqual, - toItem: containerSwapLibraryButton, - attribute: portrait ? .centerX : .centerY, - multiplier: 1.0, - constant: 4.0 * DeviceConfig.SCREEN_MULTIPLIER) - view.addConstraint(libraryButtonGravityConstraint!) - } - - /** - * If the device orientation is portrait, pin the top of - * FlashButton to the top side of superview. - * Else if, pin the FlashButton bottom side on the top side - * of SwapButton. - */ - func configFlashEdgeButtonConstraint(_ statusBarOrientation: UIInterfaceOrientation) { - view.autoRemoveConstraint(flashButtonEdgeConstraint) - - let constraintRight = statusBarOrientation == .portrait || statusBarOrientation == .landscapeRight - let attribute : NSLayoutAttribute = constraintRight ? .top : .bottom - - flashButtonEdgeConstraint = NSLayoutConstraint( - item: flashButton, - attribute: attribute, - relatedBy: .equal, - toItem: view, - attribute: attribute, - multiplier: 1.0, - constant: constraintRight ? 8 : -8) - view.addConstraint(flashButtonEdgeConstraint!) - } - - /** - * If the device orientation is portrait, pin the - right side of FlashButton to the right side of - * superview. - * Else if, centerX the FlashButton on the CenterX - * of CameraButton. - */ - func configFlashGravityButtonConstraint(_ statusBarOrientation: UIInterfaceOrientation) { - view.autoRemoveConstraint(flashButtonGravityConstraint) - - let constraintRight = statusBarOrientation == .portrait || statusBarOrientation == .landscapeLeft - let attribute : NSLayoutAttribute = constraintRight ? .right : .left - - flashButtonGravityConstraint = NSLayoutConstraint( - item: flashButton, - attribute: attribute, - relatedBy: .equal, - toItem: view, - attribute: attribute, - multiplier: 1.0, - constant: constraintRight ? -8 : 8) - view.addConstraint(flashButtonGravityConstraint!) - } - - /** - * Used to create a perfect square for CameraOverlay. - * This method will determinate the size of CameraOverlay, - * if portrait, it will use the width of superview to - * determinate the height of the view. Else if landscape, - * it uses the height of the superview to create the width - * of the CameraOverlay. - */ - func configCameraOverlayWidthConstraint(_ portrait: Bool) { - view.autoRemoveConstraint(cameraOverlayWidthConstraint) - cameraOverlayWidthConstraint = NSLayoutConstraint( - item: cameraOverlay, - attribute: portrait ? .height : .width, - relatedBy: .equal, - toItem: cameraOverlay, - attribute: portrait ? .width : .height, - multiplier: 1.0, - constant: 0) - view.addConstraint(cameraOverlayWidthConstraint!) - } - - /** - * This method will center the relative position of - * CameraOverlay, based on the biggest size of the - * superview. - */ - func configCameraOverlayCenterConstraint(_ portrait: Bool) { - view.autoRemoveConstraint(cameraOverlayCenterConstraint) - let attribute : NSLayoutAttribute = portrait ? .centerY : .centerX - cameraOverlayCenterConstraint = NSLayoutConstraint( - item: cameraOverlay, - attribute: attribute, - relatedBy: .equal, - toItem: view, - attribute: attribute, - multiplier: 1.0, - constant: 0) - view.addConstraint(cameraOverlayCenterConstraint!) - } - - /** - * Remove the CameraOverlay constraints to be updated when - * the device was rotated. - */ - func removeCameraOverlayEdgesConstraints() { - view.autoRemoveConstraint(cameraOverlayEdgeOneConstraint) - view.autoRemoveConstraint(cameraOverlayEdgeTwoConstraint) - } - - /** - * It needs to get a determined smallest size of the screen - to create the smallest size to be used on CameraOverlay. - It uses the orientation of the screen to determinate where - the view will be pinned. - */ - func configCameraOverlayEdgeOneContraint(_ portrait: Bool, padding: CGFloat) { - let attribute : NSLayoutAttribute = portrait ? .left : .bottom - cameraOverlayEdgeOneConstraint = NSLayoutConstraint( - item: cameraOverlay, - attribute: attribute, - relatedBy: .equal, - toItem: view, - attribute: attribute, - multiplier: 1.0, - constant: padding) - view.addConstraint(cameraOverlayEdgeOneConstraint!) - } - - /** - * It needs to get a determined smallest size of the screen - to create the smallest size to be used on CameraOverlay. - It uses the orientation of the screen to determinate where - the view will be pinned. - */ - func configCameraOverlayEdgeTwoConstraint(_ portrait: Bool, padding: CGFloat) { - let attributeTwo : NSLayoutAttribute = portrait ? .right : .top - cameraOverlayEdgeTwoConstraint = NSLayoutConstraint( - item: cameraOverlay, - attribute: attributeTwo, - relatedBy: .equal, - toItem: view, - attribute: attributeTwo, - multiplier: 1.0, - constant: -padding) - view.addConstraint(cameraOverlayEdgeTwoConstraint!) - } - -} diff --git a/ALCameraViewController/ViewController/ConfirmViewController.swift b/ALCameraViewController/ViewController/ConfirmViewController.swift index dba22b06..6907d4bc 100644 --- a/ALCameraViewController/ViewController/ConfirmViewController.swift +++ b/ALCameraViewController/ViewController/ConfirmViewController.swift @@ -1,365 +1,159 @@ // -// ALConfirmViewController.swift +// ConfirmViewController.swift // ALCameraViewController // -// Created by Alex Littlejohn on 2015/06/30. -// Copyright (c) 2015 zero. All rights reserved. +// Created by Zhu Wu on 8/25/17. +// Copyright © 2017 zero. All rights reserved. // -import UIKit +import Foundation import Photos -public class ConfirmViewController: UIViewController, UIScrollViewDelegate { - - let imageView = UIImageView() - @IBOutlet weak var scrollView: UIScrollView! - @IBOutlet weak var cropOverlay: CropOverlay! - @IBOutlet weak var cancelButton: UIButton! - @IBOutlet weak var confirmButton: UIButton! - @IBOutlet weak var centeringView: UIView! - - var allowsCropping: Bool = false - var verticalPadding: CGFloat = 30 - var horizontalPadding: CGFloat = 30 - - public var onComplete: CameraViewCompletion? - - let asset: PHAsset? - let image: UIImage? - - public init(image: UIImage, allowsCropping: Bool) { - self.allowsCropping = allowsCropping - self.asset = nil - self.image = image - super.init(nibName: "ConfirmViewController", bundle: CameraGlobals.shared.bundle) - } - - public init(asset: PHAsset, allowsCropping: Bool) { - self.allowsCropping = allowsCropping - self.asset = asset - self.image = nil - super.init(nibName: "ConfirmViewController", bundle: CameraGlobals.shared.bundle) - } - - public required init?(coder aDecoder: NSCoder) { - asset = nil - image = nil - super.init(coder: aDecoder) - } - - public override var prefersStatusBarHidden: Bool { - return true - } - - public override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { - return UIStatusBarAnimation.slide - } - - public override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = UIColor.black - - scrollView.addSubview(imageView) - scrollView.delegate = self - scrollView.maximumZoomScale = 1 - - cropOverlay.isHidden = true - - let spinner = showSpinner() - - disable() - - if let asset = asset { - _ = SingleImageFetcher() - .setAsset(asset) - .setTargetSize(largestPhotoSize()) - .onSuccess { [weak self] image in - self?.configureWithImage(image) - self?.hideSpinner(spinner) - self?.enable() - } - .onFailure { [weak self] error in - self?.hideSpinner(spinner) - } - .fetch() - } else if let image = image { - configureWithImage(image) - hideSpinner(spinner) - enable() - } - } - - public override func viewWillLayoutSubviews() { - super.viewWillLayoutSubviews() - let scale = calculateMinimumScale(view.frame.size) - let frame = allowsCropping ? cropOverlay.frame : view.bounds - - scrollView.contentInset = calculateScrollViewInsets(frame) - scrollView.minimumZoomScale = scale - scrollView.zoomScale = scale - centerScrollViewContents() - centerImageViewOnRotate() - } - - public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { - super.viewWillTransition(to: size, with: coordinator) - - let scale = calculateMinimumScale(size) - var frame = view.bounds - - if allowsCropping { - frame = cropOverlay.frame - let centeringFrame = centeringView.frame - var origin: CGPoint - - if size.width > size.height { // landscape - let offset = (size.width - centeringFrame.height) - let expectedX = (centeringFrame.height/2 - frame.height/2) + offset - origin = CGPoint(x: expectedX, y: frame.origin.x) - } else { - let expectedY = (centeringFrame.width/2 - frame.width/2) - origin = CGPoint(x: frame.origin.y, y: expectedY) - } - - frame.origin = origin - } else { - frame.size = size - } - - let insets = calculateScrollViewInsets(frame) - - coordinator.animate(alongsideTransition: { [weak self] context in - self?.scrollView.contentInset = insets - self?.scrollView.minimumZoomScale = scale - self?.scrollView.zoomScale = scale - self?.centerScrollViewContents() - self?.centerImageViewOnRotate() - }, completion: nil) - } - - private func configureWithImage(_ image: UIImage) { - if allowsCropping { - cropOverlay.isHidden = false - } else { - cropOverlay.isHidden = true - } - - buttonActions() - - imageView.image = image - imageView.sizeToFit() - view.setNeedsLayout() - } - - private func calculateMinimumScale(_ size: CGSize) -> CGFloat { - var _size = size - - if allowsCropping { - _size = cropOverlay.frame.size - } - - guard let image = imageView.image else { - return 1 - } - - let scaleWidth = _size.width / image.size.width - let scaleHeight = _size.height / image.size.height - - var scale: CGFloat - - if allowsCropping { - scale = max(scaleWidth, scaleHeight) - } else { - scale = min(scaleWidth, scaleHeight) - } - - return scale - } - - private func calculateScrollViewInsets(_ frame: CGRect) -> UIEdgeInsets { - let bottom = view.frame.height - (frame.origin.y + frame.height) - let right = view.frame.width - (frame.origin.x + frame.width) - let insets = UIEdgeInsets(top: frame.origin.y, left: frame.origin.x, bottom: bottom, right: right) - return insets - } - - private func centerImageViewOnRotate() { - if allowsCropping { - let size = allowsCropping ? cropOverlay.frame.size : scrollView.frame.size - let scrollInsets = scrollView.contentInset - let imageSize = imageView.frame.size - var contentOffset = CGPoint(x: -scrollInsets.left, y: -scrollInsets.top) - contentOffset.x -= (size.width - imageSize.width) / 2 - contentOffset.y -= (size.height - imageSize.height) / 2 - scrollView.contentOffset = contentOffset - } - } - - private func centerScrollViewContents() { - let size = allowsCropping ? cropOverlay.frame.size : scrollView.frame.size - let imageSize = imageView.frame.size - var imageOrigin = CGPoint.zero - - if imageSize.width < size.width { - imageOrigin.x = (size.width - imageSize.width) / 2 - } - - if imageSize.height < size.height { - imageOrigin.y = (size.height - imageSize.height) / 2 - } - - imageView.frame.origin = imageOrigin - } - - private func buttonActions() { - confirmButton.action = { [weak self] in self?.confirmPhoto() } - cancelButton.action = { [weak self] in self?.cancel() } - } - - internal func cancel() { - onComplete?(nil, nil) - } - - internal func confirmPhoto() { - - guard let image = imageView.image else { - return - } - - disable() - - imageView.isHidden = true - - let spinner = showSpinner() - - if let asset = asset { - var fetcher = SingleImageFetcher() - .onSuccess { [weak self] image in - self?.onComplete?(image, self?.asset) - self?.hideSpinner(spinner) - self?.enable() - } - .onFailure { [weak self] error in - self?.hideSpinner(spinner) - self?.showNoImageScreen(error) - } - .setAsset(asset) - if allowsCropping { - let rect = normalizedRect(makeProportionalCropRect(), orientation: image.imageOrientation) - fetcher = fetcher.setCropRect(rect) - } - - fetcher = fetcher.fetch() - } else { - var newImage = image - - if allowsCropping { - let cropRect = makeProportionalCropRect() - let resizedCropRect = CGRect(x: (image.size.width) * cropRect.origin.x, - y: (image.size.height) * cropRect.origin.y, - width: (image.size.width * cropRect.width), - height: (image.size.height * cropRect.height)) - newImage = image.crop(rect: resizedCropRect) - } - - onComplete?(newImage, nil) - hideSpinner(spinner) - enable() - } - } - - public func viewForZooming(in scrollView: UIScrollView) -> UIView? { - return imageView - } - - public func scrollViewDidZoom(_ scrollView: UIScrollView) { - centerScrollViewContents() - } - - func showSpinner() -> UIActivityIndicatorView { - let spinner = UIActivityIndicatorView() - spinner.activityIndicatorViewStyle = .white - spinner.center = view.center - spinner.startAnimating() - - view.addSubview(spinner) - view.bringSubview(toFront: spinner) - - return spinner - } - - func hideSpinner(_ spinner: UIActivityIndicatorView) { - spinner.stopAnimating() - spinner.removeFromSuperview() - } - - func disable() { - confirmButton.isEnabled = false - } - - func enable() { - confirmButton.isEnabled = true - } - - func showNoImageScreen(_ error: NSError) { - let permissionsView = PermissionsView(frame: view.bounds) - - let desc = localizedString("error.cant-fetch-photo.description") - - permissionsView.configureInView(view, title: error.localizedDescription, description: desc, completion: { [weak self] in self?.cancel() }) - } - - private func makeProportionalCropRect() -> CGRect { - var cropRect = cropOverlay.frame - cropRect.origin.x += scrollView.contentOffset.x - cropRect.origin.y += scrollView.contentOffset.y - - let normalizedX = cropRect.origin.x / imageView.frame.width - let normalizedY = cropRect.origin.y / imageView.frame.height - - let normalizedWidth = cropRect.width / imageView.frame.width - let normalizedHeight = cropRect.height / imageView.frame.height - - return CGRect(x: normalizedX, y: normalizedY, width: normalizedWidth, height: normalizedHeight) - } - -} +public class ConfirmViewController: UIViewController { + let image: UIImage? + let asset: PHAsset? + + @IBOutlet weak var imageView: UIImageView! + +// @IBOutlet weak var backButton: UIButton! +// @IBOutlet weak var doneButton: UIButton! + lazy var nextBarButtonItem: UIBarButtonItem = { + var item = UIBarButtonItem(title: localizedString("confirm.done"), style: .plain, target: nil, action: nil) + item.tintColor = #colorLiteral(red: 0.2392156863, green: 0.8274509804, blue: 0.3960784314, alpha: 1) + return item + }() + + lazy var backBarButtonItem: UIBarButtonItem = { + let buttonImage = UIImage(named: "nav_back", in: CameraGlobals.shared.bundle, compatibleWith: nil) + var item = UIBarButtonItem(image: buttonImage, style: .plain, target: nil, action: nil) + return item + }() -extension UIImage { - func crop(rect: CGRect) -> UIImage { + + public var onComplete: CameraViewCompletion? + - var rectTransform: CGAffineTransform - switch imageOrientation { - case .left: - rectTransform = CGAffineTransform(rotationAngle: radians(90)).translatedBy(x: 0, y: -size.height) - case .right: - rectTransform = CGAffineTransform(rotationAngle: radians(-90)).translatedBy(x: -size.width, y: 0) - case .down: - rectTransform = CGAffineTransform(rotationAngle: radians(-180)).translatedBy(x: -size.width, y: -size.height) - default: - rectTransform = CGAffineTransform.identity - } - - rectTransform = rectTransform.scaledBy(x: scale, y: scale) - - if let cropped = cgImage?.cropping(to: rect.applying(rectTransform)) { - return UIImage(cgImage: cropped, scale: scale, orientation: imageOrientation).fixOrientation() - } - - return self - } - - func fixOrientation() -> UIImage { - if imageOrientation == .up { - return self - } - - UIGraphicsBeginImageContextWithOptions(size, false, scale) - draw(in: CGRect(origin: .zero, size: size)) - let normalizedImage: UIImage = UIGraphicsGetImageFromCurrentImageContext() ?? self - UIGraphicsEndImageContext() - - return normalizedImage - } + public override var prefersStatusBarHidden: Bool { + return true + } + + public override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { + return UIStatusBarAnimation.slide + } + + open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return .portrait + } + + public init(_ image: UIImage?, _ asset: PHAsset?) { + self.image = image + self.asset = asset + super.init(nibName: "ConfirmViewController", bundle: CameraGlobals.shared.bundle) + } + + public required init?(coder aDecoder: NSCoder) { + image = nil + asset = nil + super.init(coder: aDecoder) + } + + public override func viewDidLoad() { + super.viewDidLoad() + + self.title = localizedString("confirm.viewtitle") + self.navigationItem.leftBarButtonItem = backBarButtonItem + + if let image = image { + configureWithImage(image) + self.navigationItem.rightBarButtonItem = nextBarButtonItem + } + } + + private func configureWithImage(_ image: UIImage) { + setupButtonActions() + + imageView.image = image + } + + func setupButtonActions() { + backBarButtonItem.itemAction = { [weak self] in self?.navigationController?.popViewController(animated: true) } + nextBarButtonItem.itemAction = { [weak self] in self?.confirmPhoto() } + } + + func confirmPhoto() { + + guard let image = imageView.image else { + return + } + + disable() + +// imageView.isHidden = true + + let spinner = showSpinner() + +// if let asset = asset { +// var fetcher = SingleImageFetcher() +// .onSuccess { [weak self] image in +// self?.onComplete?(image, self?.asset) +// self?.hideSpinner(spinner) +// self?.enable() +// } +// .onFailure { [weak self] error in +// self?.hideSpinner(spinner) +// self?.showNoImageScreen(error) +// } +// .setAsset(asset) +// if allowsCropping { +// let rect = normalizedRect(makeProportionalCropRect(), orientation: image.imageOrientation) +// fetcher = fetcher.setCropRect(rect) +// } +// +// fetcher = fetcher.fetch() +// } else { + let newImage = image + + onComplete?(newImage, asset) + hideSpinner(spinner) + enable() +// } + } + + internal func cancel() { + onComplete?(nil, nil) + } + + func showSpinner() -> UIActivityIndicatorView { + let spinner = UIActivityIndicatorView() + spinner.activityIndicatorViewStyle = .white + spinner.center = view.center + spinner.startAnimating() + + view.addSubview(spinner) + view.bringSubview(toFront: spinner) + + return spinner + } + + func hideSpinner(_ spinner: UIActivityIndicatorView) { + spinner.stopAnimating() + spinner.removeFromSuperview() + } + + func disable() { + nextBarButtonItem.isEnabled = false + } + + func enable() { + nextBarButtonItem.isEnabled = true + } + + func showNoImageScreen(_ error: NSError) { + let permissionsView = PermissionsView(frame: view.bounds) + + let desc = localizedString("error.cant-fetch-photo.description") + + permissionsView.configureInView(view, title: error.localizedDescription, description: desc, completion: { [weak self] in self?.cancel() }) + } } + diff --git a/ALCameraViewController/ViewController/ConfirmViewController.xib b/ALCameraViewController/ViewController/ConfirmViewController.xib deleted file mode 100644 index fd8a355a..00000000 --- a/ALCameraViewController/ViewController/ConfirmViewController.xib +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ALCameraViewController/ViewController/CropViewController.swift b/ALCameraViewController/ViewController/CropViewController.swift new file mode 100644 index 00000000..f4769db7 --- /dev/null +++ b/ALCameraViewController/ViewController/CropViewController.swift @@ -0,0 +1,453 @@ +// +// ALCropViewController.swift +// ALCameraViewController +// +// Created by Alex Littlejohn on 2015/06/30. +// Copyright (c) 2015 zero. All rights reserved. +// + +import UIKit +import Photos +import AVFoundation + +public class CropViewController: UIViewController, UIScrollViewDelegate { + + let imageView = UIImageView() + @IBOutlet weak var scrollView: UIScrollView! + @IBOutlet weak var cropOverlayHeight: NSLayoutConstraint! + @IBOutlet weak var cropOverlayWidth: NSLayoutConstraint! + @IBOutlet weak var cropOverlay: OverlayView! + lazy var nextBarButtonItem: UIBarButtonItem = { + var item = UIBarButtonItem(title: localizedString("crop.next"), style: .plain, target: nil, action: nil) + return item + }() + + lazy var backBarButtonItem: UIBarButtonItem = { + let buttonImage = UIImage(named: "nav_back", in: CameraGlobals.shared.bundle, compatibleWith: nil) + var item = UIBarButtonItem(image: buttonImage, style: .plain, target: nil, action: nil) + return item + }() + + @IBOutlet weak var borderDetectionButton: UIButton! + @IBOutlet weak var screenshotSizeButton: UIButton! + @IBOutlet weak var fullImageButton: UIButton! + @IBOutlet weak var squareImageButton: UIButton! + @IBOutlet weak var a4SizeButton: UIButton! + + var allowsCropping: Bool = false + + public var onComplete: CameraViewCompletion? + + let asset: PHAsset? + let image: UIImage? + + public init(image: UIImage, allowsCropping: Bool) { + self.allowsCropping = allowsCropping + self.asset = nil + self.image = image + super.init(nibName: "CropViewController", bundle: CameraGlobals.shared.bundle) + } + + public init(asset: PHAsset, allowsCropping: Bool) { + self.allowsCropping = allowsCropping + self.asset = asset + self.image = nil + super.init(nibName: "CropViewController", bundle: CameraGlobals.shared.bundle) + } + + public required init?(coder aDecoder: NSCoder) { + asset = nil + image = nil + super.init(coder: aDecoder) + } + + public override var prefersStatusBarHidden: Bool { + return true + } + + public override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { + return UIStatusBarAnimation.slide + } + + open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return .portrait + } + + public override func viewDidLoad() { + super.viewDidLoad() + + self.navigationItem.title = localizedString("crop.viewtitle") + self.navigationItem.rightBarButtonItem = self.nextBarButtonItem + self.navigationItem.leftBarButtonItem = self.backBarButtonItem + + scrollView.addSubview(imageView) + scrollView.delegate = self + scrollView.maximumZoomScale = 1 + + cropOverlay.isHidden = true + + let spinner = showSpinner() + + disable() + + if let asset = asset { + _ = SingleImageFetcher() + .setAsset(asset) + .setTargetSize(largestPhotoSize()) + .onSuccess { [weak self] image in + self?.configureWithImage(image) + self?.hideSpinner(spinner) + self?.enable() + } + .onFailure { [weak self] error in + self?.hideSpinner(spinner) + } + .fetch() + } else if let image = image { + configureWithImage(image) + hideSpinner(spinner) + enable() + } + } + + public override func viewWillLayoutSubviews() { + super.viewWillLayoutSubviews() + let scale = calculateMinimumScale(scrollView.frame.size) + let frame = scrollView.bounds + + scrollView.contentInset = calculateScrollViewInsets(frame) + scrollView.minimumZoomScale = scale + scrollView.maximumZoomScale = scale + scrollView.zoomScale = scale + centerScrollViewContents() +// centerImageViewOnRotate() + centerOverlayView() + + } + + public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { + super.viewWillTransition(to: size, with: coordinator) + + let scale = calculateMinimumScale(size) + var frame = view.bounds + + if allowsCropping { + frame = scrollView.frame + let centeringFrame = scrollView.frame + var origin: CGPoint + + if size.width > size.height { // landscape + let offset = (size.width - centeringFrame.height) + let expectedX = (centeringFrame.height/2 - frame.height/2) + offset + origin = CGPoint(x: expectedX, y: frame.origin.x) + } else { + let expectedY = (centeringFrame.width/2 - frame.width/2) + origin = CGPoint(x: frame.origin.y, y: expectedY) + } + + frame.origin = origin + } else { + frame.size = size + } + + let insets = calculateScrollViewInsets(frame) + + coordinator.animate(alongsideTransition: { [weak self] context in + self?.scrollView.contentInset = insets + self?.scrollView.minimumZoomScale = scale + self?.scrollView.zoomScale = scale + self?.centerScrollViewContents() + self?.centerImageViewOnRotate() + self?.centerOverlayView() + }, completion: nil) + } + + private func configureWithImage(_ image: UIImage) { + if allowsCropping { + cropOverlay.isHidden = false + } else { + cropOverlay.isHidden = true + } + + buttonActions() + + imageView.image = image + imageView.sizeToFit() + view.setNeedsLayout() + view.layoutIfNeeded() + self.selectAllBorders() + } + + private func calculateMinimumScale(_ size: CGSize) -> CGFloat { + let _size = size +// +// if allowsCropping { +// _size = cropOverlay.frame.size +// } + + guard let image = imageView.image else { + return 1 + } + + let scaleWidth = _size.width / image.size.width + let scaleHeight = _size.height / image.size.height + + var scale: CGFloat + + if allowsCropping { + scale = min(scaleWidth, scaleHeight) + } else { + scale = min(scaleWidth, scaleHeight) + } + + return scale + } + + private func calculateScrollViewInsets(_ frame: CGRect) -> UIEdgeInsets { + let bottom = scrollView.frame.height - (frame.origin.y + frame.height) + let right = scrollView.frame.width - (frame.origin.x + frame.width) + let insets = UIEdgeInsets(top: frame.origin.y, left: frame.origin.x, bottom: bottom, right: right) + return insets + } + + private func centerImageViewOnRotate() { + if allowsCropping { +// let size = allowsCropping ? cropOverlay.frame.size : scrollView.frame.size + let size = scrollView.frame.size + + let scrollInsets = scrollView.contentInset + let imageSize = imageView.frame.size + var contentOffset = CGPoint(x: -scrollInsets.left, y: -scrollInsets.top) + contentOffset.x -= (size.width - imageSize.width) / 2 + contentOffset.y -= (size.height - imageSize.height) / 2 + scrollView.contentOffset = contentOffset + } + } + + private func centerScrollViewContents() { +// let size = allowsCropping ? cropOverlay.frame.size : scrollView.frame.size + let size = scrollView.frame.size + + let imageSize = imageView.frame.size + var imageOrigin = CGPoint.zero + + if imageSize.width < size.width { + imageOrigin.x = (size.width - imageSize.width) / 2 + } + + if imageSize.height < size.height { + imageOrigin.y = (size.height - imageSize.height) / 2 + } + + imageView.frame.origin = imageOrigin + } + + func centerOverlayView() { + let frame = scrollView.convert(imageView.frame, to: self.view) + cropOverlayWidth.constant = frame.size.width + cropOverlayHeight.constant = frame.size.height + cropOverlay.setNeedsDisplay() + } + + private func buttonActions() { + nextBarButtonItem.itemAction = { [weak self] in self?.confirmPhoto() } + backBarButtonItem.itemAction = { [weak self] in self?.cancel() } + borderDetectionButton.action = { [weak self] in self?.detectBorders() } + fullImageButton.action = { [weak self] in self?.selectAllBorders()} + a4SizeButton.action = { [weak self] in self?.selectA4Size()} + squareImageButton.action = { [weak self] in self?.selectSquareSize()} + screenshotSizeButton.action = { [weak self] in self?.selectWithoutStatusbar()} + } + + func detectBorders() { + if cropOverlay.detectBorders(imageView) { + print("found borders") + } + else { + print("no borders") + } + } + + func selectAllBorders() { + cropOverlay.layoutButtons() + } + + func selectSquareSize() { + let imageRect = imageView.bounds.applying(CGAffineTransform(scaleX: scrollView.zoomScale, y: scrollView.zoomScale)) + + let rect = AVMakeRect(aspectRatio: CGSize.init(width: 1, height: 1), insideRect: imageRect) + + cropOverlay.layoutButtons(UIEdgeInsetsMake(rect.topLeft.y, rect.topLeft.x, imageRect.size.height-rect.bottomRight.y, imageRect.size.width-rect.bottomRight.x)) + } + + func selectA4Size() { + //calculate a size that's A4 + let imageRect = imageView.bounds.applying(CGAffineTransform(scaleX: scrollView.zoomScale, y: scrollView.zoomScale)) + + let rect = AVMakeRect(aspectRatio: CGSize.init(width: 1, height: 1.414), insideRect: imageRect) + + cropOverlay.layoutButtons(UIEdgeInsetsMake(rect.topLeft.y, rect.topLeft.x, imageRect.size.height-rect.bottomRight.y, imageRect.size.width-rect.bottomRight.x)) + + } + + func selectWithoutStatusbar() { + cropOverlay.layoutButtons(UIEdgeInsetsMake(20, 0, 0, 0)) + } + + internal func cancel() { + self.navigationController?.popViewController(animated: true) +// onComplete?(nil, nil) + } + + internal func confirmPhoto() { + + guard let image = imageView.image else { + return + } + + disable() + + let spinner = showSpinner() + +// if let asset = asset { +// var fetcher = SingleImageFetcher() +// .onSuccess { [weak self] image in +// self?.onComplete?(image, self?.asset) +// self?.hideSpinner(spinner) +// self?.enable() +// } +// .onFailure { [weak self] error in +// self?.hideSpinner(spinner) +// self?.showNoImageScreen(error) +// } +// .setAsset(asset) +// if allowsCropping { +// let rect = normalizedRect(makeProportionalCropRect(), orientation: image.imageOrientation) +// fetcher = fetcher.setCropRect(rect) +// } +// +// fetcher = fetcher.fetch() +// } else { + var newImage = image + + if allowsCropping { + newImage = cropOverlay.cropImage(imageView) +// let cropRect = makeProportionalCropRect() +// let resizedCropRect = CGRect(x: (image.size.width) * cropRect.origin.x, +// y: (image.size.height) * cropRect.origin.y, +// width: (image.size.width * cropRect.width), +// height: (image.size.height * cropRect.height)) +// newImage = image.crop(rect: resizedCropRect) + self.startConfimController(uiImage: newImage) + } + else { + self.onComplete?(newImage,asset) + } + hideSpinner(spinner) + enable() +// } + } + + public func viewForZooming(in scrollView: UIScrollView) -> UIView? { + return imageView + } + + public func scrollViewDidZoom(_ scrollView: UIScrollView) { + centerScrollViewContents() + } + + func showSpinner() -> UIActivityIndicatorView { + let spinner = UIActivityIndicatorView() + spinner.activityIndicatorViewStyle = .whiteLarge + spinner.center = view.center + spinner.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin] + spinner.startAnimating() + spinner.sizeToFit() + + view.addSubview(spinner) + view.bringSubview(toFront: spinner) + + return spinner + } + + func hideSpinner(_ spinner: UIActivityIndicatorView) { + spinner.stopAnimating() + spinner.removeFromSuperview() + } + + func disable() { + nextBarButtonItem.isEnabled = false + } + + func enable() { + nextBarButtonItem.isEnabled = true + } + + func showNoImageScreen(_ error: NSError) { + let permissionsView = PermissionsView(frame: view.bounds) + + let desc = localizedString("error.cant-fetch-photo.description") + + permissionsView.configureInView(view, title: error.localizedDescription, description: desc, completion: { [weak self] in self?.cancel() }) + } + + private func makeProportionalCropRect() -> CGRect { + var cropRect = cropOverlay.frame + cropRect.origin.x += scrollView.contentOffset.x + cropRect.origin.y += scrollView.contentOffset.y + + let normalizedX = cropRect.origin.x / imageView.frame.width + let normalizedY = cropRect.origin.y / imageView.frame.height + + let normalizedWidth = cropRect.width / imageView.frame.width + let normalizedHeight = cropRect.height / imageView.frame.height + + return CGRect(x: normalizedX, y: normalizedY, width: normalizedWidth, height: normalizedHeight) + } + + private func startConfimController(uiImage: UIImage) { + + let filterController = FilterViewController(uiImage, asset) + filterController.onComplete = onComplete + self.navigationController?.pushViewController(filterController, animated: true) + } + +} + +extension UIImage { + func crop(rect: CGRect) -> UIImage { + + var rectTransform: CGAffineTransform + switch imageOrientation { + case .left: + rectTransform = CGAffineTransform(rotationAngle: radians(90)).translatedBy(x: 0, y: -size.height) + case .right: + rectTransform = CGAffineTransform(rotationAngle: radians(-90)).translatedBy(x: -size.width, y: 0) + case .down: + rectTransform = CGAffineTransform(rotationAngle: radians(-180)).translatedBy(x: -size.width, y: -size.height) + default: + rectTransform = CGAffineTransform.identity + } + + rectTransform = rectTransform.scaledBy(x: scale, y: scale) + + if let cropped = cgImage?.cropping(to: rect.applying(rectTransform)) { + return UIImage(cgImage: cropped, scale: scale, orientation: imageOrientation).fixOrientation() + } + + return self + } + + func fixOrientation() -> UIImage { + if imageOrientation == .up { + return self + } + + UIGraphicsBeginImageContextWithOptions(size, false, scale) + draw(in: CGRect(origin: .zero, size: size)) + let normalizedImage: UIImage = UIGraphicsGetImageFromCurrentImageContext() ?? self + UIGraphicsEndImageContext() + + return normalizedImage + } +} diff --git a/ALCameraViewController/ViewController/FilterViewController.swift b/ALCameraViewController/ViewController/FilterViewController.swift new file mode 100644 index 00000000..2dae1cce --- /dev/null +++ b/ALCameraViewController/ViewController/FilterViewController.swift @@ -0,0 +1,152 @@ +// +// FilterViewController.swift +// ALCameraViewController +// +// Created by Narek Simonyan on 10/28/17. +// Copyright © 2017 zero. All rights reserved. +// + +import UIKit +import Photos + +class FilterViewController: UIViewController { + + @IBOutlet var filterView: UIView! + +// @IBOutlet var doneButton: UIButton! + lazy var nextBarButtonItem: UIBarButtonItem = { + var item = UIBarButtonItem(title: localizedString("crop.next"), style: .plain, target: nil, action: nil) + return item + }() + + lazy var backBarButtonItem: UIBarButtonItem = { + let buttonImage = UIImage(named: "nav_back", in: CameraGlobals.shared.bundle, compatibleWith: nil) + var item = UIBarButtonItem(image: buttonImage, style: .plain, target: nil, action: nil) + return item + }() + + +// @IBOutlet var backButton: UIButton! + @IBOutlet var imageView: UIImageView! + @IBOutlet var grayFilter: UIButton! + @IBOutlet var colorFilter: UIButton! + @IBOutlet var exposureFilter: UIButton! + @IBOutlet var bwFilter: UIButton! + @IBOutlet var filterIntensitySlider: UISlider! + + let image: UIImage? + let asset: PHAsset? + + var filterType:ImageFilterPreset = ImageFilterPresetOriginal { + didSet { + apply() + } + } + var filterIntensity: Float = 0.3 { + didSet { + apply() + } + } + + public var onComplete: CameraViewCompletion? + + public override var prefersStatusBarHidden: Bool { + return true + } + + public override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { + return UIStatusBarAnimation.slide + } + + open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return .portrait + } + + public init(_ image: UIImage?, _ asset: PHAsset?) { + self.image = image + self.asset = asset + super.init(nibName: "FilterViewController", bundle: CameraGlobals.shared.bundle) + } + + public required init?(coder aDecoder: NSCoder) { + image = nil + asset = nil + super.init(coder: aDecoder) + } + + override func viewDidLoad() { + super.viewDidLoad() + imageView.image = image + self.title = localizedString("filter.viewtitle") + self.navigationItem.rightBarButtonItem = nextBarButtonItem + self.navigationItem.leftBarButtonItem = self.backBarButtonItem + setupButtonActions() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + } + + internal func setupButtonActions() { + nextBarButtonItem.itemAction = { [weak self] in self?.confirmPhoto() } + backBarButtonItem.itemAction = { [weak self] in self?.navigationController?.popViewController(animated: true)} + + grayFilter.action = { [weak self] in + guard let strongSelf = self else {return} + strongSelf.applyFilter(sender: strongSelf.grayFilter) + } + colorFilter.action = { [weak self] in + guard let strongSelf = self else {return} + strongSelf.applyFilter(sender: strongSelf.colorFilter)} + exposureFilter.action = { [weak self] in + guard let strongSelf = self else {return} + strongSelf.applyFilter(sender: strongSelf.exposureFilter) + } + bwFilter.action = { [weak self] in + guard let strongSelf = self else {return} + strongSelf.applyFilter(sender: strongSelf.bwFilter) + } + } + + internal func confirmPhoto() { + guard let image = imageView.image?.withFilterPreset(filterType, intensity: filterIntensity) else { + return + } + let confirmController = ConfirmViewController(image, asset) + + confirmController.onComplete = { [weak self] image, asset in + guard let image = image else { + return + } + + self?.onComplete?(image, asset) + self?.onComplete = nil + } + + self.navigationController?.pushViewController(confirmController, animated: true) + } + + internal func applyFilter (sender: UIButton) { + let dictionary = [grayFilter:ImageFilterPresetGrayScale, + bwFilter:ImageFilterPresetBlackAndWhite, + exposureFilter:ImageFilterPresetEnhanceExposure, + colorFilter:ImageFilterPresetEnhanceColor] + + guard let filter = dictionary[sender] else { + return + } + + _ = [grayFilter,colorFilter,exposureFilter,bwFilter].map({$0?.isSelected = false}) + sender.isSelected = true + filterIntensitySlider.isEnabled = true + filterType = filter + } + + internal func apply() { + imageView.applyFilter(with: filterType, intensity: filterIntensity) + } + + @IBAction func filterIntensityChanged(_ sender: UISlider) { + filterIntensity = sender.value + } +} diff --git a/ALCameraViewController/ViewController/PhotoLibraryViewController.swift b/ALCameraViewController/ViewController/PhotoLibraryViewController.swift index 8abb0a9e..46a02b52 100644 --- a/ALCameraViewController/ViewController/PhotoLibraryViewController.swift +++ b/ALCameraViewController/ViewController/PhotoLibraryViewController.swift @@ -21,6 +21,13 @@ public class PhotoLibraryViewController: UIViewController { public var onSelectionComplete: PhotoLibraryViewSelectionComplete? + + lazy var backBarButtonItem: UIBarButtonItem = { + let buttonImage = UIImage(named: "nav_back", in: CameraGlobals.shared.bundle, compatibleWith: nil) + var item = UIBarButtonItem(image: buttonImage, style: .plain, target: self, action: #selector(dismissLibrary)) + return item + }() + private lazy var collectionView: UICollectionView = { let layout = UICollectionViewFlowLayout() @@ -40,14 +47,10 @@ public class PhotoLibraryViewController: UIViewController { setNeedsStatusBarAppearanceUpdate() - let buttonImage = UIImage(named: "libraryCancel", in: CameraGlobals.shared.bundle, compatibleWith: nil)?.withRenderingMode(UIImageRenderingMode.alwaysOriginal) - - navigationItem.leftBarButtonItem = UIBarButtonItem(image: buttonImage, - style: UIBarButtonItemStyle.plain, - target: self, - action: #selector(dismissLibrary)) + self.title = localizedString("libray.title") - view.backgroundColor = UIColor(white: 0.2, alpha: 1) + navigationItem.leftBarButtonItem = self.backBarButtonItem + view.backgroundColor = #colorLiteral(red: 0.9450980392, green: 0.9490196078, blue: 0.9647058824, alpha: 1) view.addSubview(collectionView) _ = ImageFetcher() @@ -68,12 +71,15 @@ public class PhotoLibraryViewController: UIViewController { public func present(_ inViewController: UIViewController, animated: Bool) { let navigationController = UINavigationController(rootViewController: self) navigationController.navigationBar.barTintColor = UIColor.black + navigationController.navigationBar.tintColor = UIColor.black navigationController.navigationBar.barStyle = UIBarStyle.black + navigationController.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.black] inViewController.present(navigationController, animated: animated, completion: nil) } public func dismissLibrary() { - onSelectionComplete?(nil) +// onSelectionComplete?(nil) + self.navigationController?.popViewController(animated: true) } private func onSuccess(_ photos: PHFetchResult) { diff --git a/ALCameraViewController/ViewController/zh-Hans.lproj/CameraViewController.strings b/ALCameraViewController/ViewController/zh-Hans.lproj/CameraViewController.strings new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/ALCameraViewController/ViewController/zh-Hans.lproj/CameraViewController.strings @@ -0,0 +1 @@ + diff --git a/ALCameraViewController/ViewController/zh-Hans.lproj/ConfirmViewController.strings b/ALCameraViewController/ViewController/zh-Hans.lproj/ConfirmViewController.strings new file mode 100644 index 00000000..8cb6b126 --- /dev/null +++ b/ALCameraViewController/ViewController/zh-Hans.lproj/ConfirmViewController.strings @@ -0,0 +1,9 @@ + +/* Class = "UIButton"; normalTitle = "Back"; ObjectID = "Cqb-xM-psR"; */ +"Cqb-xM-psR.normalTitle" = "后退"; + +/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "Qmn-Qj-BLU"; */ +"Qmn-Qj-BLU.normalTitle" = "完成"; + +/* Class = "UILabel"; text = "Confirm"; ObjectID = "l6r-RK-gpT"; */ +"l6r-RK-gpT.text" = "确认图片"; diff --git a/ALCameraViewController/ViewController/zh-Hans.lproj/CropViewController.strings b/ALCameraViewController/ViewController/zh-Hans.lproj/CropViewController.strings new file mode 100644 index 00000000..73c11fd5 --- /dev/null +++ b/ALCameraViewController/ViewController/zh-Hans.lproj/CropViewController.strings @@ -0,0 +1,18 @@ + +/* Class = "UILabel"; text = "Full"; ObjectID = "Iio-Kg-QnA"; */ +"Iio-Kg-QnA.text" = "完整图片"; + +/* Class = "UILabel"; text = "Crop"; ObjectID = "Nu1-rL-d4h"; */ +"Nu1-rL-d4h.text" = "裁剪"; + +/* Class = "UILabel"; text = "Screenshot"; ObjectID = "QBH-wN-Sld"; */ +"QBH-wN-Sld.text" = "截图"; + +/* Class = "UILabel"; text = "Square"; ObjectID = "Yj4-1r-gUF"; */ +"Yj4-1r-gUF.text" = "正方形"; + +/* Class = "UILabel"; text = "A4"; ObjectID = "pyk-uS-D60"; */ +"pyk-uS-D60.text" = "A4"; + +/* Class = "UILabel"; text = "Border"; ObjectID = "vd8-B9-h7L"; */ +"vd8-B9-h7L.text" = "边缘检测"; diff --git a/ALCameraViewController/ViewController/zh-Hans.lproj/FilterViewController.strings b/ALCameraViewController/ViewController/zh-Hans.lproj/FilterViewController.strings new file mode 100644 index 00000000..a714edba --- /dev/null +++ b/ALCameraViewController/ViewController/zh-Hans.lproj/FilterViewController.strings @@ -0,0 +1,12 @@ + +/* Class = "UILabel"; text = "Color+"; ObjectID = "MFt-9T-uYL"; */ +"MFt-9T-uYL.text" = "色彩+"; + +/* Class = "UILabel"; text = "Exposure+"; ObjectID = "Wfe-V4-yfh"; */ +"Wfe-V4-yfh.text" = "亮度+"; + +/* Class = "UILabel"; text = "Gray Scale"; ObjectID = "jXA-bf-oh0"; */ +"jXA-bf-oh0.text" = "灰度"; + +/* Class = "UILabel"; text = "B&W"; ObjectID = "p3W-3n-9Jn"; */ +"p3W-3n-9Jn.text" = "黑白"; diff --git a/ALCameraViewController/Views/CameraView.swift b/ALCameraViewController/Views/CameraView.swift index 67a30f4c..f5d265c8 100644 --- a/ALCameraViewController/Views/CameraView.swift +++ b/ALCameraViewController/Views/CameraView.swift @@ -151,10 +151,10 @@ public class CameraView: UIView { return devices.filter { $0.position == position }.first } - public func capturePhoto(completion: @escaping CameraShotCompletion) { + public func capturePhoto(_ orientation: UIInterfaceOrientation = UIApplication.shared.statusBarOrientation, _ completion: @escaping CameraShotCompletion) { isUserInteractionEnabled = false - guard let output = imageOutput, let orientation = AVCaptureVideoOrientation(rawValue: UIDevice.current.orientation.rawValue) else { + guard let output = imageOutput, let orientation = AVCaptureVideoOrientation(rawValue: orientation.rawValue) else { completion(nil) return } @@ -200,6 +200,7 @@ public class CameraView: UIView { } do { + // TODO: Change this to torch mode try device.lockForConfiguration() if device.flashMode == .on { device.flashMode = .off @@ -239,12 +240,12 @@ public class CameraView: UIView { session.commitConfiguration() } - public func rotatePreview() { + public func rotatePreview(_ orientation: UIInterfaceOrientation = UIApplication.shared.statusBarOrientation) { guard preview != nil else { return } - switch UIApplication.shared.statusBarOrientation { + switch orientation { case .portrait: preview?.connection.videoOrientation = AVCaptureVideoOrientation.portrait break diff --git a/ALCameraViewController/Views/OverlayView.swift b/ALCameraViewController/Views/OverlayView.swift new file mode 100644 index 00000000..12b40463 --- /dev/null +++ b/ALCameraViewController/Views/OverlayView.swift @@ -0,0 +1,221 @@ +// +// OverlayView.swift +// Instashot +// +// Created by Zhu Wu on 8/19/17. +// Copyright © 2017 Skrapit Ltd. All rights reserved. +// + +import Foundation +import UIKit +import UIKit.UIGestureRecognizerSubclass + +class OverlayView: UIView { + lazy var topLeftButton: UIView = { + let btn = UIImageView(image: UIImage(named: "anchorButton", + in: CameraGlobals.shared.bundle, + compatibleWith: nil)) + btn.bounds = CGRect(origin: CGPoint.zero, size: CGSize(width: 28, height: 28)) + return btn + }() + + + lazy var topRightButton: UIView = { + let btn = UIImageView(image: UIImage(named: "anchorButton", + in: CameraGlobals.shared.bundle, + compatibleWith: nil)) + btn.bounds = CGRect(origin: CGPoint.zero, size: CGSize(width: 28, height: 28)) + return btn + }() + + lazy var bottomLeftButton: UIView = { + let btn = UIImageView(image: UIImage(named: "anchorButton", + in: CameraGlobals.shared.bundle, + compatibleWith: nil)) + btn.bounds = CGRect(origin: CGPoint.zero, size: CGSize(width: 28, height: 28)) + return btn + }() + + lazy var bottomRightButton: UIView = { + let btn = UIImageView(image: UIImage(named: "anchorButton", + in: CameraGlobals.shared.bundle, + compatibleWith: nil)) + btn.bounds = CGRect(origin: CGPoint.zero, size: CGSize(width: 28, height: 28)) + return btn + }() + + + override init(frame: CGRect) { + super.init(frame: frame) + setupButtons() + + self.backgroundColor = #colorLiteral(red: 0.1803921569, green: 0.2039215686, blue: 0.2392156863, alpha: 0.5) + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setupButtons() + + self.backgroundColor = #colorLiteral(red: 0.1803921569, green: 0.2039215686, blue: 0.2392156863, alpha: 0.5) + } + + override func layoutSubviews() { + super.layoutSubviews() + + } + + func setupButtons() { + _ = [topLeftButton,topRightButton,bottomLeftButton,bottomRightButton].map({ + $0.autoresizingMask = [.flexibleTopMargin, .flexibleBottomMargin,.flexibleLeftMargin,.flexibleRightMargin] + addSubview($0) + }) + + self.addGestureRecognizer(UIPanViewGestureRecognizer(target: self, action: #selector(parentPan))) + + self.layoutButtons() + } + + func detectBorders(_ underneathImage: UIImageView) -> Bool { + let imageView = underneathImage + let ciContext = CIContext() + let ciImage = CIImage(image: imageView.image!)! + + let detector = CIDetector(ofType: CIDetectorTypeRectangle, + context: ciContext, + options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])! + + let features = detector.features(in: ciImage) + + // MARK: CIDetectorTypeRectangle only detects one rectangle + if let rect = features.first as? CIRectangleFeature { + self.layoutButtons(rect, imageView.image!.size) + return true + } + + return false + } + + func layoutButtons(_ edgeInset: UIEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)) { + topLeftButton.center = self.bounds.topLeft.translate(edgeInset.left, dy: edgeInset.top) + topRightButton.center = self.bounds.topRight.translate(-edgeInset.right, dy: edgeInset.top) + bottomLeftButton.center = self.bounds.bottomLeft.translate(edgeInset.left, dy: -edgeInset.bottom) + bottomRightButton.center = self.bounds.bottomRight.translate(-edgeInset.right, dy: -edgeInset.bottom) + setNeedsDisplay() + } + + func layoutButtons(_ rectFeature: CIRectangleFeature, _ imageSize: CGSize) { + let scaleTransform = CGAffineTransform(scaleX: self.bounds.size.width/imageSize.width, y: self.bounds.size.height/imageSize.height) + + topLeftButton.center = rectFeature.topLeft.ciPointIn(imageSize).applying(scaleTransform) + topRightButton.center = rectFeature.topRight.ciPointIn(imageSize).applying(scaleTransform) + bottomLeftButton.center = rectFeature.bottomLeft.ciPointIn(imageSize).applying(scaleTransform) + bottomRightButton.center = rectFeature.bottomRight.ciPointIn(imageSize).applying(scaleTransform) + setNeedsDisplay() + } + + func cropImage(_ imageView:UIImageView) -> UIImage { + let ciImage = CIImage(image: imageView.image!)! + + var t = CGAffineTransform(scaleX: 1, y: -1) + t = t.translatedBy(x: 0, y: -imageView.frame.size.height) + let scaleTransform = CGAffineTransform(scaleX: imageView.image!.size.width/imageView.frame.size.width, y: imageView.image!.size.height/imageView.frame.size.height) + + let topLeft = self.topLeftButton.frame.center.applying(t).applying(scaleTransform) + let topRight = self.topRightButton.frame.center.applying(t).applying(scaleTransform) + let bottomLeft = self.bottomLeftButton.frame.center.applying(t).applying(scaleTransform) + let bottomRight = self.bottomRightButton.frame.center.applying(t).applying(scaleTransform) + + + let points = [NSValue(cgPoint: topLeft), + NSValue(cgPoint: topRight), + NSValue(cgPoint: bottomLeft), + NSValue(cgPoint: bottomRight)] + + let image = ciImage.correctPerspective(withCGPoints: points)!.makeUIImage(with: CIContext()) + + return image! + } + + override func draw(_ rect: CGRect) { + self.backgroundColor?.setFill() + UIRectFillUsingBlendMode(rect, .hardLight) + + // connect buttons via straight lines + let path = UIBezierPath() + path.move(to: topLeftButton.center) + path.addLine(to: topRightButton.center) + path.addLine(to: bottomRightButton.center) + path.addLine(to: bottomLeftButton.center) + path.close() + + + let context = UIGraphicsGetCurrentContext()! + + context.saveGState() + context.setBlendMode(.destinationOut) + + //set fill color + UIColor.white.setFill() + //draw the fill and stroke + path.fill() + + context.restoreGState() + + let lineWidth:CGFloat = 1.5 + path.lineWidth = lineWidth + #colorLiteral(red: 0.1803921569, green: 0.2039215686, blue: 0.2392156863, alpha: 1).setStroke() + path.stroke() + + } + + func parentPan(_ sender: UIPanViewGestureRecognizer) { + switch sender.state { + case .began: + sender.attachedView = self.anchor(_contains: sender.location(in: self)) + break + case .changed: + guard let view = sender.attachedView else { return } + var location = sender.location(in: self) + location.x = max(self.bounds.minX, location.x) + location.x = min(self.bounds.maxX, location.x) + location.y = max(self.bounds.minY, location.y) + location.y = min(self.bounds.maxY, location.y) + view.center = location + self.setNeedsDisplay() + break + default: + sender.attachedView = nil + break + + } + } + + func anchor(_contains point:CGPoint) -> UIView? { + return [topLeftButton,topRightButton,bottomLeftButton,bottomRightButton].first(where: { (view) -> Bool in + let frame = view.frame.insetBy(dx: -30, dy: -30) + return frame.contains(point) + }) + } + +} + +class UIPanViewGestureRecognizer: UIPanGestureRecognizer { + var attachedView:UIView? +} + + + + + + + + + + + + + + + + + diff --git a/ALCameraViewController/CameraView.strings b/ALCameraViewController/en.lproj/CameraView.strings similarity index 67% rename from ALCameraViewController/CameraView.strings rename to ALCameraViewController/en.lproj/CameraView.strings index cd6d136f..471512f3 100644 --- a/ALCameraViewController/CameraView.strings +++ b/ALCameraViewController/en.lproj/CameraView.strings @@ -15,4 +15,17 @@ "permissions.settings" = "Settings"; "error.cant-fetch-photo" = "Unable to fetch image"; -"error.cant-fetch-photo.description" = "Please check your network settings"; \ No newline at end of file +"error.cant-fetch-photo.description" = "Please check your network settings"; + +"crop.borders" = "Find Borders"; +"crop.selectAll" = "Select All"; +"crop.viewtitle" = "Crop"; +"crop.next" = "Next"; + +"filter.viewtitle" = "Filter"; +"filter.done" = "Next"; + +"confirm.viewtitle" = "Confirm"; +"confirm.done" = "Done"; + +"libray.title" = "Photo Library"; diff --git a/ALCameraViewController/zh-Hans.lproj/CameraView.strings b/ALCameraViewController/zh-Hans.lproj/CameraView.strings new file mode 100644 index 00000000..19d7fc59 --- /dev/null +++ b/ALCameraViewController/zh-Hans.lproj/CameraView.strings @@ -0,0 +1,30 @@ +/* + ALCameraView.strings + ALCameraViewController + + Created by Alex Littlejohn on 2015/06/25. + Copyright (c) 2015 zero. All rights reserved. +*/ +"permissions.title" = "没有相机访问权限"; +"permissions.description" = "请在隐私设定中打开相机访问权限"; + +"permissions.library.title" = "没有相册访问权限"; +"permissions.library.description" = "请在隐私设定中打开相册访问权限"; + +"permissions.settings" = "设置"; + +"error.cant-fetch-photo" = "无法获取图片"; +"error.cant-fetch-photo.description" = "请检查你的网络设置"; + +"crop.borders" = "边缘检测"; +"crop.selectAll" = "全部选择"; +"crop.viewtitle" = "裁剪"; +"crop.next" = "下一步"; + +"filter.viewtitle" = "滤镜"; +"filter.done" = "下一步"; + +"confirm.viewtitle" = "确认"; +"confirm.done" = "完成"; + +"libray.title" = "相册"; diff --git a/CameraViewController/CameraViewController-Bridging-Header.h b/CameraViewController/CameraViewController-Bridging-Header.h new file mode 100644 index 00000000..a3feef8d --- /dev/null +++ b/CameraViewController/CameraViewController-Bridging-Header.h @@ -0,0 +1,8 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import "UIImage+Filter.h" +#import "UIImageView+Filter.h" +#import "CIImage+Utilities.h" +#import "IRLRectangleFeature+Extensions.h" diff --git a/CameraViewController/CameraViewController.h b/CameraViewController/CameraViewController.h index c6e40c05..8fe63f96 100644 --- a/CameraViewController/CameraViewController.h +++ b/CameraViewController/CameraViewController.h @@ -7,6 +7,11 @@ // #import +#import "CIImage+Utilities.h" +#import "UIImage+Filter.h" +#import "UIImageView+Filter.h" +#import "IRLRectangleFeature+Extensions.h" + //! Project version number for CameraViewController. FOUNDATION_EXPORT double CameraViewControllerVersionNumber; diff --git a/Example/Supporting Files/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/Supporting Files/Images.xcassets/AppIcon.appiconset/Contents.json index 4be0545c..6c2ba45e 100644 --- a/Example/Supporting Files/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/Supporting Files/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "size" : "29x29", "idiom" : "iphone", @@ -25,8 +35,8 @@ "scale" : "3x" }, { - "idiom" : "iphone", "size" : "60x60", + "idiom" : "iphone", "filename" : "icon@120.png", "scale" : "2x" }, @@ -35,6 +45,11 @@ "idiom" : "iphone", "filename" : "icon@180.png", "scale" : "3x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Example/Supporting Files/Info.plist b/Example/Supporting Files/Info.plist index 9c9f832f..5afa2d3d 100644 --- a/Example/Supporting Files/Info.plist +++ b/Example/Supporting Files/Info.plist @@ -12,6 +12,8 @@ 6.0 CFBundleName $(PRODUCT_NAME) + UILaunchStoryboardName + LaunchScreen CFBundlePackageType APPL CFBundleShortVersionString diff --git a/Example/Supporting Files/LaunchScreen.storyboard b/Example/Supporting Files/LaunchScreen.storyboard new file mode 100644 index 00000000..e10e660d --- /dev/null +++ b/Example/Supporting Files/LaunchScreen.storyboard @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/ViewController.swift b/Example/ViewController.swift index ef160478..dfb08eaf 100644 --- a/Example/ViewController.swift +++ b/Example/ViewController.swift @@ -24,8 +24,17 @@ class ViewController: UIViewController { self?.imageView.image = image self?.dismiss(animated: true, completion: nil) } + + let navigationController = UINavigationController(rootViewController: cameraViewController) + + navigationController.navigationBar.barTintColor = UIColor.white + navigationController.navigationBar.tintColor = UIColor.black + navigationController.navigationBar.barStyle = UIBarStyle.blackOpaque + navigationController.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.black] + + present(navigationController, animated: true, completion: nil) - present(cameraViewController, animated: true, completion: nil) +// present(cameraViewController, animated: true, completion: nil) } @IBAction func openLibrary(_ sender: AnyObject) {