IImageEnhancer.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using MediaBrowser.Controller.Drawing;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Model.Drawing;
  4. using MediaBrowser.Model.Entities;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Controller.Providers
  7. {
  8. public interface IImageEnhancer
  9. {
  10. /// <summary>
  11. /// Return true only if the given image for the given item will be enhanced by this enhancer.
  12. /// </summary>
  13. /// <param name="item">The item.</param>
  14. /// <param name="imageType">Type of the image.</param>
  15. /// <returns><c>true</c> if this enhancer will enhance the supplied image for the supplied item, <c>false</c> otherwise</returns>
  16. bool Supports(IHasImages item, ImageType imageType);
  17. /// <summary>
  18. /// Gets the priority or order in which this enhancer should be run.
  19. /// </summary>
  20. /// <value>The priority.</value>
  21. MetadataProviderPriority Priority { get; }
  22. /// <summary>
  23. /// Return a key incorporating all configuration information related to this item
  24. /// </summary>
  25. /// <param name="item">The item.</param>
  26. /// <param name="imageType">Type of the image.</param>
  27. /// <returns>Cache key relating to the current state of this item and configuration</returns>
  28. string GetConfigurationCacheKey(IHasImages item, ImageType imageType);
  29. /// <summary>
  30. /// Gets the size of the enhanced image.
  31. /// </summary>
  32. /// <param name="item">The item.</param>
  33. /// <param name="imageType">Type of the image.</param>
  34. /// <param name="imageIndex">Index of the image.</param>
  35. /// <param name="originalImageSize">Size of the original image.</param>
  36. /// <returns>ImageSize.</returns>
  37. ImageSize GetEnhancedImageSize(IHasImages item, ImageType imageType, int imageIndex, ImageSize originalImageSize);
  38. /// <summary>
  39. /// Enhances the image async.
  40. /// </summary>
  41. /// <param name="item">The item.</param>
  42. /// <param name="originalImage">The original image.</param>
  43. /// <param name="imageType">Type of the image.</param>
  44. /// <param name="imageIndex">Index of the image.</param>
  45. /// <returns>Task{Image}.</returns>
  46. /// <exception cref="System.ArgumentNullException"></exception>
  47. Task<ImageStream> EnhanceImageAsync(IHasImages item, ImageStream originalImage, ImageType imageType, int imageIndex);
  48. }
  49. }