UIImage+ForceDecode.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. /**
  10. UIImage category about force decode feature (avoid Image/IO's lazy decoding during rendering behavior).
  11. */
  12. @interface UIImage (ForceDecode)
  13. /**
  14. A bool value indicating whether the image has already been decoded. This can help to avoid extra force decode.
  15. */
  16. @property (nonatomic, assign) BOOL sd_isDecoded;
  17. /**
  18. Decode the provided image. This is useful if you want to force decode the image before rendering to improve performance.
  19. @param image The image to be decoded
  20. @return The decoded image
  21. */
  22. + (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image;
  23. /**
  24. Decode and scale down the provided image
  25. @param image The image to be decoded
  26. @return The decoded and scaled down image
  27. */
  28. + (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image;
  29. /**
  30. Decode and scale down the provided image with limit bytes
  31. @param image The image to be decoded
  32. @param bytes The limit bytes size. Provide 0 to use the build-in limit.
  33. @return The decoded and scaled down image
  34. */
  35. + (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes;
  36. @end