UIImage+MultiFormat.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 "NSData+ImageContentType.h"
  10. @interface UIImage (MultiFormat)
  11. /**
  12. * UIKit:
  13. * For static image format, this value is always 0.
  14. * For animated image format, 0 means infinite looping.
  15. * @note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.
  16. * AppKit:
  17. * NSImage currently only support animated via GIF imageRep unlike UIImage.
  18. * The getter of this property will get the loop count from GIF imageRep
  19. * The setter of this property will set the loop count from GIF imageRep
  20. */
  21. @property (nonatomic, assign) NSUInteger sd_imageLoopCount;
  22. /**
  23. * The image format represent the original compressed image data format.
  24. * If you don't manually specify a format, this information is retrieve from CGImage using `CGImageGetUTType`, which may return nil for non-CG based image. At this time it will return `SDImageFormatUndefined` as default value.
  25. * @note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.
  26. */
  27. @property (nonatomic, assign) SDImageFormat sd_imageFormat;
  28. + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data;
  29. - (nullable NSData *)sd_imageData;
  30. - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat;
  31. @end