IImageEnhancer.cs 2.4 KB

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