SDImageAPNGCoder.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 "SDImageAPNGCoder.h"
  9. #import "SDImageIOAnimatedCoderInternal.h"
  10. #if SD_MAC
  11. #import <CoreServices/CoreServices.h>
  12. #else
  13. #import <MobileCoreServices/MobileCoreServices.h>
  14. #endif
  15. @implementation SDImageAPNGCoder
  16. + (instancetype)sharedCoder {
  17. static SDImageAPNGCoder *coder;
  18. static dispatch_once_t onceToken;
  19. dispatch_once(&onceToken, ^{
  20. coder = [[SDImageAPNGCoder alloc] init];
  21. });
  22. return coder;
  23. }
  24. #pragma mark - Subclass Override
  25. + (SDImageFormat)imageFormat {
  26. return SDImageFormatPNG;
  27. }
  28. + (NSString *)imageUTType {
  29. return (__bridge NSString *)kSDUTTypePNG;
  30. }
  31. + (NSString *)dictionaryProperty {
  32. return (__bridge NSString *)kCGImagePropertyPNGDictionary;
  33. }
  34. + (NSString *)unclampedDelayTimeProperty {
  35. return (__bridge NSString *)kCGImagePropertyAPNGUnclampedDelayTime;
  36. }
  37. + (NSString *)delayTimeProperty {
  38. return (__bridge NSString *)kCGImagePropertyAPNGDelayTime;
  39. }
  40. + (NSString *)loopCountProperty {
  41. return (__bridge NSString *)kCGImagePropertyAPNGLoopCount;
  42. }
  43. + (NSUInteger)defaultLoopCount {
  44. return 0;
  45. }
  46. @end