You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
5.4 KiB

5 years ago
  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 youll want to look out to find out how to use vImage to efficiently calculate a blur.
  4. Version: 1.0
  5. Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
  6. Inc. ("Apple") in consideration of your agreement to the following
  7. terms, and your use, installation, modification or redistribution of
  8. this Apple software constitutes acceptance of these terms. If you do
  9. not agree with these terms, please do not use, install, modify or
  10. redistribute this Apple software.
  11. In consideration of your agreement to abide by the following terms, and
  12. subject to these terms, Apple grants you a personal, non-exclusive
  13. license, under Apple's copyrights in this original Apple software (the
  14. "Apple Software"), to use, reproduce, modify and redistribute the Apple
  15. Software, with or without modifications, in source and/or binary forms;
  16. provided that if you redistribute the Apple Software in its entirety and
  17. without modifications, you must retain this notice and the following
  18. text and disclaimers in all such redistributions of the Apple Software.
  19. Neither the name, trademarks, service marks or logos of Apple Inc. may
  20. be used to endorse or promote products derived from the Apple Software
  21. without specific prior written permission from Apple. Except as
  22. expressly stated in this notice, no other rights or licenses, express or
  23. implied, are granted by Apple herein, including but not limited to any
  24. patent rights that may be infringed by your derivative works or by other
  25. works in which the Apple Software may be incorporated.
  26. The Apple Software is provided by Apple on an "AS IS" basis. APPLE
  27. MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
  28. THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
  29. FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
  30. OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
  31. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
  32. OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  33. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  34. INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
  35. MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
  36. AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
  37. STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
  38. POSSIBILITY OF SUCH DAMAGE.
  39. Copyright (C) 2013 Apple Inc. All Rights Reserved.
  40. Copyright © 2013 Apple Inc. All rights reserved.
  41. WWDC 2013 License
  42. NOTE: This Apple Software was supplied by Apple as part of a WWDC 2013
  43. Session. Please refer to the applicable WWDC 2013 Session for further
  44. information.
  45. IMPORTANT: This Apple software is supplied to you by Apple Inc.
  46. ("Apple") in consideration of your agreement to the following terms, and
  47. your use, installation, modification or redistribution of this Apple
  48. software constitutes acceptance of these terms. If you do not agree with
  49. these terms, please do not use, install, modify or redistribute this
  50. Apple software.
  51. In consideration of your agreement to abide by the following terms, and
  52. subject to these terms, Apple grants you a non-exclusive license, under
  53. Apple's copyrights in this original Apple software (the "Apple
  54. Software"), to use, reproduce, modify and redistribute the Apple
  55. Software, with or without modifications, in source and/or binary forms;
  56. provided that if you redistribute the Apple Software in its entirety and
  57. without modifications, you must retain this notice and the following
  58. text and disclaimers in all such redistributions of the Apple Software.
  59. Neither the name, trademarks, service marks or logos of Apple Inc. may
  60. be used to endorse or promote products derived from the Apple Software
  61. without specific prior written permission from Apple. Except as
  62. expressly stated in this notice, no other rights or licenses, express or
  63. implied, are granted by Apple herein, including but not limited to any
  64. patent rights that may be infringed by your derivative works or by other
  65. works in which the Apple Software may be incorporated.
  66. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES
  67. NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
  68. IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR
  69. A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
  70. OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
  71. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
  72. OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  73. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  74. INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
  75. MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
  76. AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
  77. STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
  78. POSSIBILITY OF SUCH DAMAGE.
  79. EA1002
  80. 5/3/2013
  81. */
  82. @import UIKit;
  83. @interface UIImage (ImageEffects)
  84. - (UIImage *)applyLightEffect;
  85. - (UIImage *)applyExtraLightEffect;
  86. - (UIImage *)applyDarkEffect;
  87. - (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor;
  88. - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage;
  89. @end