SDImageGraphics.h 1.5 KB

12345678910111213141516171819202122232425262728
  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 "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. @note If you don't care bitmap format (ARGB8888) and just draw image, use `SDGraphicsImageRenderer` instead. It's more performant on RAM usage.`
  15. */
  16. /// Returns the current graphics context.
  17. FOUNDATION_EXPORT CGContextRef __nullable SDGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED;
  18. /// Creates a bitmap-based graphics context and makes it the current context.
  19. FOUNDATION_EXPORT void SDGraphicsBeginImageContext(CGSize size);
  20. /// Creates a bitmap-based graphics context with the specified options.
  21. FOUNDATION_EXPORT void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale);
  22. /// Removes the current bitmap-based graphics context from the top of the stack.
  23. FOUNDATION_EXPORT void SDGraphicsEndImageContext(void);
  24. /// Returns an image based on the contents of the current bitmap-based graphics context.
  25. FOUNDATION_EXPORT UIImage * __nullable SDGraphicsGetImageFromCurrentImageContext(void);