├── .gitignore ├── Demo ├── SVBlurView.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcuserdata │ │ └── sam.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── SVBlurView.xcscheme │ │ └── xcschememanagement.plist └── SVBlurView │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ └── Main.storyboard │ ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json │ ├── SVBlurView-Info.plist │ ├── SVBlurView-Prefix.pch │ ├── ViewController.h │ ├── ViewController.m │ ├── background@2x.png │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── LICENSE.txt ├── README.md └── SVBlurView ├── SVBlurView.h ├── SVBlurView.m ├── UIImage+ImageEffects.h └── UIImage+ImageEffects.m /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa -------------------------------------------------------------------------------- /Demo/SVBlurView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 22EF1070181325A900CDF72C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EF106F181325A900CDF72C /* Foundation.framework */; }; 11 | 22EF1072181325A900CDF72C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EF1071181325A900CDF72C /* CoreGraphics.framework */; }; 12 | 22EF1074181325A900CDF72C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EF1073181325A900CDF72C /* UIKit.framework */; }; 13 | 22EF107A181325A900CDF72C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 22EF1078181325A900CDF72C /* InfoPlist.strings */; }; 14 | 22EF107C181325A900CDF72C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 22EF107B181325A900CDF72C /* main.m */; }; 15 | 22EF1080181325A900CDF72C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 22EF107F181325A900CDF72C /* AppDelegate.m */; }; 16 | 22EF1083181325A900CDF72C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 22EF1081181325A900CDF72C /* Main.storyboard */; }; 17 | 22EF1086181325A900CDF72C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22EF1085181325A900CDF72C /* ViewController.m */; }; 18 | 22EF1088181325A900CDF72C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 22EF1087181325A900CDF72C /* Images.xcassets */; }; 19 | 22EF108F181325AA00CDF72C /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EF108E181325AA00CDF72C /* XCTest.framework */; }; 20 | 22EF1090181325AA00CDF72C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EF106F181325A900CDF72C /* Foundation.framework */; }; 21 | 22EF1091181325AA00CDF72C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EF1073181325A900CDF72C /* UIKit.framework */; }; 22 | 22EF10AA181326D600CDF72C /* background@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 22EF10A9181326D600CDF72C /* background@2x.png */; }; 23 | 22EF10AE18132FD800CDF72C /* SVBlurView.m in Sources */ = {isa = PBXBuildFile; fileRef = 22EF10AD18132FD800CDF72C /* SVBlurView.m */; }; 24 | 22EF10B01813311700CDF72C /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 22EF10AF1813311700CDF72C /* README.md */; }; 25 | 22EF10BB181336AA00CDF72C /* UIImage+ImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = 22EF10BA181336AA00CDF72C /* UIImage+ImageEffects.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 22EF1092181325AA00CDF72C /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 22EF1064181325A900CDF72C /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 22EF106B181325A900CDF72C; 34 | remoteInfo = SVBlurView; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 22EF106C181325A900CDF72C /* SVBlurView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SVBlurView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 22EF106F181325A900CDF72C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | 22EF1071181325A900CDF72C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | 22EF1073181325A900CDF72C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 22EF1077181325A900CDF72C /* SVBlurView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SVBlurView-Info.plist"; sourceTree = ""; }; 44 | 22EF1079181325A900CDF72C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | 22EF107B181325A900CDF72C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 22EF107D181325A900CDF72C /* SVBlurView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SVBlurView-Prefix.pch"; sourceTree = ""; }; 47 | 22EF107E181325A900CDF72C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 22EF107F181325A900CDF72C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 22EF1082181325A900CDF72C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 22EF1084181325A900CDF72C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 51 | 22EF1085181325A900CDF72C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 52 | 22EF1087181325A900CDF72C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 53 | 22EF108D181325AA00CDF72C /* SVBlurViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SVBlurViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 22EF108E181325AA00CDF72C /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 55 | 22EF10A9181326D600CDF72C /* background@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "background@2x.png"; sourceTree = ""; }; 56 | 22EF10AC18132FD800CDF72C /* SVBlurView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVBlurView.h; sourceTree = ""; }; 57 | 22EF10AD18132FD800CDF72C /* SVBlurView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVBlurView.m; sourceTree = ""; }; 58 | 22EF10AF1813311700CDF72C /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.md; path = ../README.md; sourceTree = ""; }; 59 | 22EF10B9181336AA00CDF72C /* UIImage+ImageEffects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+ImageEffects.h"; sourceTree = ""; }; 60 | 22EF10BA181336AA00CDF72C /* UIImage+ImageEffects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+ImageEffects.m"; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 22EF1069181325A900CDF72C /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 22EF1072181325A900CDF72C /* CoreGraphics.framework in Frameworks */, 69 | 22EF1074181325A900CDF72C /* UIKit.framework in Frameworks */, 70 | 22EF1070181325A900CDF72C /* Foundation.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 22EF108A181325AA00CDF72C /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | 22EF108F181325AA00CDF72C /* XCTest.framework in Frameworks */, 79 | 22EF1091181325AA00CDF72C /* UIKit.framework in Frameworks */, 80 | 22EF1090181325AA00CDF72C /* Foundation.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | 22EF1063181325A900CDF72C = { 88 | isa = PBXGroup; 89 | children = ( 90 | 22EF10AF1813311700CDF72C /* README.md */, 91 | 22EF1075181325A900CDF72C /* Classes */, 92 | 22EF10AB18132FD800CDF72C /* SVBlurView */, 93 | 22EF106E181325A900CDF72C /* Frameworks */, 94 | 22EF106D181325A900CDF72C /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 22EF106D181325A900CDF72C /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 22EF106C181325A900CDF72C /* SVBlurView.app */, 102 | 22EF108D181325AA00CDF72C /* SVBlurViewTests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 22EF106E181325A900CDF72C /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 22EF106F181325A900CDF72C /* Foundation.framework */, 111 | 22EF1071181325A900CDF72C /* CoreGraphics.framework */, 112 | 22EF1073181325A900CDF72C /* UIKit.framework */, 113 | 22EF108E181325AA00CDF72C /* XCTest.framework */, 114 | ); 115 | name = Frameworks; 116 | sourceTree = ""; 117 | }; 118 | 22EF1075181325A900CDF72C /* Classes */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 22EF107E181325A900CDF72C /* AppDelegate.h */, 122 | 22EF107F181325A900CDF72C /* AppDelegate.m */, 123 | 22EF1081181325A900CDF72C /* Main.storyboard */, 124 | 22EF1084181325A900CDF72C /* ViewController.h */, 125 | 22EF1085181325A900CDF72C /* ViewController.m */, 126 | 22EF10A9181326D600CDF72C /* background@2x.png */, 127 | 22EF1087181325A900CDF72C /* Images.xcassets */, 128 | 22EF1076181325A900CDF72C /* Supporting Files */, 129 | ); 130 | name = Classes; 131 | path = SVBlurView; 132 | sourceTree = ""; 133 | }; 134 | 22EF1076181325A900CDF72C /* Supporting Files */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 22EF1077181325A900CDF72C /* SVBlurView-Info.plist */, 138 | 22EF1078181325A900CDF72C /* InfoPlist.strings */, 139 | 22EF107B181325A900CDF72C /* main.m */, 140 | 22EF107D181325A900CDF72C /* SVBlurView-Prefix.pch */, 141 | ); 142 | name = "Supporting Files"; 143 | sourceTree = ""; 144 | }; 145 | 22EF10AB18132FD800CDF72C /* SVBlurView */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 22EF10B9181336AA00CDF72C /* UIImage+ImageEffects.h */, 149 | 22EF10BA181336AA00CDF72C /* UIImage+ImageEffects.m */, 150 | 22EF10AC18132FD800CDF72C /* SVBlurView.h */, 151 | 22EF10AD18132FD800CDF72C /* SVBlurView.m */, 152 | ); 153 | name = SVBlurView; 154 | path = ../SVBlurView; 155 | sourceTree = ""; 156 | }; 157 | /* End PBXGroup section */ 158 | 159 | /* Begin PBXNativeTarget section */ 160 | 22EF106B181325A900CDF72C /* SVBlurView */ = { 161 | isa = PBXNativeTarget; 162 | buildConfigurationList = 22EF109E181325AA00CDF72C /* Build configuration list for PBXNativeTarget "SVBlurView" */; 163 | buildPhases = ( 164 | 22EF1068181325A900CDF72C /* Sources */, 165 | 22EF1069181325A900CDF72C /* Frameworks */, 166 | 22EF106A181325A900CDF72C /* Resources */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | ); 172 | name = SVBlurView; 173 | productName = SVBlurView; 174 | productReference = 22EF106C181325A900CDF72C /* SVBlurView.app */; 175 | productType = "com.apple.product-type.application"; 176 | }; 177 | 22EF108C181325AA00CDF72C /* SVBlurViewTests */ = { 178 | isa = PBXNativeTarget; 179 | buildConfigurationList = 22EF10A1181325AA00CDF72C /* Build configuration list for PBXNativeTarget "SVBlurViewTests" */; 180 | buildPhases = ( 181 | 22EF1089181325AA00CDF72C /* Sources */, 182 | 22EF108A181325AA00CDF72C /* Frameworks */, 183 | 22EF108B181325AA00CDF72C /* Resources */, 184 | ); 185 | buildRules = ( 186 | ); 187 | dependencies = ( 188 | 22EF1093181325AA00CDF72C /* PBXTargetDependency */, 189 | ); 190 | name = SVBlurViewTests; 191 | productName = SVBlurViewTests; 192 | productReference = 22EF108D181325AA00CDF72C /* SVBlurViewTests.xctest */; 193 | productType = "com.apple.product-type.bundle.unit-test"; 194 | }; 195 | /* End PBXNativeTarget section */ 196 | 197 | /* Begin PBXProject section */ 198 | 22EF1064181325A900CDF72C /* Project object */ = { 199 | isa = PBXProject; 200 | attributes = { 201 | LastUpgradeCheck = 0500; 202 | ORGANIZATIONNAME = "Sam Vermette"; 203 | TargetAttributes = { 204 | 22EF108C181325AA00CDF72C = { 205 | TestTargetID = 22EF106B181325A900CDF72C; 206 | }; 207 | }; 208 | }; 209 | buildConfigurationList = 22EF1067181325A900CDF72C /* Build configuration list for PBXProject "SVBlurView" */; 210 | compatibilityVersion = "Xcode 3.2"; 211 | developmentRegion = English; 212 | hasScannedForEncodings = 0; 213 | knownRegions = ( 214 | en, 215 | Base, 216 | ); 217 | mainGroup = 22EF1063181325A900CDF72C; 218 | productRefGroup = 22EF106D181325A900CDF72C /* Products */; 219 | projectDirPath = ""; 220 | projectRoot = ""; 221 | targets = ( 222 | 22EF106B181325A900CDF72C /* SVBlurView */, 223 | 22EF108C181325AA00CDF72C /* SVBlurViewTests */, 224 | ); 225 | }; 226 | /* End PBXProject section */ 227 | 228 | /* Begin PBXResourcesBuildPhase section */ 229 | 22EF106A181325A900CDF72C /* Resources */ = { 230 | isa = PBXResourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | 22EF1088181325A900CDF72C /* Images.xcassets in Resources */, 234 | 22EF10AA181326D600CDF72C /* background@2x.png in Resources */, 235 | 22EF10B01813311700CDF72C /* README.md in Resources */, 236 | 22EF107A181325A900CDF72C /* InfoPlist.strings in Resources */, 237 | 22EF1083181325A900CDF72C /* Main.storyboard in Resources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | 22EF108B181325AA00CDF72C /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | /* End PBXResourcesBuildPhase section */ 249 | 250 | /* Begin PBXSourcesBuildPhase section */ 251 | 22EF1068181325A900CDF72C /* Sources */ = { 252 | isa = PBXSourcesBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | 22EF10AE18132FD800CDF72C /* SVBlurView.m in Sources */, 256 | 22EF10BB181336AA00CDF72C /* UIImage+ImageEffects.m in Sources */, 257 | 22EF1086181325A900CDF72C /* ViewController.m in Sources */, 258 | 22EF1080181325A900CDF72C /* AppDelegate.m in Sources */, 259 | 22EF107C181325A900CDF72C /* main.m in Sources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | 22EF1089181325AA00CDF72C /* Sources */ = { 264 | isa = PBXSourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | /* End PBXSourcesBuildPhase section */ 271 | 272 | /* Begin PBXTargetDependency section */ 273 | 22EF1093181325AA00CDF72C /* PBXTargetDependency */ = { 274 | isa = PBXTargetDependency; 275 | target = 22EF106B181325A900CDF72C /* SVBlurView */; 276 | targetProxy = 22EF1092181325AA00CDF72C /* PBXContainerItemProxy */; 277 | }; 278 | /* End PBXTargetDependency section */ 279 | 280 | /* Begin PBXVariantGroup section */ 281 | 22EF1078181325A900CDF72C /* InfoPlist.strings */ = { 282 | isa = PBXVariantGroup; 283 | children = ( 284 | 22EF1079181325A900CDF72C /* en */, 285 | ); 286 | name = InfoPlist.strings; 287 | sourceTree = ""; 288 | }; 289 | 22EF1081181325A900CDF72C /* Main.storyboard */ = { 290 | isa = PBXVariantGroup; 291 | children = ( 292 | 22EF1082181325A900CDF72C /* Base */, 293 | ); 294 | name = Main.storyboard; 295 | sourceTree = ""; 296 | }; 297 | /* End PBXVariantGroup section */ 298 | 299 | /* Begin XCBuildConfiguration section */ 300 | 22EF109C181325AA00CDF72C /* Debug */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ALWAYS_SEARCH_USER_PATHS = NO; 304 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 305 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 306 | CLANG_CXX_LIBRARY = "libc++"; 307 | CLANG_ENABLE_MODULES = YES; 308 | CLANG_ENABLE_OBJC_ARC = YES; 309 | CLANG_WARN_BOOL_CONVERSION = YES; 310 | CLANG_WARN_CONSTANT_CONVERSION = YES; 311 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 312 | CLANG_WARN_EMPTY_BODY = YES; 313 | CLANG_WARN_ENUM_CONVERSION = YES; 314 | CLANG_WARN_INT_CONVERSION = YES; 315 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 316 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 317 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 318 | COPY_PHASE_STRIP = NO; 319 | GCC_C_LANGUAGE_STANDARD = gnu99; 320 | GCC_DYNAMIC_NO_PIC = NO; 321 | GCC_OPTIMIZATION_LEVEL = 0; 322 | GCC_PREPROCESSOR_DEFINITIONS = ( 323 | "DEBUG=1", 324 | "$(inherited)", 325 | ); 326 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 327 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 328 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 329 | GCC_WARN_UNDECLARED_SELECTOR = YES; 330 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 331 | GCC_WARN_UNUSED_FUNCTION = YES; 332 | GCC_WARN_UNUSED_VARIABLE = YES; 333 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 334 | ONLY_ACTIVE_ARCH = YES; 335 | SDKROOT = iphoneos; 336 | }; 337 | name = Debug; 338 | }; 339 | 22EF109D181325AA00CDF72C /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 344 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 345 | CLANG_CXX_LIBRARY = "libc++"; 346 | CLANG_ENABLE_MODULES = YES; 347 | CLANG_ENABLE_OBJC_ARC = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INT_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 356 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 357 | COPY_PHASE_STRIP = YES; 358 | ENABLE_NS_ASSERTIONS = NO; 359 | GCC_C_LANGUAGE_STANDARD = gnu99; 360 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 361 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 362 | GCC_WARN_UNDECLARED_SELECTOR = YES; 363 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 364 | GCC_WARN_UNUSED_FUNCTION = YES; 365 | GCC_WARN_UNUSED_VARIABLE = YES; 366 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 367 | SDKROOT = iphoneos; 368 | VALIDATE_PRODUCT = YES; 369 | }; 370 | name = Release; 371 | }; 372 | 22EF109F181325AA00CDF72C /* Debug */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 377 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 378 | GCC_PREFIX_HEADER = "SVBlurView/SVBlurView-Prefix.pch"; 379 | INFOPLIST_FILE = "SVBlurView/SVBlurView-Info.plist"; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | WRAPPER_EXTENSION = app; 382 | }; 383 | name = Debug; 384 | }; 385 | 22EF10A0181325AA00CDF72C /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 389 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 390 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 391 | GCC_PREFIX_HEADER = "SVBlurView/SVBlurView-Prefix.pch"; 392 | INFOPLIST_FILE = "SVBlurView/SVBlurView-Info.plist"; 393 | PRODUCT_NAME = "$(TARGET_NAME)"; 394 | WRAPPER_EXTENSION = app; 395 | }; 396 | name = Release; 397 | }; 398 | 22EF10A2181325AA00CDF72C /* Debug */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 402 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SVBlurView.app/SVBlurView"; 403 | FRAMEWORK_SEARCH_PATHS = ( 404 | "$(SDKROOT)/Developer/Library/Frameworks", 405 | "$(inherited)", 406 | "$(DEVELOPER_FRAMEWORKS_DIR)", 407 | ); 408 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 409 | GCC_PREFIX_HEADER = "SVBlurView/SVBlurView-Prefix.pch"; 410 | GCC_PREPROCESSOR_DEFINITIONS = ( 411 | "DEBUG=1", 412 | "$(inherited)", 413 | ); 414 | INFOPLIST_FILE = "SVBlurViewTests/SVBlurViewTests-Info.plist"; 415 | PRODUCT_NAME = "$(TARGET_NAME)"; 416 | TEST_HOST = "$(BUNDLE_LOADER)"; 417 | WRAPPER_EXTENSION = xctest; 418 | }; 419 | name = Debug; 420 | }; 421 | 22EF10A3181325AA00CDF72C /* Release */ = { 422 | isa = XCBuildConfiguration; 423 | buildSettings = { 424 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 425 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SVBlurView.app/SVBlurView"; 426 | FRAMEWORK_SEARCH_PATHS = ( 427 | "$(SDKROOT)/Developer/Library/Frameworks", 428 | "$(inherited)", 429 | "$(DEVELOPER_FRAMEWORKS_DIR)", 430 | ); 431 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 432 | GCC_PREFIX_HEADER = "SVBlurView/SVBlurView-Prefix.pch"; 433 | INFOPLIST_FILE = "SVBlurViewTests/SVBlurViewTests-Info.plist"; 434 | PRODUCT_NAME = "$(TARGET_NAME)"; 435 | TEST_HOST = "$(BUNDLE_LOADER)"; 436 | WRAPPER_EXTENSION = xctest; 437 | }; 438 | name = Release; 439 | }; 440 | /* End XCBuildConfiguration section */ 441 | 442 | /* Begin XCConfigurationList section */ 443 | 22EF1067181325A900CDF72C /* Build configuration list for PBXProject "SVBlurView" */ = { 444 | isa = XCConfigurationList; 445 | buildConfigurations = ( 446 | 22EF109C181325AA00CDF72C /* Debug */, 447 | 22EF109D181325AA00CDF72C /* Release */, 448 | ); 449 | defaultConfigurationIsVisible = 0; 450 | defaultConfigurationName = Release; 451 | }; 452 | 22EF109E181325AA00CDF72C /* Build configuration list for PBXNativeTarget "SVBlurView" */ = { 453 | isa = XCConfigurationList; 454 | buildConfigurations = ( 455 | 22EF109F181325AA00CDF72C /* Debug */, 456 | 22EF10A0181325AA00CDF72C /* Release */, 457 | ); 458 | defaultConfigurationIsVisible = 0; 459 | defaultConfigurationName = Release; 460 | }; 461 | 22EF10A1181325AA00CDF72C /* Build configuration list for PBXNativeTarget "SVBlurViewTests" */ = { 462 | isa = XCConfigurationList; 463 | buildConfigurations = ( 464 | 22EF10A2181325AA00CDF72C /* Debug */, 465 | 22EF10A3181325AA00CDF72C /* Release */, 466 | ); 467 | defaultConfigurationIsVisible = 0; 468 | defaultConfigurationName = Release; 469 | }; 470 | /* End XCConfigurationList section */ 471 | }; 472 | rootObject = 22EF1064181325A900CDF72C /* Project object */; 473 | } 474 | -------------------------------------------------------------------------------- /Demo/SVBlurView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/SVBlurView.xcodeproj/xcuserdata/sam.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Demo/SVBlurView.xcodeproj/xcuserdata/sam.xcuserdatad/xcschemes/SVBlurView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Demo/SVBlurView.xcodeproj/xcuserdata/sam.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SVBlurView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 22EF106B181325A900CDF72C 16 | 17 | primary 18 | 19 | 20 | 22EF108C181325AA00CDF72C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Demo/SVBlurView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SVBlurView 4 | // 5 | // Created by Sam Vermette on 19.10.13. 6 | // Copyright (c) 2013 Sam Vermette. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Demo/SVBlurView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SVBlurView 4 | // 5 | // Created by Sam Vermette on 19.10.13. 6 | // Copyright (c) 2013 Sam Vermette. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Demo/SVBlurView/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 | -------------------------------------------------------------------------------- /Demo/SVBlurView/Images.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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Demo/SVBlurView/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Demo/SVBlurView/SVBlurView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.samvermette.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Demo/SVBlurView/SVBlurView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Demo/SVBlurView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SVBlurView 4 | // 5 | // Created by Sam Vermette on 19.10.13. 6 | // Copyright (c) 2013 Sam Vermette. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/SVBlurView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SVBlurView 4 | // 5 | // Created by Sam Vermette on 19.10.13. 6 | // Copyright (c) 2013 Sam Vermette. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SVBlurView.h" 11 | 12 | 13 | @implementation ViewController 14 | 15 | - (void)viewDidLoad { 16 | [super viewDidLoad]; 17 | 18 | UIImageView *backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background"]]; 19 | backgroundView.frame = self.view.bounds; 20 | backgroundView.contentMode = UIViewContentModeScaleAspectFill; 21 | [self.view addSubview:backgroundView]; 22 | 23 | SVBlurView *blurView = [[SVBlurView alloc] initWithFrame:CGRectMake(60, 100, 200, 200)]; 24 | [backgroundView addSubview:blurView]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Demo/SVBlurView/background@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TransitApp/SVBlurView/222f536562aa6a7809dbd2b56b6342c4ce20115b/Demo/SVBlurView/background@2x.png -------------------------------------------------------------------------------- /Demo/SVBlurView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Demo/SVBlurView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SVBlurView 4 | // 5 | // Created by Sam Vermette on 19.10.13. 6 | // Copyright (c) 2013 Sam Vermette. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Sam Vermette 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SVBlurView 2 | 3 | SVBlurView is a simple reimplementation of FXBlurView for iOS 7. It uses Apple's `UIImage+ImageEffects` category as well as the new `drawViewHierarchyInRect:` UIView API. It doesn't do dynamic blurs yet. 4 | 5 | ![SVBlurView](http://f.cl.ly/items/1q1D0k180z2Y0u2J3x2f/iOS%20Simulator%20Screen%20shot%2019%20Oct,%202013%205.34.21%20PM.png) 6 | 7 | ## Installation 8 | 9 | ### Manually 10 | 11 | * Drag the `SVBlurView/SVBlurView` folder into your project. 12 | * `#import "SVBlurView.h"` 13 | 14 | ## Usage 15 | 16 | (see sample Xcode project in `/Demo`) 17 | 18 | ```objective-c 19 | SVBlurView *blurView = [[SVBlurView alloc] initWithFrame:CGRectMake(60, 100, 200, 200)]; 20 | [backgroundView addSubview:blurView]; 21 | ``` 22 | 23 | #### Customization 24 | 25 | ```objective-c 26 | @property (nonatomic, readwrite) CGFloat blurRadius; // default is 20.0f 27 | @property (nonatomic, readwrite) CGFloat saturationDelta; // default is 1.5 28 | @property (nonatomic, readwrite) UIColor *tintColor; // default nil 29 | ``` 30 | 31 | ## Credits 32 | 33 | SVBlurView is brought to you by [Sam Vermette](http://samvermette.com) and [contributors to the project](https://github.com/samvermette/SVBlurView/contributors). If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by [creating new issues](https://github.com/samvermette/SVBlurView/issues/new). If you're using SVBlurView in your project, attribution would be nice. -------------------------------------------------------------------------------- /SVBlurView/SVBlurView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVBlurView.h 3 | // SVBlurView 4 | // 5 | // Created by Sam Vermette on 19.10.13. 6 | // Copyright (c) 2013 Sam Vermette. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SVBlurView : UIView 12 | 13 | @property (nonatomic, readwrite) CGFloat blurRadius; // default is 20.0f 14 | @property (nonatomic, readwrite) CGFloat saturationDelta; // default is 1.5 15 | @property (nonatomic, readwrite) UIColor *tintColor; // default nil 16 | @property (nonatomic, weak) UIView *viewToBlur; // default is superview 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /SVBlurView/SVBlurView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVBlurView.m 3 | // SVBlurView 4 | // 5 | // Created by Sam Vermette on 19.10.13. 6 | // Copyright (c) 2013 Sam Vermette. All rights reserved. 7 | // 8 | 9 | #import "SVBlurView.h" 10 | #import "UIImage+ImageEffects.h" 11 | 12 | NSString * const SVBlurViewImageKey = @"SVBlurViewImageKey"; 13 | 14 | @interface SVBlurView () 15 | 16 | @end 17 | 18 | 19 | @implementation SVBlurView 20 | 21 | - (id)initWithFrame:(CGRect)frame { 22 | if(self = [super initWithFrame:frame]) { 23 | self.blurRadius = 20; 24 | self.saturationDelta = 1.5; 25 | self.tintColor = nil; 26 | self.viewToBlur = nil; 27 | self.clipsToBounds = YES; 28 | } 29 | return self; 30 | } 31 | 32 | - (void)encodeRestorableStateWithCoder:(NSCoder *)coder { 33 | [super encodeRestorableStateWithCoder:coder]; 34 | 35 | [coder encodeObject:[UIImage imageWithCGImage:(CGImageRef)self.layer.contents] forKey:SVBlurViewImageKey]; 36 | } 37 | 38 | - (void)decodeRestorableStateWithCoder:(NSCoder *)coder { 39 | [super decodeRestorableStateWithCoder:coder]; 40 | 41 | self.layer.contents = (id)[[coder decodeObjectForKey:SVBlurViewImageKey] CGImage]; 42 | } 43 | 44 | - (UIView *)viewToBlur { 45 | if(_viewToBlur) 46 | return _viewToBlur; 47 | return self.superview; 48 | } 49 | 50 | - (void)updateBlur { 51 | UIGraphicsBeginImageContextWithOptions(self.viewToBlur.bounds.size, NO, 0.0); 52 | [self.viewToBlur drawViewHierarchyInRect:self.viewToBlur.bounds afterScreenUpdates:YES]; 53 | UIImage *complexViewImage = UIGraphicsGetImageFromCurrentImageContext(); 54 | UIGraphicsEndImageContext(); 55 | 56 | float scale = [UIScreen mainScreen].scale; 57 | CGRect translationRect = [self convertRect:self.bounds toView:self.viewToBlur]; 58 | CGRect scaledSuperviewFrame = CGRectApplyAffineTransform(translationRect, CGAffineTransformMakeScale(scale, scale)); 59 | CGImageRef croppedImageRef = CGImageCreateWithImageInRect(complexViewImage.CGImage, scaledSuperviewFrame); 60 | UIImage *croppedImage = [UIImage imageWithCGImage:croppedImageRef scale:complexViewImage.scale orientation:complexViewImage.imageOrientation]; 61 | UIImage *blurredImage = [self applyBlurToImage:croppedImage]; 62 | CGImageRelease(croppedImageRef); 63 | 64 | self.layer.contents = (id)blurredImage.CGImage; 65 | } 66 | 67 | - (UIImage *)applyBlurToImage:(UIImage *)image { 68 | return [image applyBlurWithRadius:self.blurRadius 69 | tintColor:self.tintColor 70 | saturationDeltaFactor:self.saturationDelta 71 | maskImage:nil]; 72 | } 73 | 74 | - (void)didMoveToSuperview { 75 | if(self.superview && self.viewToBlur.superview) { 76 | self.backgroundColor = [UIColor clearColor]; 77 | [self updateBlur]; 78 | } 79 | else if (!self.layer.contents) { 80 | self.backgroundColor = [UIColor whiteColor]; 81 | } 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /SVBlurView/UIImage+ImageEffects.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: UIImage+ImageEffects.h 3 | Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur. 4 | Version: 1.0 5 | 6 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 7 | Inc. ("Apple") in consideration of your agreement to the following 8 | terms, and your use, installation, modification or redistribution of 9 | this Apple software constitutes acceptance of these terms. If you do 10 | not agree with these terms, please do not use, install, modify or 11 | redistribute this Apple software. 12 | 13 | In consideration of your agreement to abide by the following terms, and 14 | subject to these terms, Apple grants you a personal, non-exclusive 15 | license, under Apple's copyrights in this original Apple software (the 16 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 17 | Software, with or without modifications, in source and/or binary forms; 18 | provided that if you redistribute the Apple Software in its entirety and 19 | without modifications, you must retain this notice and the following 20 | text and disclaimers in all such redistributions of the Apple Software. 21 | Neither the name, trademarks, service marks or logos of Apple Inc. may 22 | be used to endorse or promote products derived from the Apple Software 23 | without specific prior written permission from Apple. Except as 24 | expressly stated in this notice, no other rights or licenses, express or 25 | implied, are granted by Apple herein, including but not limited to any 26 | patent rights that may be infringed by your derivative works or by other 27 | works in which the Apple Software may be incorporated. 28 | 29 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 30 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 31 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 32 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 33 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 34 | 35 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 36 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 37 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 38 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 39 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 40 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 41 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 42 | POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 45 | 46 | 47 | Copyright © 2013 Apple Inc. All rights reserved. 48 | WWDC 2013 License 49 | 50 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2013 51 | Session. Please refer to the applicable WWDC 2013 Session for further 52 | information. 53 | 54 | IMPORTANT: This Apple software is supplied to you by Apple Inc. 55 | ("Apple") in consideration of your agreement to the following terms, and 56 | your use, installation, modification or redistribution of this Apple 57 | software constitutes acceptance of these terms. If you do not agree with 58 | these terms, please do not use, install, modify or redistribute this 59 | Apple software. 60 | 61 | In consideration of your agreement to abide by the following terms, and 62 | subject to these terms, Apple grants you a non-exclusive license, under 63 | Apple's copyrights in this original Apple software (the "Apple 64 | Software"), to use, reproduce, modify and redistribute the Apple 65 | Software, with or without modifications, in source and/or binary forms; 66 | provided that if you redistribute the Apple Software in its entirety and 67 | without modifications, you must retain this notice and the following 68 | text and disclaimers in all such redistributions of the Apple Software. 69 | Neither the name, trademarks, service marks or logos of Apple Inc. may 70 | be used to endorse or promote products derived from the Apple Software 71 | without specific prior written permission from Apple. Except as 72 | expressly stated in this notice, no other rights or licenses, express or 73 | implied, are granted by Apple herein, including but not limited to any 74 | patent rights that may be infringed by your derivative works or by other 75 | works in which the Apple Software may be incorporated. 76 | 77 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES 78 | NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE 79 | IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR 80 | A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 81 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 82 | 83 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 84 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 85 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 86 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 87 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 88 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 89 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 90 | POSSIBILITY OF SUCH DAMAGE. 91 | 92 | EA1002 93 | 5/3/2013 94 | */ 95 | 96 | @import UIKit; 97 | 98 | @interface UIImage (ImageEffects) 99 | 100 | - (UIImage *)applyLightEffect; 101 | - (UIImage *)applyExtraLightEffect; 102 | - (UIImage *)applyDarkEffect; 103 | - (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor; 104 | 105 | - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage; 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /SVBlurView/UIImage+ImageEffects.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: UIImage+ImageEffects.m 3 | Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur. 4 | Version: 1.0 5 | 6 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 7 | Inc. ("Apple") in consideration of your agreement to the following 8 | terms, and your use, installation, modification or redistribution of 9 | this Apple software constitutes acceptance of these terms. If you do 10 | not agree with these terms, please do not use, install, modify or 11 | redistribute this Apple software. 12 | 13 | In consideration of your agreement to abide by the following terms, and 14 | subject to these terms, Apple grants you a personal, non-exclusive 15 | license, under Apple's copyrights in this original Apple software (the 16 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 17 | Software, with or without modifications, in source and/or binary forms; 18 | provided that if you redistribute the Apple Software in its entirety and 19 | without modifications, you must retain this notice and the following 20 | text and disclaimers in all such redistributions of the Apple Software. 21 | Neither the name, trademarks, service marks or logos of Apple Inc. may 22 | be used to endorse or promote products derived from the Apple Software 23 | without specific prior written permission from Apple. Except as 24 | expressly stated in this notice, no other rights or licenses, express or 25 | implied, are granted by Apple herein, including but not limited to any 26 | patent rights that may be infringed by your derivative works or by other 27 | works in which the Apple Software may be incorporated. 28 | 29 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 30 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 31 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 32 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 33 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 34 | 35 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 36 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 37 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 38 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 39 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 40 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 41 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 42 | POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 45 | 46 | 47 | Copyright © 2013 Apple Inc. All rights reserved. 48 | WWDC 2013 License 49 | 50 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2013 51 | Session. Please refer to the applicable WWDC 2013 Session for further 52 | information. 53 | 54 | IMPORTANT: This Apple software is supplied to you by Apple Inc. 55 | ("Apple") in consideration of your agreement to the following terms, and 56 | your use, installation, modification or redistribution of this Apple 57 | software constitutes acceptance of these terms. If you do not agree with 58 | these terms, please do not use, install, modify or redistribute this 59 | Apple software. 60 | 61 | In consideration of your agreement to abide by the following terms, and 62 | subject to these terms, Apple grants you a non-exclusive license, under 63 | Apple's copyrights in this original Apple software (the "Apple 64 | Software"), to use, reproduce, modify and redistribute the Apple 65 | Software, with or without modifications, in source and/or binary forms; 66 | provided that if you redistribute the Apple Software in its entirety and 67 | without modifications, you must retain this notice and the following 68 | text and disclaimers in all such redistributions of the Apple Software. 69 | Neither the name, trademarks, service marks or logos of Apple Inc. may 70 | be used to endorse or promote products derived from the Apple Software 71 | without specific prior written permission from Apple. Except as 72 | expressly stated in this notice, no other rights or licenses, express or 73 | implied, are granted by Apple herein, including but not limited to any 74 | patent rights that may be infringed by your derivative works or by other 75 | works in which the Apple Software may be incorporated. 76 | 77 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES 78 | NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE 79 | IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR 80 | A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 81 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 82 | 83 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 84 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 85 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 86 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 87 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 88 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 89 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 90 | POSSIBILITY OF SUCH DAMAGE. 91 | 92 | EA1002 93 | 5/3/2013 94 | */ 95 | 96 | #import "UIImage+ImageEffects.h" 97 | 98 | @import Accelerate; 99 | #import 100 | 101 | 102 | @implementation UIImage (ImageEffects) 103 | 104 | 105 | - (UIImage *)applyLightEffect 106 | { 107 | UIColor *tintColor = [UIColor colorWithWhite:1.0 alpha:0.3]; 108 | return [self applyBlurWithRadius:30 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; 109 | } 110 | 111 | 112 | - (UIImage *)applyExtraLightEffect 113 | { 114 | UIColor *tintColor = [UIColor colorWithWhite:0.97 alpha:0.82]; 115 | return [self applyBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; 116 | } 117 | 118 | 119 | - (UIImage *)applyDarkEffect 120 | { 121 | UIColor *tintColor = [UIColor colorWithWhite:0.11 alpha:0.73]; 122 | return [self applyBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; 123 | } 124 | 125 | 126 | - (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor 127 | { 128 | const CGFloat EffectColorAlpha = 0.6; 129 | UIColor *effectColor = tintColor; 130 | int componentCount = CGColorGetNumberOfComponents(tintColor.CGColor); 131 | if (componentCount == 2) { 132 | CGFloat b; 133 | if ([tintColor getWhite:&b alpha:NULL]) { 134 | effectColor = [UIColor colorWithWhite:b alpha:EffectColorAlpha]; 135 | } 136 | } 137 | else { 138 | CGFloat r, g, b; 139 | if ([tintColor getRed:&r green:&g blue:&b alpha:NULL]) { 140 | effectColor = [UIColor colorWithRed:r green:g blue:b alpha:EffectColorAlpha]; 141 | } 142 | } 143 | return [self applyBlurWithRadius:10 tintColor:effectColor saturationDeltaFactor:-1.0 maskImage:nil]; 144 | } 145 | 146 | 147 | - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage 148 | { 149 | // Check pre-conditions. 150 | if (self.size.width < 1 || self.size.height < 1) { 151 | NSLog (@"*** error: invalid size: (%.2f x %.2f). Both dimensions must be >= 1: %@", self.size.width, self.size.height, self); 152 | return nil; 153 | } 154 | if (!self.CGImage) { 155 | NSLog (@"*** error: image must be backed by a CGImage: %@", self); 156 | return nil; 157 | } 158 | if (maskImage && !maskImage.CGImage) { 159 | NSLog (@"*** error: maskImage must be backed by a CGImage: %@", maskImage); 160 | return nil; 161 | } 162 | 163 | CGRect imageRect = { CGPointZero, self.size }; 164 | UIImage *effectImage = self; 165 | 166 | BOOL hasBlur = blurRadius > __FLT_EPSILON__; 167 | BOOL hasSaturationChange = fabs(saturationDeltaFactor - 1.) > __FLT_EPSILON__; 168 | if (hasBlur || hasSaturationChange) { 169 | UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); 170 | CGContextRef effectInContext = UIGraphicsGetCurrentContext(); 171 | CGContextScaleCTM(effectInContext, 1.0, -1.0); 172 | CGContextTranslateCTM(effectInContext, 0, -self.size.height); 173 | CGContextDrawImage(effectInContext, imageRect, self.CGImage); 174 | 175 | vImage_Buffer effectInBuffer; 176 | effectInBuffer.data = CGBitmapContextGetData(effectInContext); 177 | effectInBuffer.width = CGBitmapContextGetWidth(effectInContext); 178 | effectInBuffer.height = CGBitmapContextGetHeight(effectInContext); 179 | effectInBuffer.rowBytes = CGBitmapContextGetBytesPerRow(effectInContext); 180 | 181 | UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); 182 | CGContextRef effectOutContext = UIGraphicsGetCurrentContext(); 183 | vImage_Buffer effectOutBuffer; 184 | effectOutBuffer.data = CGBitmapContextGetData(effectOutContext); 185 | effectOutBuffer.width = CGBitmapContextGetWidth(effectOutContext); 186 | effectOutBuffer.height = CGBitmapContextGetHeight(effectOutContext); 187 | effectOutBuffer.rowBytes = CGBitmapContextGetBytesPerRow(effectOutContext); 188 | 189 | if (hasBlur) { 190 | // A description of how to compute the box kernel width from the Gaussian 191 | // radius (aka standard deviation) appears in the SVG spec: 192 | // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement 193 | // 194 | // For larger values of 's' (s >= 2.0), an approximation can be used: Three 195 | // successive box-blurs build a piece-wise quadratic convolution kernel, which 196 | // approximates the Gaussian kernel to within roughly 3%. 197 | // 198 | // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5) 199 | // 200 | // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel. 201 | // 202 | CGFloat inputRadius = blurRadius * [[UIScreen mainScreen] scale]; 203 | NSUInteger radius = floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5); 204 | if (radius % 2 != 1) { 205 | radius += 1; // force radius to be odd so that the three box-blur methodology works. 206 | } 207 | vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, NULL, 0, 0, radius, radius, 0, kvImageEdgeExtend); 208 | vImageBoxConvolve_ARGB8888(&effectOutBuffer, &effectInBuffer, NULL, 0, 0, radius, radius, 0, kvImageEdgeExtend); 209 | vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, NULL, 0, 0, radius, radius, 0, kvImageEdgeExtend); 210 | } 211 | BOOL effectImageBuffersAreSwapped = NO; 212 | if (hasSaturationChange) { 213 | CGFloat s = saturationDeltaFactor; 214 | CGFloat floatingPointSaturationMatrix[] = { 215 | 0.0722 + 0.9278 * s, 0.0722 - 0.0722 * s, 0.0722 - 0.0722 * s, 0, 216 | 0.7152 - 0.7152 * s, 0.7152 + 0.2848 * s, 0.7152 - 0.7152 * s, 0, 217 | 0.2126 - 0.2126 * s, 0.2126 - 0.2126 * s, 0.2126 + 0.7873 * s, 0, 218 | 0, 0, 0, 1, 219 | }; 220 | const int32_t divisor = 256; 221 | NSUInteger matrixSize = sizeof(floatingPointSaturationMatrix)/sizeof(floatingPointSaturationMatrix[0]); 222 | int16_t saturationMatrix[matrixSize]; 223 | for (NSUInteger i = 0; i < matrixSize; ++i) { 224 | saturationMatrix[i] = (int16_t)roundf(floatingPointSaturationMatrix[i] * divisor); 225 | } 226 | if (hasBlur) { 227 | vImageMatrixMultiply_ARGB8888(&effectOutBuffer, &effectInBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags); 228 | effectImageBuffersAreSwapped = YES; 229 | } 230 | else { 231 | vImageMatrixMultiply_ARGB8888(&effectInBuffer, &effectOutBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags); 232 | } 233 | } 234 | if (!effectImageBuffersAreSwapped) 235 | effectImage = UIGraphicsGetImageFromCurrentImageContext(); 236 | UIGraphicsEndImageContext(); 237 | 238 | if (effectImageBuffersAreSwapped) 239 | effectImage = UIGraphicsGetImageFromCurrentImageContext(); 240 | UIGraphicsEndImageContext(); 241 | } 242 | 243 | // Set up output context. 244 | UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); 245 | CGContextRef outputContext = UIGraphicsGetCurrentContext(); 246 | CGContextScaleCTM(outputContext, 1.0, -1.0); 247 | CGContextTranslateCTM(outputContext, 0, -self.size.height); 248 | 249 | // Draw base image. 250 | CGContextDrawImage(outputContext, imageRect, self.CGImage); 251 | 252 | // Draw effect image. 253 | if (hasBlur) { 254 | CGContextSaveGState(outputContext); 255 | if (maskImage) { 256 | CGContextClipToMask(outputContext, imageRect, maskImage.CGImage); 257 | } 258 | CGContextDrawImage(outputContext, imageRect, effectImage.CGImage); 259 | CGContextRestoreGState(outputContext); 260 | } 261 | 262 | // Add in color tint. 263 | if (tintColor) { 264 | CGContextSaveGState(outputContext); 265 | CGContextSetFillColorWithColor(outputContext, tintColor.CGColor); 266 | CGContextFillRect(outputContext, imageRect); 267 | CGContextRestoreGState(outputContext); 268 | } 269 | 270 | // Output image is ready. 271 | UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext(); 272 | UIGraphicsEndImageContext(); 273 | 274 | return outputImage; 275 | } 276 | 277 | 278 | @end 279 | --------------------------------------------------------------------------------