├── .gitignore ├── CameraStickerDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── CameraStickerDemo.xcworkspace └── contents.xcworkspacedata ├── CameraStickerDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── Sticker │ ├── SKSticker+OpenGL.h │ ├── SKSticker+OpenGL.m │ ├── SKSticker.h │ ├── SKSticker.m │ ├── SKStickerFilter.h │ ├── SKStickerFilter.m │ ├── SKStickerItem+OpenGL.h │ ├── SKStickerItem+OpenGL.m │ ├── SKStickerItem.h │ ├── SKStickerItem.m │ └── SKStickerResources.bundle │ │ └── stickers │ │ └── angel │ │ ├── angel_audio.mp3 │ │ ├── halo │ │ ├── halo_000.png │ │ ├── halo_001.png │ │ ├── halo_002.png │ │ ├── halo_003.png │ │ ├── halo_004.png │ │ ├── halo_005.png │ │ ├── halo_006.png │ │ ├── halo_007.png │ │ ├── halo_008.png │ │ ├── halo_009.png │ │ ├── halo_010.png │ │ ├── halo_011.png │ │ ├── halo_012.png │ │ ├── halo_013.png │ │ ├── halo_014.png │ │ ├── halo_015.png │ │ ├── halo_016.png │ │ ├── halo_017.png │ │ ├── halo_018.png │ │ ├── halo_019.png │ │ ├── halo_020.png │ │ ├── halo_021.png │ │ ├── halo_022.png │ │ ├── halo_023.png │ │ ├── halo_024.png │ │ ├── halo_025.png │ │ ├── halo_026.png │ │ ├── halo_027.png │ │ ├── halo_028.png │ │ ├── halo_029.png │ │ ├── halo_030.png │ │ ├── halo_031.png │ │ ├── halo_032.png │ │ ├── halo_033.png │ │ ├── halo_034.png │ │ ├── halo_035.png │ │ ├── halo_036.png │ │ ├── halo_037.png │ │ ├── halo_038.png │ │ ├── halo_039.png │ │ └── halo_040.png │ │ ├── light │ │ ├── light_000.png │ │ ├── light_001.png │ │ ├── light_002.png │ │ ├── light_003.png │ │ ├── light_004.png │ │ ├── light_005.png │ │ ├── light_006.png │ │ ├── light_007.png │ │ ├── light_008.png │ │ ├── light_009.png │ │ ├── light_010.png │ │ ├── light_011.png │ │ ├── light_012.png │ │ ├── light_013.png │ │ ├── light_014.png │ │ ├── light_015.png │ │ ├── light_016.png │ │ ├── light_017.png │ │ ├── light_018.png │ │ ├── light_019.png │ │ ├── light_020.png │ │ ├── light_021.png │ │ ├── light_022.png │ │ ├── light_023.png │ │ ├── light_024.png │ │ ├── light_025.png │ │ ├── light_026.png │ │ ├── light_027.png │ │ ├── light_028.png │ │ ├── light_029.png │ │ ├── light_030.png │ │ ├── light_031.png │ │ ├── light_032.png │ │ ├── light_033.png │ │ ├── light_034.png │ │ ├── light_035.png │ │ ├── light_036.png │ │ ├── light_037.png │ │ ├── light_038.png │ │ ├── light_039.png │ │ └── light_040.png │ │ ├── meta.json │ │ ├── preview.jpg │ │ └── shy │ │ ├── shy_000.png │ │ ├── shy_001.png │ │ ├── shy_002.png │ │ ├── shy_003.png │ │ ├── shy_004.png │ │ ├── shy_005.png │ │ ├── shy_006.png │ │ ├── shy_007.png │ │ ├── shy_008.png │ │ ├── shy_009.png │ │ ├── shy_010.png │ │ ├── shy_011.png │ │ ├── shy_012.png │ │ ├── shy_013.png │ │ ├── shy_014.png │ │ ├── shy_015.png │ │ ├── shy_016.png │ │ ├── shy_017.png │ │ ├── shy_018.png │ │ ├── shy_019.png │ │ ├── shy_020.png │ │ ├── shy_021.png │ │ ├── shy_022.png │ │ ├── shy_023.png │ │ ├── shy_024.png │ │ ├── shy_025.png │ │ ├── shy_026.png │ │ ├── shy_027.png │ │ ├── shy_028.png │ │ ├── shy_029.png │ │ ├── shy_030.png │ │ ├── shy_031.png │ │ ├── shy_032.png │ │ ├── shy_033.png │ │ ├── shy_034.png │ │ ├── shy_035.png │ │ ├── shy_036.png │ │ ├── shy_037.png │ │ ├── shy_038.png │ │ ├── shy_039.png │ │ └── shy_040.png ├── ViewController.h ├── ViewController.m ├── fake_points.json ├── main.m └── tracker_points.png ├── License.txt ├── Podfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 36 | # 37 | Pods/ 38 | Podfile.lock 39 | -------------------------------------------------------------------------------- /CameraStickerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 74CC3AF33BD99340BFC900D4 /* libPods-CameraStickerDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B676D6CCB7476CD72245D4AE /* libPods-CameraStickerDemo.a */; }; 11 | 8712D6AD1DF3EFF8007DD425 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8712D6AC1DF3EFF8007DD425 /* main.m */; }; 12 | 8712D6B01DF3EFF8007DD425 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8712D6AF1DF3EFF8007DD425 /* AppDelegate.m */; }; 13 | 8712D6B31DF3EFF8007DD425 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8712D6B21DF3EFF8007DD425 /* ViewController.m */; }; 14 | 8712D6B61DF3EFF8007DD425 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8712D6B41DF3EFF8007DD425 /* Main.storyboard */; }; 15 | 8712D6B81DF3EFF8007DD425 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8712D6B71DF3EFF8007DD425 /* Assets.xcassets */; }; 16 | 8712D6BB1DF3EFF8007DD425 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8712D6B91DF3EFF8007DD425 /* LaunchScreen.storyboard */; }; 17 | 8712D6C71DF3F130007DD425 /* SKStickerItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 8712D6C41DF3F130007DD425 /* SKStickerItem.m */; }; 18 | 8712D6C81DF3F130007DD425 /* SKSticker.m in Sources */ = {isa = PBXBuildFile; fileRef = 8712D6C61DF3F130007DD425 /* SKSticker.m */; }; 19 | 8712D6CB1DF3F159007DD425 /* SKStickerFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 8712D6CA1DF3F159007DD425 /* SKStickerFilter.m */; }; 20 | 8712D6CD1DF3F197007DD425 /* SKStickerResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 8712D6CC1DF3F197007DD425 /* SKStickerResources.bundle */; }; 21 | 8712D6CF1DF3FD47007DD425 /* fake_points.json in Resources */ = {isa = PBXBuildFile; fileRef = 8712D6CE1DF3FD47007DD425 /* fake_points.json */; }; 22 | 8712D6D71DF54032007DD425 /* SKStickerItem+OpenGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 8712D6D61DF54032007DD425 /* SKStickerItem+OpenGL.m */; }; 23 | 8712D6DA1DF543A6007DD425 /* SKSticker+OpenGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 8712D6D91DF543A6007DD425 /* SKSticker+OpenGL.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 7EDC3AD5E1A167882937BC05 /* Pods-CameraStickerDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CameraStickerDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-CameraStickerDemo/Pods-CameraStickerDemo.release.xcconfig"; sourceTree = ""; }; 28 | 8712D6A81DF3EFF8007DD425 /* CameraStickerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CameraStickerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 8712D6AC1DF3EFF8007DD425 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 30 | 8712D6AE1DF3EFF8007DD425 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 31 | 8712D6AF1DF3EFF8007DD425 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 32 | 8712D6B11DF3EFF8007DD425 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 33 | 8712D6B21DF3EFF8007DD425 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 34 | 8712D6B51DF3EFF8007DD425 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | 8712D6B71DF3EFF8007DD425 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 36 | 8712D6BA1DF3EFF8007DD425 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 37 | 8712D6BC1DF3EFF8007DD425 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | 8712D6C31DF3F130007DD425 /* SKStickerItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKStickerItem.h; sourceTree = ""; }; 39 | 8712D6C41DF3F130007DD425 /* SKStickerItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKStickerItem.m; sourceTree = ""; }; 40 | 8712D6C51DF3F130007DD425 /* SKSticker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKSticker.h; sourceTree = ""; }; 41 | 8712D6C61DF3F130007DD425 /* SKSticker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKSticker.m; sourceTree = ""; }; 42 | 8712D6C91DF3F159007DD425 /* SKStickerFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKStickerFilter.h; sourceTree = ""; }; 43 | 8712D6CA1DF3F159007DD425 /* SKStickerFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKStickerFilter.m; sourceTree = ""; }; 44 | 8712D6CC1DF3F197007DD425 /* SKStickerResources.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SKStickerResources.bundle; sourceTree = ""; }; 45 | 8712D6CE1DF3FD47007DD425 /* fake_points.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = fake_points.json; sourceTree = ""; }; 46 | 8712D6D51DF54032007DD425 /* SKStickerItem+OpenGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SKStickerItem+OpenGL.h"; sourceTree = ""; }; 47 | 8712D6D61DF54032007DD425 /* SKStickerItem+OpenGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SKStickerItem+OpenGL.m"; sourceTree = ""; }; 48 | 8712D6D81DF543A6007DD425 /* SKSticker+OpenGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SKSticker+OpenGL.h"; sourceTree = ""; }; 49 | 8712D6D91DF543A6007DD425 /* SKSticker+OpenGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SKSticker+OpenGL.m"; sourceTree = ""; }; 50 | B676D6CCB7476CD72245D4AE /* libPods-CameraStickerDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CameraStickerDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | EAF220E13C4C9144B95A8E2A /* Pods-CameraStickerDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CameraStickerDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CameraStickerDemo/Pods-CameraStickerDemo.debug.xcconfig"; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 8712D6A51DF3EFF8007DD425 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | 74CC3AF33BD99340BFC900D4 /* libPods-CameraStickerDemo.a in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | 3F30803C61509F049971876A /* Frameworks */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | B676D6CCB7476CD72245D4AE /* libPods-CameraStickerDemo.a */, 70 | ); 71 | name = Frameworks; 72 | sourceTree = ""; 73 | }; 74 | 57CA0DC7B4C1B0EE09206A7E /* Pods */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | EAF220E13C4C9144B95A8E2A /* Pods-CameraStickerDemo.debug.xcconfig */, 78 | 7EDC3AD5E1A167882937BC05 /* Pods-CameraStickerDemo.release.xcconfig */, 79 | ); 80 | name = Pods; 81 | sourceTree = ""; 82 | }; 83 | 8712D69F1DF3EFF8007DD425 = { 84 | isa = PBXGroup; 85 | children = ( 86 | 8712D6AA1DF3EFF8007DD425 /* CameraStickerDemo */, 87 | 8712D6A91DF3EFF8007DD425 /* Products */, 88 | 57CA0DC7B4C1B0EE09206A7E /* Pods */, 89 | 3F30803C61509F049971876A /* Frameworks */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 8712D6A91DF3EFF8007DD425 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 8712D6A81DF3EFF8007DD425 /* CameraStickerDemo.app */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 8712D6AA1DF3EFF8007DD425 /* CameraStickerDemo */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 8712D6C21DF3F130007DD425 /* Sticker */, 105 | 8712D6AE1DF3EFF8007DD425 /* AppDelegate.h */, 106 | 8712D6AF1DF3EFF8007DD425 /* AppDelegate.m */, 107 | 8712D6B11DF3EFF8007DD425 /* ViewController.h */, 108 | 8712D6B21DF3EFF8007DD425 /* ViewController.m */, 109 | 8712D6B41DF3EFF8007DD425 /* Main.storyboard */, 110 | 8712D6B71DF3EFF8007DD425 /* Assets.xcassets */, 111 | 8712D6B91DF3EFF8007DD425 /* LaunchScreen.storyboard */, 112 | 8712D6BC1DF3EFF8007DD425 /* Info.plist */, 113 | 8712D6CE1DF3FD47007DD425 /* fake_points.json */, 114 | 8712D6AB1DF3EFF8007DD425 /* Supporting Files */, 115 | ); 116 | path = CameraStickerDemo; 117 | sourceTree = ""; 118 | }; 119 | 8712D6AB1DF3EFF8007DD425 /* Supporting Files */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 8712D6AC1DF3EFF8007DD425 /* main.m */, 123 | ); 124 | name = "Supporting Files"; 125 | sourceTree = ""; 126 | }; 127 | 8712D6C21DF3F130007DD425 /* Sticker */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 8712D6CC1DF3F197007DD425 /* SKStickerResources.bundle */, 131 | 8712D6C31DF3F130007DD425 /* SKStickerItem.h */, 132 | 8712D6C41DF3F130007DD425 /* SKStickerItem.m */, 133 | 8712D6C51DF3F130007DD425 /* SKSticker.h */, 134 | 8712D6C61DF3F130007DD425 /* SKSticker.m */, 135 | 8712D6D51DF54032007DD425 /* SKStickerItem+OpenGL.h */, 136 | 8712D6D61DF54032007DD425 /* SKStickerItem+OpenGL.m */, 137 | 8712D6D81DF543A6007DD425 /* SKSticker+OpenGL.h */, 138 | 8712D6D91DF543A6007DD425 /* SKSticker+OpenGL.m */, 139 | 8712D6C91DF3F159007DD425 /* SKStickerFilter.h */, 140 | 8712D6CA1DF3F159007DD425 /* SKStickerFilter.m */, 141 | ); 142 | path = Sticker; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 8712D6A71DF3EFF8007DD425 /* CameraStickerDemo */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 8712D6BF1DF3EFF8007DD425 /* Build configuration list for PBXNativeTarget "CameraStickerDemo" */; 151 | buildPhases = ( 152 | 76E3672F1F623D1284C2FD9A /* [CP] Check Pods Manifest.lock */, 153 | 8712D6A41DF3EFF8007DD425 /* Sources */, 154 | 8712D6A51DF3EFF8007DD425 /* Frameworks */, 155 | 8712D6A61DF3EFF8007DD425 /* Resources */, 156 | A20DACE23C6C14198EA73FDB /* [CP] Embed Pods Frameworks */, 157 | 899A527024C59A5A8B6D120B /* [CP] Copy Pods Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = CameraStickerDemo; 164 | productName = CameraStickerDemo; 165 | productReference = 8712D6A81DF3EFF8007DD425 /* CameraStickerDemo.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | /* End PBXNativeTarget section */ 169 | 170 | /* Begin PBXProject section */ 171 | 8712D6A01DF3EFF8007DD425 /* Project object */ = { 172 | isa = PBXProject; 173 | attributes = { 174 | CLASSPREFIX = SK; 175 | LastUpgradeCheck = 0810; 176 | ORGANIZATIONNAME = Asura; 177 | TargetAttributes = { 178 | 8712D6A71DF3EFF8007DD425 = { 179 | CreatedOnToolsVersion = 8.1; 180 | DevelopmentTeam = 9F8QE256M9; 181 | ProvisioningStyle = Automatic; 182 | }; 183 | }; 184 | }; 185 | buildConfigurationList = 8712D6A31DF3EFF8007DD425 /* Build configuration list for PBXProject "CameraStickerDemo" */; 186 | compatibilityVersion = "Xcode 3.2"; 187 | developmentRegion = English; 188 | hasScannedForEncodings = 0; 189 | knownRegions = ( 190 | en, 191 | Base, 192 | ); 193 | mainGroup = 8712D69F1DF3EFF8007DD425; 194 | productRefGroup = 8712D6A91DF3EFF8007DD425 /* Products */; 195 | projectDirPath = ""; 196 | projectRoot = ""; 197 | targets = ( 198 | 8712D6A71DF3EFF8007DD425 /* CameraStickerDemo */, 199 | ); 200 | }; 201 | /* End PBXProject section */ 202 | 203 | /* Begin PBXResourcesBuildPhase section */ 204 | 8712D6A61DF3EFF8007DD425 /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | 8712D6CF1DF3FD47007DD425 /* fake_points.json in Resources */, 209 | 8712D6BB1DF3EFF8007DD425 /* LaunchScreen.storyboard in Resources */, 210 | 8712D6B81DF3EFF8007DD425 /* Assets.xcassets in Resources */, 211 | 8712D6B61DF3EFF8007DD425 /* Main.storyboard in Resources */, 212 | 8712D6CD1DF3F197007DD425 /* SKStickerResources.bundle in Resources */, 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXResourcesBuildPhase section */ 217 | 218 | /* Begin PBXShellScriptBuildPhase section */ 219 | 76E3672F1F623D1284C2FD9A /* [CP] Check Pods Manifest.lock */ = { 220 | isa = PBXShellScriptBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | inputPaths = ( 225 | ); 226 | name = "[CP] Check Pods Manifest.lock"; 227 | outputPaths = ( 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | shellPath = /bin/sh; 231 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 232 | showEnvVarsInLog = 0; 233 | }; 234 | 899A527024C59A5A8B6D120B /* [CP] Copy Pods Resources */ = { 235 | isa = PBXShellScriptBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | inputPaths = ( 240 | ); 241 | name = "[CP] Copy Pods Resources"; 242 | outputPaths = ( 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | shellPath = /bin/sh; 246 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CameraStickerDemo/Pods-CameraStickerDemo-resources.sh\"\n"; 247 | showEnvVarsInLog = 0; 248 | }; 249 | A20DACE23C6C14198EA73FDB /* [CP] Embed Pods Frameworks */ = { 250 | isa = PBXShellScriptBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | ); 254 | inputPaths = ( 255 | ); 256 | name = "[CP] Embed Pods Frameworks"; 257 | outputPaths = ( 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | shellPath = /bin/sh; 261 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CameraStickerDemo/Pods-CameraStickerDemo-frameworks.sh\"\n"; 262 | showEnvVarsInLog = 0; 263 | }; 264 | /* End PBXShellScriptBuildPhase section */ 265 | 266 | /* Begin PBXSourcesBuildPhase section */ 267 | 8712D6A41DF3EFF8007DD425 /* Sources */ = { 268 | isa = PBXSourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | 8712D6DA1DF543A6007DD425 /* SKSticker+OpenGL.m in Sources */, 272 | 8712D6B31DF3EFF8007DD425 /* ViewController.m in Sources */, 273 | 8712D6C71DF3F130007DD425 /* SKStickerItem.m in Sources */, 274 | 8712D6C81DF3F130007DD425 /* SKSticker.m in Sources */, 275 | 8712D6CB1DF3F159007DD425 /* SKStickerFilter.m in Sources */, 276 | 8712D6B01DF3EFF8007DD425 /* AppDelegate.m in Sources */, 277 | 8712D6AD1DF3EFF8007DD425 /* main.m in Sources */, 278 | 8712D6D71DF54032007DD425 /* SKStickerItem+OpenGL.m in Sources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | /* End PBXSourcesBuildPhase section */ 283 | 284 | /* Begin PBXVariantGroup section */ 285 | 8712D6B41DF3EFF8007DD425 /* Main.storyboard */ = { 286 | isa = PBXVariantGroup; 287 | children = ( 288 | 8712D6B51DF3EFF8007DD425 /* Base */, 289 | ); 290 | name = Main.storyboard; 291 | sourceTree = ""; 292 | }; 293 | 8712D6B91DF3EFF8007DD425 /* LaunchScreen.storyboard */ = { 294 | isa = PBXVariantGroup; 295 | children = ( 296 | 8712D6BA1DF3EFF8007DD425 /* Base */, 297 | ); 298 | name = LaunchScreen.storyboard; 299 | sourceTree = ""; 300 | }; 301 | /* End PBXVariantGroup section */ 302 | 303 | /* Begin XCBuildConfiguration section */ 304 | 8712D6BD1DF3EFF8007DD425 /* Debug */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ALWAYS_SEARCH_USER_PATHS = NO; 308 | CLANG_ANALYZER_NONNULL = YES; 309 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 310 | CLANG_CXX_LIBRARY = "libc++"; 311 | CLANG_ENABLE_MODULES = YES; 312 | CLANG_ENABLE_OBJC_ARC = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 316 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 322 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 323 | CLANG_WARN_UNREACHABLE_CODE = YES; 324 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 325 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 326 | COPY_PHASE_STRIP = NO; 327 | DEBUG_INFORMATION_FORMAT = dwarf; 328 | ENABLE_STRICT_OBJC_MSGSEND = YES; 329 | ENABLE_TESTABILITY = YES; 330 | GCC_C_LANGUAGE_STANDARD = gnu99; 331 | GCC_DYNAMIC_NO_PIC = NO; 332 | GCC_NO_COMMON_BLOCKS = YES; 333 | GCC_OPTIMIZATION_LEVEL = 0; 334 | GCC_PREPROCESSOR_DEFINITIONS = ( 335 | "DEBUG=1", 336 | "$(inherited)", 337 | ); 338 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 339 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 340 | GCC_WARN_UNDECLARED_SELECTOR = YES; 341 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 342 | GCC_WARN_UNUSED_FUNCTION = YES; 343 | GCC_WARN_UNUSED_VARIABLE = YES; 344 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 345 | MTL_ENABLE_DEBUG_INFO = YES; 346 | ONLY_ACTIVE_ARCH = YES; 347 | SDKROOT = iphoneos; 348 | }; 349 | name = Debug; 350 | }; 351 | 8712D6BE1DF3EFF8007DD425 /* Release */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | ALWAYS_SEARCH_USER_PATHS = NO; 355 | CLANG_ANALYZER_NONNULL = YES; 356 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 357 | CLANG_CXX_LIBRARY = "libc++"; 358 | CLANG_ENABLE_MODULES = YES; 359 | CLANG_ENABLE_OBJC_ARC = YES; 360 | CLANG_WARN_BOOL_CONVERSION = YES; 361 | CLANG_WARN_CONSTANT_CONVERSION = YES; 362 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 363 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 364 | CLANG_WARN_EMPTY_BODY = YES; 365 | CLANG_WARN_ENUM_CONVERSION = YES; 366 | CLANG_WARN_INFINITE_RECURSION = YES; 367 | CLANG_WARN_INT_CONVERSION = YES; 368 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 369 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 370 | CLANG_WARN_UNREACHABLE_CODE = YES; 371 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 372 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 373 | COPY_PHASE_STRIP = NO; 374 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 375 | ENABLE_NS_ASSERTIONS = NO; 376 | ENABLE_STRICT_OBJC_MSGSEND = YES; 377 | GCC_C_LANGUAGE_STANDARD = gnu99; 378 | GCC_NO_COMMON_BLOCKS = YES; 379 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 380 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 381 | GCC_WARN_UNDECLARED_SELECTOR = YES; 382 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 383 | GCC_WARN_UNUSED_FUNCTION = YES; 384 | GCC_WARN_UNUSED_VARIABLE = YES; 385 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 386 | MTL_ENABLE_DEBUG_INFO = NO; 387 | SDKROOT = iphoneos; 388 | VALIDATE_PRODUCT = YES; 389 | }; 390 | name = Release; 391 | }; 392 | 8712D6C01DF3EFF8007DD425 /* Debug */ = { 393 | isa = XCBuildConfiguration; 394 | baseConfigurationReference = EAF220E13C4C9144B95A8E2A /* Pods-CameraStickerDemo.debug.xcconfig */; 395 | buildSettings = { 396 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 397 | DEVELOPMENT_TEAM = 9F8QE256M9; 398 | INFOPLIST_FILE = CameraStickerDemo/Info.plist; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 400 | PRODUCT_BUNDLE_IDENTIFIER = design.asura.CameraStickerDemo; 401 | PRODUCT_NAME = "$(TARGET_NAME)"; 402 | }; 403 | name = Debug; 404 | }; 405 | 8712D6C11DF3EFF8007DD425 /* Release */ = { 406 | isa = XCBuildConfiguration; 407 | baseConfigurationReference = 7EDC3AD5E1A167882937BC05 /* Pods-CameraStickerDemo.release.xcconfig */; 408 | buildSettings = { 409 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 410 | DEVELOPMENT_TEAM = 9F8QE256M9; 411 | INFOPLIST_FILE = CameraStickerDemo/Info.plist; 412 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 413 | PRODUCT_BUNDLE_IDENTIFIER = design.asura.CameraStickerDemo; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | }; 416 | name = Release; 417 | }; 418 | /* End XCBuildConfiguration section */ 419 | 420 | /* Begin XCConfigurationList section */ 421 | 8712D6A31DF3EFF8007DD425 /* Build configuration list for PBXProject "CameraStickerDemo" */ = { 422 | isa = XCConfigurationList; 423 | buildConfigurations = ( 424 | 8712D6BD1DF3EFF8007DD425 /* Debug */, 425 | 8712D6BE1DF3EFF8007DD425 /* Release */, 426 | ); 427 | defaultConfigurationIsVisible = 0; 428 | defaultConfigurationName = Release; 429 | }; 430 | 8712D6BF1DF3EFF8007DD425 /* Build configuration list for PBXNativeTarget "CameraStickerDemo" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | 8712D6C01DF3EFF8007DD425 /* Debug */, 434 | 8712D6C11DF3EFF8007DD425 /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | defaultConfigurationName = Release; 438 | }; 439 | /* End XCConfigurationList section */ 440 | }; 441 | rootObject = 8712D6A01DF3EFF8007DD425 /* Project object */; 442 | } 443 | -------------------------------------------------------------------------------- /CameraStickerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CameraStickerDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CameraStickerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/4. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /CameraStickerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/4. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /CameraStickerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CameraStickerDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CameraStickerDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CameraStickerDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSCameraUsageDescription 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKSticker+OpenGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // SKSticker+OpenGL.h 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/5. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "SKSticker.h" 10 | 11 | @interface SKSticker (OpenGL) 12 | 13 | - (void)drawItemsWithFacePoints:(NSArray *)points 14 | framebufferSize:(CGSize)size 15 | timeInterval:(NSTimeInterval)interval 16 | usingBlock:(void (^)(GLfloat *vertices, GLuint texture))block; 17 | 18 | - (void)reset; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKSticker+OpenGL.m: -------------------------------------------------------------------------------- 1 | // 2 | // SKSticker+OpenGL.m 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/5. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "SKSticker+OpenGL.h" 10 | #import "SKStickerItem+OpenGL.h" 11 | 12 | 13 | @implementation SKSticker (OpenGL) 14 | 15 | - (void)drawItemsWithFacePoints:(NSArray *)points 16 | framebufferSize:(CGSize)size 17 | timeInterval:(NSTimeInterval)interval 18 | usingBlock:(void (^)(GLfloat *, GLuint))block 19 | { 20 | // 顶点坐标 21 | static GLfloat vertices[8] = {0}; 22 | 23 | // 计算眼间距,以此作为调整item大小的参考 24 | CGPoint eye_left = [points[39] CGPointValue]; 25 | CGPoint eye_right = [points[42] CGPointValue]; 26 | int eye_dist = distance(eye_left, eye_right); 27 | 28 | float signx = 1.0 * (eye_right.y - eye_left.y) / eye_dist; 29 | float cosignx = 1.0 * (eye_right.x - eye_left.x) / eye_dist; 30 | 31 | for (SKStickerItem *item in self.items) { 32 | switch (item.type) { 33 | case SKStickerItemTypeFace: 34 | { 35 | CGPoint left_point = [points[[item.alignIndexes[0] intValue]] CGPointValue]; 36 | CGPoint center_point = [points[[item.alignIndexes[1] intValue]] CGPointValue]; 37 | CGPoint right_point = [points[[item.alignIndexes[2] intValue]] CGPointValue]; 38 | 39 | CGFloat dist = distance(left_point, right_point); 40 | 41 | // 计算item的宽高及顶点坐标 42 | float itemWidth = dist + eye_dist * item.scaleWidth; 43 | float itemHeight = itemWidth * item.height / item.width; 44 | 45 | CGFloat left = center_point.x - itemWidth / 2. + eye_dist * item.offsetX; 46 | CGFloat right = center_point.x + itemWidth / 2. + eye_dist * item.offsetX; 47 | CGFloat top = center_point.y + itemHeight / 2. + eye_dist * item.offsetY; 48 | CGFloat bottom = center_point.y - itemHeight / 2. + eye_dist * item.offsetY; 49 | 50 | // 旋转 51 | vertices[0] = ((left - center_point.x) * cosignx - (bottom - center_point.y) * signx + center_point.x) / size.width * 2. - 1; 52 | vertices[1] = ((left - center_point.x) * signx + (bottom - center_point.y) * cosignx + center_point.y) / size.height * 2. - 1; 53 | vertices[2] = ((right - center_point.x) * cosignx - (bottom - center_point.y) * signx + center_point.x) / size.width * 2. - 1; 54 | vertices[3] = ((right - center_point.x) * signx + (bottom - center_point.y) * cosignx + center_point.y) / size.height * 2. - 1; 55 | vertices[4] = ((left - center_point.x) * cosignx - (top - center_point.y) * signx + center_point.x) / size.width * 2. - 1; 56 | vertices[5] = ((left - center_point.x) * signx + (top - center_point.y) * cosignx + center_point.y) / size.height * 2. - 1; 57 | vertices[6] = ((right - center_point.x) * cosignx - (top - center_point.y) * signx + center_point.x) / size.width * 2. - 1; 58 | vertices[7] = ((right - center_point.x) * signx + (top - center_point.y) * cosignx + center_point.y) / size.height * 2. - 1; 59 | } 60 | break; 61 | 62 | case SKStickerItemTypeScreen: 63 | { 64 | // TODO: 多张人脸只画一次 65 | 66 | CGFloat left, right, top, bottom; 67 | CGFloat itemWidth, itemHeight; 68 | 69 | switch (item.alignPosition) { 70 | case SKStickerItemAlignPositionTop: 71 | { 72 | itemWidth = size.width * item.scaleWidth; 73 | itemHeight = ceil(itemWidth * (item.height / item.width)); 74 | 75 | left = (size.width - itemWidth) / 2 + size.width * item.offsetX; 76 | right = left + itemWidth; 77 | 78 | bottom = size.width * item.offsetY; 79 | top = bottom + itemHeight; 80 | } 81 | break; 82 | 83 | case SKStickerItemAlignPositionLeft: 84 | case SKStickerItemAlignPositionBottom: 85 | case SKStickerItemAlignPositionRight: 86 | case SKStickerItemAlignPositionCenter: 87 | { 88 | // TODO: 其它位置的适配 89 | } 90 | break; 91 | 92 | default: 93 | break; 94 | } 95 | 96 | vertices[0] = left / size.width * 2 -1; 97 | vertices[1] = bottom / size.height * 2 -1; 98 | vertices[2] = right / size.width * 2 -1; 99 | vertices[3] = vertices[1]; 100 | vertices[4] = vertices[0]; 101 | vertices[5] = top / size.height * 2 -1; 102 | vertices[6] = vertices[2]; 103 | vertices[7] = vertices[5]; 104 | } 105 | break; 106 | 107 | default: 108 | break; 109 | } 110 | 111 | GLuint texture = [item nextTextureForInterval:interval]; 112 | !block ?: block(vertices, texture); 113 | } 114 | } 115 | 116 | - (void)reset 117 | { 118 | for (SKStickerItem *item in self.items) { 119 | [item deleteTextures]; 120 | } 121 | } 122 | 123 | static CGFloat distance(CGPoint first, CGPoint second) { 124 | CGFloat deltaX = second.x - first.x; 125 | CGFloat deltaY = second.y - first.y; 126 | return sqrt(deltaX * deltaX + deltaY * deltaY); 127 | } 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKSticker.h: -------------------------------------------------------------------------------- 1 | // 2 | // SKStickerManager.h 3 | // PLMediaStreamingKitDemo 4 | // 5 | // Created by Sinkup on 2016/10/13. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SKStickerItem.h" 11 | 12 | 13 | @class SKSticker; 14 | 15 | /** 16 | 贴纸管理,加载等 17 | */ 18 | @interface SKStickersManager : NSObject 19 | 20 | /** 21 | 异步方式从文件读取所有贴纸的信息 22 | 23 | @param completion 读取完成后的回调 24 | */ 25 | + (void)loadStickersWithCompletion:(void(^)(NSArray *stickers))completion; 26 | 27 | @end 28 | 29 | 30 | /** 31 | 一套贴纸 32 | */ 33 | @interface SKSticker : NSObject 34 | 35 | /** 36 | 包含的所有部件 37 | */ 38 | @property (nonatomic, readonly) NSArray *items; 39 | 40 | 41 | /** 42 | 贴纸的目录 43 | */ 44 | @property (nonatomic, readonly) NSString *dir; 45 | 46 | 47 | /** 48 | 贴纸的名称 49 | */ 50 | @property (nonatomic, readonly) NSString *name; 51 | 52 | 53 | /** 54 | 预览图文件名 55 | */ 56 | @property (nonatomic, readonly) NSString *preview; 57 | 58 | 59 | /** 60 | 音效的文件名 61 | */ 62 | @property (nonatomic, readonly) NSString *audio; 63 | 64 | 65 | /** 66 | 版本号 67 | */ 68 | //@property (nonatomic, readonly) NSUInteger version; 69 | 70 | 71 | /** 72 | 根据指定的目录进行初始化 73 | 74 | @param url 路径 75 | @return 创建的实例 76 | */ 77 | - (instancetype)initWithDirectoryURL:(NSURL *)url; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKSticker.m: -------------------------------------------------------------------------------- 1 | // 2 | // SKStickerManager.m 3 | // PLMediaStreamingKitDemo 4 | // 5 | // Created by Sinkup on 2016/10/13. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "SKSticker.h" 10 | 11 | @implementation SKStickersManager 12 | { 13 | dispatch_queue_t _ioQueue; 14 | NSFileManager *_fileManager; 15 | 16 | NSBundle *_stickerBundle; 17 | } 18 | 19 | + (instancetype)sharedManager 20 | { 21 | static id _stickersManager; 22 | static dispatch_once_t onceToken; 23 | dispatch_once(&onceToken, ^{ 24 | _stickersManager = [SKStickersManager new]; 25 | }); 26 | 27 | return _stickersManager; 28 | } 29 | 30 | + (void)loadStickersWithCompletion:(void (^)(NSArray *))completion 31 | { 32 | [[self sharedManager] _loadStickersWithCompletion:completion]; 33 | } 34 | 35 | - (instancetype)init 36 | { 37 | self = [super init]; 38 | if (self) { 39 | _ioQueue = dispatch_queue_create("design.asura.stickers", DISPATCH_QUEUE_SERIAL); 40 | _fileManager = [[NSFileManager alloc] init]; 41 | 42 | NSString *path = [[NSBundle mainBundle] pathForResource:@"SKStickerResources" ofType:@"bundle"]; 43 | _stickerBundle = [NSBundle bundleWithPath:path]; 44 | } 45 | 46 | return self; 47 | } 48 | 49 | 50 | #pragma mark - Private 51 | - (void)_loadStickersWithCompletion:(void(^)(NSArray *))completion 52 | { 53 | dispatch_async(_ioQueue, ^{ 54 | NSArray *stickers = [self _loadStickers]; 55 | dispatch_async(dispatch_get_main_queue(), ^{ 56 | !completion ?: completion(stickers); 57 | }); 58 | }); 59 | } 60 | 61 | - (NSArray *)_loadStickers 62 | { 63 | NSURL *diskCacheURL = [NSURL fileURLWithPath:[_stickerBundle.bundlePath stringByAppendingPathComponent:@"stickers"] 64 | isDirectory:YES]; 65 | NSArray *resourceKeys = @[ NSURLNameKey, NSURLIsDirectoryKey, NSURLContentModificationDateKey ]; 66 | 67 | // 先获取缓存文件的相关属性 68 | NSDirectoryEnumerator *fileEnumerator = [_fileManager enumeratorAtURL:diskCacheURL 69 | includingPropertiesForKeys:resourceKeys 70 | options:NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsHiddenFiles 71 | errorHandler:^BOOL(NSURL * _Nonnull url, NSError * _Nonnull error) { 72 | NSLog(@"error: %@", error); 73 | return NO; 74 | }]; 75 | 76 | NSMutableDictionary *cacheFiles = [NSMutableDictionary dictionary]; 77 | 78 | // 遍历目录下的所有文件 79 | for (NSURL *fileURL in fileEnumerator) { 80 | NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:NULL]; 81 | 82 | if (![resourceValues[NSURLIsDirectoryKey] boolValue]) { 83 | continue; 84 | } 85 | 86 | [cacheFiles setObject:resourceValues forKey:fileURL]; 87 | } 88 | 89 | // 根据文件名排序 90 | NSArray *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent 91 | usingComparator:^NSComparisonResult(id obj1, id obj2) { 92 | return [obj1[NSURLNameKey] localizedCompare:obj2[NSURLNameKey]]; 93 | }]; 94 | 95 | NSMutableArray *stickers = [NSMutableArray arrayWithCapacity:sortedFiles.count]; 96 | 97 | for (NSURL *fileURL in sortedFiles) { 98 | SKSticker *sticker = [[SKSticker alloc] initWithDirectoryURL:fileURL]; 99 | if (sticker) { 100 | [stickers addObject:sticker]; 101 | } 102 | } 103 | 104 | return [NSArray arrayWithArray:stickers]; 105 | } 106 | 107 | @end 108 | 109 | 110 | @implementation SKSticker 111 | 112 | - (instancetype)initWithDirectoryURL:(NSURL *)url 113 | { 114 | NSString *dir = url.path; 115 | NSString *configFile = [dir stringByAppendingPathComponent:@"meta.json"]; 116 | if (![[NSFileManager defaultManager] fileExistsAtPath:configFile isDirectory:NULL]) { 117 | return nil; 118 | } 119 | 120 | NSError *error = nil; 121 | NSData *data = [NSData dataWithContentsOfFile:configFile]; 122 | NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; 123 | 124 | if (error || !dict) { 125 | return nil; 126 | } 127 | 128 | self = [super init]; 129 | if (self) { 130 | _dir = dir; 131 | 132 | _name = [dict objectForKey:@"name"]; 133 | _preview = [dict objectForKey:@"preview"]; 134 | _audio = [dict objectForKey:@"audio"]; 135 | 136 | NSArray *itemsDict = [dict objectForKey:@"items"]; 137 | NSMutableArray *items = [NSMutableArray arrayWithCapacity:itemsDict.count]; 138 | for (NSDictionary *itemDict in itemsDict) { 139 | SKStickerItem *item = [[SKStickerItem alloc] initWithJSONDictionary:itemDict]; 140 | item.dir = [_dir stringByAppendingPathComponent:item.dir]; 141 | 142 | [items addObject:item]; 143 | } 144 | 145 | _items = items; 146 | } 147 | 148 | return self; 149 | } 150 | 151 | @end 152 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerFilter.h: -------------------------------------------------------------------------------- 1 | // 2 | // SKStickerFilter.h 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/4. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class SKSticker; 12 | 13 | @interface SKStickerFilter : GPUImageFilter 14 | 15 | /** 16 | 需要绘制的贴纸 17 | */ 18 | @property (nonatomic, strong) SKSticker *sticker; 19 | 20 | 21 | /** 22 | 关键点,元素需为CGPoint数组 23 | */ 24 | @property (nonatomic, copy) NSArray *faces; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerFilter.m: -------------------------------------------------------------------------------- 1 | // 2 | // SKStickerFilter.m 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/4. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "SKStickerFilter.h" 10 | #import "SKSticker+OpenGL.h" 11 | 12 | @implementation SKStickerFilter 13 | { 14 | GLuint _framebufferHandle; 15 | 16 | CMTime _lastTime; 17 | CMTime _currentTime; 18 | } 19 | 20 | - (void)dealloc 21 | { 22 | if (_framebufferHandle) { 23 | glDeleteFramebuffers(1, &_framebufferHandle); 24 | _framebufferHandle = 0; 25 | } 26 | } 27 | 28 | - (instancetype)init 29 | { 30 | self = [super init]; 31 | if (self) { 32 | _lastTime = kCMTimeInvalid; 33 | _currentTime = kCMTimeInvalid; 34 | 35 | runSynchronouslyOnVideoProcessingQueue(^{ 36 | glGenFramebuffers(1, &_framebufferHandle); 37 | glBindFramebuffer(GL_FRAMEBUFFER, _framebufferHandle); 38 | }); 39 | } 40 | 41 | return self; 42 | } 43 | 44 | - (void)setSticker:(SKSticker *)sticker 45 | { 46 | runAsynchronouslyOnVideoProcessingQueue(^{ 47 | if (_sticker == sticker) { 48 | return; 49 | } 50 | 51 | [GPUImageContext useImageProcessingContext]; 52 | 53 | [_sticker reset]; 54 | _sticker = sticker; 55 | }); 56 | } 57 | 58 | - (void)setFaces:(NSArray *)faces 59 | { 60 | runAsynchronouslyOnVideoProcessingQueue(^{ 61 | _faces = faces; 62 | }); 63 | } 64 | 65 | 66 | #pragma mark - Override 67 | - (void)newFrameReadyAtTime:(CMTime)frameTime atIndex:(NSInteger)textureIndex 68 | { 69 | _currentTime = frameTime; 70 | [super newFrameReadyAtTime:frameTime atIndex:textureIndex]; 71 | } 72 | 73 | - (void)renderToTextureWithVertices:(const GLfloat *)vertices textureCoordinates:(const GLfloat *)textureCoordinates; 74 | { 75 | if (self.preventRendering) 76 | { 77 | [firstInputFramebuffer unlock]; 78 | return; 79 | } 80 | 81 | if (usingNextFrameForImageCapture) 82 | { 83 | [firstInputFramebuffer lock]; 84 | } 85 | 86 | // 与上一帧的间隔 87 | NSTimeInterval interval = 0; 88 | if (CMTIME_IS_VALID(_lastTime)) { 89 | interval = CMTimeGetSeconds(CMTimeSubtract(_currentTime, _lastTime)); 90 | } 91 | _lastTime = _currentTime; 92 | 93 | if (self.faces.count) { 94 | // 开启混合 95 | glEnable(GL_BLEND); 96 | glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); 97 | 98 | glBindFramebuffer(GL_FRAMEBUFFER, _framebufferHandle); 99 | glViewport(0, 0, inputTextureSize.width, inputTextureSize.height); 100 | 101 | // 直接绘制在源纹理上 102 | glActiveTexture(GL_TEXTURE0); 103 | glBindTexture(GL_TEXTURE_2D, firstInputFramebuffer.texture); 104 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, firstInputFramebuffer.texture, 0); 105 | 106 | [GPUImageContext setActiveShaderProgram:filterProgram]; 107 | 108 | for (NSArray *points in _faces) { 109 | [_sticker drawItemsWithFacePoints:points 110 | framebufferSize:inputTextureSize 111 | timeInterval:interval 112 | usingBlock:^(GLfloat *vertices, GLuint texture) { 113 | glActiveTexture(GL_TEXTURE2); 114 | glBindTexture(GL_TEXTURE_2D, texture); 115 | 116 | glUniform1i(filterInputTextureUniform, 2); 117 | 118 | glVertexAttribPointer(filterPositionAttribute, 2, GL_FLOAT, 0, 0, vertices); 119 | glVertexAttribPointer(filterTextureCoordinateAttribute, 2, GL_FLOAT, 0, 0, textureCoordinates); 120 | 121 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 122 | glBindTexture(GL_TEXTURE_2D, 0); 123 | }]; 124 | } 125 | 126 | glDisable(GL_BLEND); 127 | } 128 | 129 | // 直接用输入作为输出 130 | outputFramebuffer = firstInputFramebuffer; 131 | 132 | if (usingNextFrameForImageCapture) 133 | { 134 | dispatch_semaphore_signal(imageCaptureSemaphore); 135 | } 136 | } 137 | 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerItem+OpenGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // SKStickerItem+OpenGL.h 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/5. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "SKStickerItem.h" 10 | 11 | @interface SKStickerItem (OpenGL) 12 | 13 | /** 14 | 根据时间间隔及当前帧的位置,获取下一帧图片,并生成纹理,供OpenGL使用 15 | 16 | @param interval 如视频流每帧的间隔 17 | @return 纹理 18 | */ 19 | - (GLuint)nextTextureForInterval:(NSTimeInterval)interval; 20 | 21 | /** 22 | 删除所有加载的纹理 23 | */ 24 | - (void)deleteTextures; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerItem+OpenGL.m: -------------------------------------------------------------------------------- 1 | // 2 | // SKStickerItem+OpenGL.m 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/5. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "SKStickerItem+OpenGL.h" 10 | 11 | #import 12 | #import 13 | 14 | static void *kTexturesWrapperKey = &kTexturesWrapperKey; 15 | 16 | @interface SKTexturesWrapper : NSObject 17 | 18 | - (instancetype)initWithSize:(NSUInteger)size; 19 | 20 | - (GLuint)textureAtIndex:(NSUInteger)index; 21 | - (void)setTexture:(GLuint)texture atIndex:(NSUInteger)index; 22 | 23 | - (void)removeAllTextures; 24 | 25 | @end 26 | 27 | 28 | @implementation SKTexturesWrapper 29 | { 30 | GLuint *_textureArr; 31 | NSUInteger _size; 32 | } 33 | 34 | - (void)dealloc 35 | { 36 | [self removeAllTextures]; 37 | } 38 | 39 | - (instancetype)initWithSize:(NSUInteger)size 40 | { 41 | self = [super init]; 42 | if (self) { 43 | _size = size; 44 | } 45 | 46 | return self; 47 | } 48 | 49 | - (GLuint)textureAtIndex:(NSUInteger)index 50 | { 51 | if (_textureArr == NULL) { 52 | _textureArr = (GLuint *)malloc(_size * sizeof(GLuint)); 53 | if (_textureArr == NULL) { 54 | // 分配内存失败 55 | return 0; 56 | } 57 | 58 | for (int i = 0; i < _size; i++) { 59 | _textureArr[i] = 0; 60 | } 61 | } 62 | 63 | return _textureArr[index]; 64 | } 65 | 66 | - (void)setTexture:(GLuint)texture atIndex:(NSUInteger)index 67 | { 68 | _textureArr[index] = texture; 69 | } 70 | 71 | - (void)removeAllTextures 72 | { 73 | if (_textureArr) { 74 | glDeleteTextures((GLsizei)_size, _textureArr); 75 | free(_textureArr); 76 | _textureArr = NULL; 77 | } 78 | } 79 | 80 | @end 81 | 82 | 83 | @implementation SKStickerItem (OpenGL) 84 | 85 | - (SKTexturesWrapper *)textures 86 | { 87 | SKTexturesWrapper *wrapper = objc_getAssociatedObject(self, kTexturesWrapperKey); 88 | if (!wrapper) { 89 | wrapper = [[SKTexturesWrapper alloc] initWithSize:self.count]; 90 | objc_setAssociatedObject(self, kTexturesWrapperKey, wrapper, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 91 | } 92 | 93 | return wrapper; 94 | } 95 | 96 | - (GLuint)_textureWithImage:(UIImage *)image 97 | { 98 | CGImageRef imageRef = image.CGImage; 99 | if (!imageRef) { 100 | // Failed to load image 101 | return 0; 102 | } 103 | 104 | size_t width = CGImageGetWidth(imageRef); 105 | size_t height = CGImageGetHeight(imageRef); 106 | 107 | GLubyte *imageData = (GLubyte *) calloc(width * height * 4, sizeof(GLubyte)); 108 | 109 | CGContextRef spriteContext = CGBitmapContextCreate(imageData, width, height, 8, width * 4, CGImageGetColorSpace(imageRef), kCGImageAlphaPremultipliedLast); 110 | CGContextDrawImage(spriteContext, CGRectMake(0, 0, width, height), imageRef); 111 | CGContextRelease(spriteContext); 112 | 113 | GLuint texture; 114 | glGenTextures(1, &texture); 115 | glBindTexture(GL_TEXTURE_2D, texture); 116 | 117 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData); 118 | 119 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 120 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 121 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 122 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 123 | 124 | free(imageData); 125 | 126 | return texture; 127 | } 128 | 129 | - (GLuint)_textureAtIndex:(NSUInteger)index 130 | { 131 | if (index >= self.count) { 132 | return 0; 133 | } 134 | 135 | GLuint texture = [[self textures] textureAtIndex:index]; 136 | if (texture == 0) { 137 | texture = [self _textureWithImage:[self imageAtIndex:index]]; 138 | [[self textures] setTexture:texture atIndex:index]; 139 | } 140 | 141 | return texture; 142 | } 143 | 144 | - (GLuint)nextTextureForInterval:(NSTimeInterval)interval 145 | { 146 | self.currentFrameIndex = [self nextFrameIndexForInterval:interval]; 147 | 148 | return [self _textureAtIndex:self.currentFrameIndex]; 149 | } 150 | 151 | - (void)deleteTextures 152 | { 153 | [[self textures] removeAllTextures]; 154 | } 155 | 156 | @end 157 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // SKSticker.h 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/10/14. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | SKStickerItemTypeFace, // 脸部 13 | SKStickerItemTypeScreen, // 屏幕 14 | } SKStickerItemType; 15 | 16 | 17 | typedef enum { 18 | SKStickerItemAlignPositionTop, 19 | SKStickerItemAlignPositionLeft, 20 | SKStickerItemAlignPositionBottom, 21 | SKStickerItemAlignPositionRight, 22 | SKStickerItemAlignPositionCenter 23 | // ... 24 | } SKStickerItemAlignPosition; 25 | 26 | typedef enum { 27 | SKStickerItemTriggerTypeNormal, // 始终 28 | SKStickerItemTriggerTypeFace, // 有人脸 29 | SKStickerItemTriggerTypeMouthOpen, // 张嘴 30 | SKStickerItemTriggerTypeBlink, // 眨眼 31 | SKStickerItemTriggerTypeFrown // 皱眉 32 | } SKStickerItemTriggerType; 33 | 34 | 35 | /** 36 | 一套贴纸中,某一部件(如鼻子)的所有信息。 37 | */ 38 | @interface SKStickerItem : NSObject 39 | 40 | /** 41 | 显示的位置类型 42 | */ 43 | @property (nonatomic) SKStickerItemType type; 44 | 45 | /** 46 | 触发条件,默认0,始终显示 47 | */ 48 | @property (nonatomic) SKStickerItemTriggerType triggerType; 49 | 50 | /** 51 | 资源的目录(包含一组图片序列帧) 52 | */ 53 | @property (nonatomic, copy) NSString *dir; 54 | 55 | /** 56 | 帧数(一组序列帧组成一个动画效果) 57 | */ 58 | @property (nonatomic) NSUInteger count; 59 | 60 | /** 61 | 每帧的持续时间,秒 62 | */ 63 | @property (nonatomic) NSTimeInterval frameDuration; 64 | 65 | /** 66 | 图片的宽 67 | */ 68 | @property (nonatomic) float width; 69 | 70 | /** 71 | 图片的高 72 | */ 73 | @property (nonatomic) float height; 74 | 75 | // 脸部item参数 76 | /** 77 | 在脸部的参考点索引 78 | */ 79 | @property (nonatomic, copy) NSArray *alignIndexes; 80 | 81 | /** 82 | 边缘item参数 83 | 边缘位置(top、bottom、left、right) 84 | */ 85 | 86 | @property (nonatomic) SKStickerItemAlignPosition alignPosition; 87 | 88 | /** 89 | 宽度缩放系数(对于脸部的item,以眼间距为参考;对于边缘的item则以屏幕的宽高作为参考,下同) 90 | */ 91 | @property (nonatomic) float scaleWidth; 92 | 93 | /** 94 | 高度缩放系数 95 | */ 96 | @property (nonatomic) float scaleHeight; 97 | 98 | /** 99 | 水平方向偏移系数 100 | */ 101 | @property (nonatomic) float offsetX; 102 | 103 | /** 104 | 垂直方向偏移系数 105 | */ 106 | @property (nonatomic) float offsetY; 107 | 108 | 109 | /** 110 | 已触发 111 | */ 112 | @property (nonatomic) BOOL triggered; 113 | 114 | /** 115 | 当前帧的索引 116 | */ 117 | @property (nonatomic) NSUInteger currentFrameIndex; 118 | 119 | /** 120 | 剩余循环次数 121 | */ 122 | @property (nonatomic) NSUInteger loopCountdown; 123 | 124 | 125 | /** 126 | 初始化 127 | 128 | @param dict 包含item数据的字典 129 | @return item实例 130 | */ 131 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict; 132 | 133 | 134 | /** 135 | 根据时间间隔及当前帧的位置,获取下一帧图片,以此适应不同帧率的视频流,保证动画的效果。 136 | 137 | @param interval 如视频流每帧的间隔 138 | @return 此图片可以加到当前的视频帧中 139 | */ 140 | - (NSUInteger)nextFrameIndexForInterval:(NSTimeInterval)interval; 141 | 142 | /** 143 | 根据索引获取对应的图片 144 | 145 | @param index 图片在目录中的索引 146 | @return UIImage图片 147 | */ 148 | - (UIImage *)imageAtIndex:(NSUInteger)index; 149 | 150 | @end 151 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // SKSticker.m 3 | // PLMediaStreamingKitDemo 4 | // 5 | // Created by Sinkup on 2016/10/14. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "SKSticker.h" 10 | 11 | 12 | @interface SKStickerItem () 13 | 14 | /** 15 | 计数器 16 | */ 17 | @property (nonatomic) NSTimeInterval accumulator; 18 | 19 | @end 20 | 21 | @implementation SKStickerItem 22 | { 23 | NSArray *_imageFileURLs; 24 | } 25 | 26 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict 27 | { 28 | self = [super init]; 29 | if (self) { 30 | _type = [[dict objectForKey:@"type"] intValue]; 31 | _triggerType = [[dict objectForKey:@"triggerType"] intValue]; 32 | 33 | _alignPosition = [[dict objectForKey:@"alignPos"] intValue]; 34 | 35 | _dir = [dict objectForKey:@"folder"]; 36 | _count = [[dict objectForKey:@"frames"] intValue]; 37 | 38 | _frameDuration = [[dict objectForKey:@"frameDuration"] doubleValue] / 1000.; 39 | _width = [[dict objectForKey:@"width"] floatValue]; 40 | _height = [[dict objectForKey:@"height"] floatValue]; 41 | 42 | _alignIndexes = [dict objectForKey:@"alignIndexes"]; 43 | _scaleWidth = [[dict objectForKey:@"scaleWidth"] floatValue]; 44 | _scaleHeight = [[dict objectForKey:@"scaleHeight"] floatValue]; 45 | _offsetX = [[dict objectForKey:@"offsetX"] floatValue]; 46 | _offsetY = [[dict objectForKey:@"offsetY"] floatValue]; 47 | 48 | _triggered = NO; 49 | _currentFrameIndex = 0; 50 | _loopCountdown = NSUIntegerMax; 51 | _accumulator = 0.; 52 | } 53 | 54 | return self; 55 | } 56 | 57 | - (NSUInteger)nextFrameIndexForInterval:(NSTimeInterval)interval 58 | { 59 | // 此处参考了FLAnimatedImage加载GIF的做法 60 | if (self.loopCountdown == 0) { 61 | return self.currentFrameIndex; 62 | } 63 | 64 | NSUInteger nextFrameIndex = self.currentFrameIndex; 65 | self.accumulator += interval; 66 | 67 | while (self.accumulator > self.frameDuration) { 68 | self.accumulator -= self.frameDuration; 69 | nextFrameIndex++; 70 | if (nextFrameIndex >= self.count) { 71 | // If we've looped the number of times that this animated image describes, stop looping. 72 | self.loopCountdown--; 73 | 74 | if (self.loopCountdown == 0) { 75 | nextFrameIndex = self.count - 1; 76 | break; 77 | } else { 78 | nextFrameIndex = 0; 79 | } 80 | } 81 | } 82 | 83 | return nextFrameIndex; 84 | } 85 | 86 | - (UIImage *)imageAtIndex:(NSUInteger)index 87 | { 88 | if (_imageFileURLs.count <= 0) { 89 | [self _loadImages]; 90 | } 91 | 92 | if (index >= _imageFileURLs.count) { 93 | return nil; 94 | } 95 | 96 | return [UIImage imageWithContentsOfFile:[[_imageFileURLs objectAtIndex:index] path]]; 97 | } 98 | 99 | - (void)_loadImages 100 | { 101 | NSURL *diskCacheURL = [NSURL fileURLWithPath:self.dir isDirectory:YES]; 102 | NSArray *resourceKeys = @[NSURLIsDirectoryKey, NSURLContentModificationDateKey, NSURLNameKey]; 103 | 104 | // 先获取缓存文件的相关属性 105 | NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtURL:diskCacheURL 106 | includingPropertiesForKeys:resourceKeys 107 | options:NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsHiddenFiles 108 | errorHandler:^BOOL(NSURL * _Nonnull url, NSError * _Nonnull error) { 109 | NSLog(@"error: %@", error); 110 | return NO; 111 | }]; 112 | 113 | NSMutableDictionary *imageFiles = [NSMutableDictionary dictionary]; 114 | 115 | // 遍历目录下的所有文件 116 | for (NSURL *fileURL in fileEnumerator) { 117 | NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:NULL]; 118 | if ([resourceValues[NSURLIsDirectoryKey] boolValue]) { 119 | continue; 120 | } 121 | 122 | [imageFiles setObject:resourceValues forKey:fileURL]; 123 | } 124 | 125 | _imageFileURLs = [imageFiles keysSortedByValueWithOptions:NSSortConcurrent 126 | usingComparator:^NSComparisonResult(id obj1, id obj2) { 127 | return [obj1[NSURLNameKey] compare:obj2[NSURLNameKey] options:NSNumericSearch]; 128 | }]; 129 | } 130 | 131 | @end 132 | 133 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/angel_audio.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/angel_audio.mp3 -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_000.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_001.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_002.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_003.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_004.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_005.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_006.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_007.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_008.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_009.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_010.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_011.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_012.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_013.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_014.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_015.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_016.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_017.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_018.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_019.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_020.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_021.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_022.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_023.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_024.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_025.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_026.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_026.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_027.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_027.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_028.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_028.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_029.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_030.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_030.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_031.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_031.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_032.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_032.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_033.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_033.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_034.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_034.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_035.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_035.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_036.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_036.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_037.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_037.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_038.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_038.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_039.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_039.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_040.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/halo/halo_040.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_000.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_001.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_002.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_003.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_004.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_005.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_006.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_007.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_008.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_009.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_010.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_011.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_012.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_013.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_014.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_015.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_016.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_017.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_018.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_019.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_020.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_021.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_022.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_023.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_024.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_025.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_026.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_026.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_027.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_027.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_028.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_028.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_029.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_030.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_030.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_031.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_031.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_032.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_032.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_033.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_033.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_034.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_034.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_035.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_035.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_036.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_036.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_037.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_037.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_038.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_038.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_039.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_039.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_040.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/light/light_040.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "name": "angel", 4 | "preview": "preview.jpg", 5 | "audio": "angel_audio.mp3", 6 | "items": [ 7 | { 8 | "type": 1, 9 | "alignPos": 0, 10 | "scaleWidth": 1, 11 | "scaleHight": 0, 12 | "offsetX": 0, 13 | "offsetY": 0, 14 | "folder": "light", 15 | "frames": 41, 16 | "frameDuration": 100, 17 | "width": 360, 18 | "height": 640, 19 | "triggerType": 1 20 | }, 21 | { 22 | "type": 0, 23 | "scaleWidth": 2.5, 24 | "scaleHight": 0, 25 | "offsetX": 0, 26 | "offsetY": -3, 27 | "alignIndexes": [ 28 | 36, 28, 45 29 | ], 30 | "folder": "halo", 31 | "frames": 41, 32 | "frameDuration": 100, 33 | "width": 351, 34 | "height": 159, 35 | "triggerType": 1 36 | }, 37 | { 38 | "type": 0, 39 | "scaleWidth": 2.0, 40 | "scaleHight": 0, 41 | "offsetX": 0, 42 | "offsetY": 0, 43 | "alignIndexes": [ 44 | 31, 30, 35 45 | ], 46 | "folder": "shy", 47 | "frames": 41, 48 | "frameDuration": 100, 49 | "width": 182, 50 | "height": 44, 51 | "triggerType": 1 52 | } 53 | ] 54 | } 55 | -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/preview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/preview.jpg -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_000.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_001.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_002.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_003.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_004.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_005.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_006.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_007.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_008.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_009.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_010.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_011.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_012.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_013.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_014.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_015.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_016.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_017.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_018.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_019.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_020.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_021.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_022.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_023.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_024.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_025.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_026.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_026.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_027.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_027.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_028.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_028.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_029.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_030.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_030.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_031.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_031.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_032.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_032.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_033.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_033.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_034.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_034.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_035.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_035.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_036.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_036.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_037.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_037.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_038.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_038.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_039.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_039.png -------------------------------------------------------------------------------- /CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_040.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/Sticker/SKStickerResources.bundle/stickers/angel/shy/shy_040.png -------------------------------------------------------------------------------- /CameraStickerDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/4. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CameraStickerDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/4. 6 | // Copyright © 2016年 Asura. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import 12 | 13 | #import "SKSticker.h" 14 | #import "SKStickerFilter.h" 15 | 16 | @interface ViewController () 17 | 18 | @property (nonatomic, strong) GPUImageVideoCamera *videoCamera; 19 | @property (nonatomic, strong) GPUImageView *filterView; 20 | 21 | @property (nonatomic, strong) SKStickerFilter *stickerFilter; 22 | 23 | @property (nonatomic, copy) NSArray *stickers; 24 | 25 | @end 26 | 27 | @implementation ViewController 28 | 29 | - (void)viewDidLoad { 30 | [super viewDidLoad]; 31 | // Do any additional setup after loading the view, typically from a nib. 32 | 33 | self.videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionFront]; 34 | self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait; 35 | self.videoCamera.horizontallyMirrorFrontFacingCamera = YES; 36 | self.videoCamera.delegate = self; 37 | 38 | self.stickerFilter = [SKStickerFilter new]; 39 | [self.videoCamera addTarget:self.stickerFilter]; 40 | 41 | self.filterView = [[GPUImageView alloc] initWithFrame:self.view.bounds]; 42 | self.filterView.fillMode = kGPUImageFillModePreserveAspectRatioAndFill; 43 | self.filterView.center = self.view.center; 44 | 45 | [self.view addSubview:self.filterView]; 46 | 47 | [self.stickerFilter addTarget:self.filterView]; 48 | [self.videoCamera startCameraCapture]; 49 | 50 | [SKStickersManager loadStickersWithCompletion:^(NSArray *stickers) { 51 | self.stickers = stickers; 52 | self.stickerFilter.sticker = [stickers firstObject]; 53 | }]; 54 | } 55 | 56 | 57 | - (void)didReceiveMemoryWarning { 58 | [super didReceiveMemoryWarning]; 59 | // Dispose of any resources that can be recreated. 60 | } 61 | 62 | 63 | #pragma mark - GPUImageVideoCameraDelegate 64 | - (void)willOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer 65 | { 66 | // 在这里做人脸的检测 67 | 68 | // 使用假数据 69 | NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_points" ofType:@"json"]; 70 | NSArray *arr = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path] 71 | options:0 72 | error:nil]; 73 | 74 | NSMutableArray *faces = [NSMutableArray arrayWithCapacity:arr.count]; 75 | for (NSArray *ele in arr) { 76 | NSMutableArray *points = [NSMutableArray arrayWithCapacity:ele.count]; 77 | for (NSDictionary *dic in ele) { 78 | CGPoint point = CGPointMake([dic[@"x"] floatValue], [dic[@"y"] floatValue]); 79 | [points addObject:[NSValue valueWithCGPoint:point]]; 80 | } 81 | 82 | [faces addObject:points]; 83 | } 84 | 85 | self.stickerFilter.faces = faces; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /CameraStickerDemo/fake_points.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "x": 131.7406, 5 | "y": 340.8895 6 | }, 7 | { 8 | "x": 125.6685, 9 | "y": 371.2215 10 | }, 11 | { 12 | "x": 123.6813, 13 | "y": 400.9718 14 | }, 15 | { 16 | "x": 122.0216, 17 | "y": 431.1839 18 | }, 19 | { 20 | "x": 122.3351, 21 | "y": 461.9583 22 | }, 23 | { 24 | "x": 127.5426, 25 | "y": 491.7217 26 | }, 27 | { 28 | "x": 139.2071, 29 | "y": 518.8499 30 | }, 31 | { 32 | "x": 158.4164, 33 | "y": 541.5963 34 | }, 35 | { 36 | "x": 185.4952, 37 | "y": 554.0742 38 | }, 39 | { 40 | "x": 218.9661, 41 | "y": 557.1118 42 | }, 43 | { 44 | "x": 252.1497, 45 | "y": 549.5577 46 | }, 47 | { 48 | "x": 281.2055, 49 | "y": 536.0714 50 | }, 51 | { 52 | "x": 302.1887, 53 | "y": 514.8015 54 | }, 55 | { 56 | "x": 319.3477, 57 | "y": 488.1451 58 | }, 59 | { 60 | "x": 335.0614, 61 | "y": 458.653 62 | }, 63 | { 64 | "x": 346.2709, 65 | "y": 429.4829 66 | }, 67 | { 68 | "x": 356.4258, 69 | "y": 398.7696 70 | }, 71 | { 72 | "x": 146.0639, 73 | "y": 317.3871 74 | }, 75 | { 76 | "x": 160.9135, 77 | "y": 307.8126 78 | }, 79 | { 80 | "x": 179.6572, 81 | "y": 309.357 82 | }, 83 | { 84 | "x": 198.3318, 85 | "y": 317.1787 86 | }, 87 | { 88 | "x": 212.6046, 89 | "y": 329.4187 90 | }, 91 | { 92 | "x": 253.3295, 93 | "y": 339.9413 94 | }, 95 | { 96 | "x": 275.7542, 97 | "y": 338.3323 98 | }, 99 | { 100 | "x": 298.2805, 101 | "y": 340.9342 102 | }, 103 | { 104 | "x": 318.2485, 105 | "y": 349.1264 106 | }, 107 | { 108 | "x": 330.6303, 109 | "y": 365.408 110 | }, 111 | { 112 | "x": 226.8925, 113 | "y": 362.4234 114 | }, 115 | { 116 | "x": 220.6212, 117 | "y": 384.1551 118 | }, 119 | { 120 | "x": 214.3503, 121 | "y": 404.907 122 | }, 123 | { 124 | "x": 208.027, 125 | "y": 426.0616 126 | }, 127 | { 128 | "x": 185.4641, 129 | "y": 437.1811 130 | }, 131 | { 132 | "x": 195.5037, 133 | "y": 443.3482 134 | }, 135 | { 136 | "x": 205.7493, 137 | "y": 448.5341 138 | }, 139 | { 140 | "x": 218.0873, 141 | "y": 448.6437 142 | }, 143 | { 144 | "x": 230.9323, 145 | "y": 448.7363 146 | }, 147 | { 148 | "x": 159.4489, 149 | "y": 347.3301 150 | }, 151 | { 152 | "x": 172.3815, 153 | "y": 343.518 154 | }, 155 | { 156 | "x": 186.7379, 157 | "y": 348.281 158 | }, 159 | { 160 | "x": 198.0521, 161 | "y": 359.6672 162 | }, 163 | { 164 | "x": 183.3263, 165 | "y": 359.8953 166 | }, 167 | { 168 | "x": 168.982, 169 | "y": 356.0909 170 | }, 171 | { 172 | "x": 262.1671, 173 | "y": 377.2523 174 | }, 175 | { 176 | "x": 275.8983, 177 | "y": 372.6936 178 | }, 179 | { 180 | "x": 290.5009, 181 | "y": 377.0206 182 | }, 183 | { 184 | "x": 302.5329, 185 | "y": 387.2983 186 | }, 187 | { 188 | "x": 287.5633, 189 | "y": 389.1215 190 | }, 191 | { 192 | "x": 273.3022, 193 | "y": 385.1917 194 | }, 195 | { 196 | "x": 164.5823, 197 | "y": 472.2885 198 | }, 199 | { 200 | "x": 178.8385, 201 | "y": 469.2852 202 | }, 203 | { 204 | "x": 192.3506, 205 | "y": 468.5268 206 | }, 207 | { 208 | "x": 201.7503, 209 | "y": 474.3044 210 | }, 211 | { 212 | "x": 213.622, 213 | "y": 474.4883 214 | }, 215 | { 216 | "x": 226.1297, 217 | "y": 483.0049 218 | }, 219 | { 220 | "x": 242.5129, 221 | "y": 494.1271 222 | }, 223 | { 224 | "x": 223.0582, 225 | "y": 499.9104 226 | }, 227 | { 228 | "x": 208.3176, 229 | "y": 500.5833 230 | }, 231 | { 232 | "x": 195.5879, 233 | "y": 498.322 234 | }, 235 | { 236 | "x": 185.1774, 237 | "y": 493.7508 238 | }, 239 | { 240 | "x": 175.4962, 241 | "y": 486.624 242 | }, 243 | { 244 | "x": 171.1876, 245 | "y": 474.5204 246 | }, 247 | { 248 | "x": 189.4364, 249 | "y": 478.6865 250 | }, 251 | { 252 | "x": 199.5222, 253 | "y": 483.0894 254 | }, 255 | { 256 | "x": 211.3905, 257 | "y": 484.8077 258 | }, 259 | { 260 | "x": 235.3465, 261 | "y": 491.9236 262 | }, 263 | { 264 | "x": 210.8707, 265 | "y": 485.3105 266 | }, 267 | { 268 | "x": 199.1294, 269 | "y": 483.3401 270 | }, 271 | { 272 | "x": 187.2063, 273 | "y": 479.4741 274 | } 275 | ] 276 | ] 277 | -------------------------------------------------------------------------------- /CameraStickerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CameraStickerDemo 4 | // 5 | // Created by Sinkup on 2016/12/4. 6 | // Copyright © 2016年 SK. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CameraStickerDemo/tracker_points.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangyongchang126/CameraStickerDemo/dd437bfd0a14e8637b3842cb26ce6588b8f2cbc2/CameraStickerDemo/tracker_points.png -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Sinkup 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '8.0' 3 | 4 | target 'CameraStickerDemo' do 5 | pod 'GPUImage' 6 | end -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CameraStickerDemo 2 | 基于GPUImage的贴纸滤镜。可以借助人脸跟踪程序获取脸部的关键点数据,然后将贴纸资源绘制到实时视频流的相应位置上。 3 | 4 | 贴纸资源以文件形式保存,并使用`meta.json`配置其相关参数,通过代码读取并加载,包括`SKSticker`和`SKStickerItem`两个主要的类。 5 | 6 | `SKStickerFilter`用于绘制贴纸,继承自`GPUImageFilter`。 7 | 8 | 9 | ### 人脸数据 10 | 此Demo中不包含人脸跟踪程序,人脸数据为保存在文件中的假数据,仅作演示用。 11 | 12 | 13 | ### 效果图 14 |

alt text

15 | 16 | 17 | 18 | --------------------------------------------------------------------------------