2
0

IImageEnhancer.cs 2.6 KB

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