BU_SDImageGraphics.h 1.4 KB

123456789101112131415161718192021222324252627
  1. /*
  2. * This file is part of the SDWebImage package.
  3. * (c) Olivier Poitrey <rs@dailymotion.com>
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. */
  8. #import "BU_SDWebImageCompat.h"
  9. #import <CoreGraphics/CoreGraphics.h>
  10. /**
  11. These following graphics context method are provided to easily write cross-platform(AppKit/UIKit) code.
  12. For UIKit, these methods just call the same method in `UIGraphics.h`. See the documentation for usage.
  13. For AppKit, these methods use `NSGraphicsContext` to create image context and match the behavior like UIKit.
  14. */
  15. /// Returns the current graphics context.
  16. FOUNDATION_EXPORT CGContextRef __nullable BU_SDGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED;
  17. /// Creates a bitmap-based graphics context and makes it the current context.
  18. FOUNDATION_EXPORT void BU_SDGraphicsBeginImageContext(CGSize size);
  19. /// Creates a bitmap-based graphics context with the specified options.
  20. FOUNDATION_EXPORT void BU_BU_SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale);
  21. /// Removes the current bitmap-based graphics context from the top of the stack.
  22. FOUNDATION_EXPORT void BU_SDGraphicsEndImageContext(void);
  23. /// Returns an image based on the contents of the current bitmap-based graphics context.
  24. FOUNDATION_EXPORT UIImage * __nullable BU_SDGraphicsGetImageFromCurrentImageContext(void);