IImageProcessor.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Controller.Providers;
  4. using MediaBrowser.Model.Drawing;
  5. using MediaBrowser.Model.Entities;
  6. using System.Collections.Generic;
  7. using System.IO;
  8. using System.Threading.Tasks;
  9. namespace MediaBrowser.Controller.Drawing
  10. {
  11. /// <summary>
  12. /// Interface IImageProcessor
  13. /// </summary>
  14. public interface IImageProcessor
  15. {
  16. /// <summary>
  17. /// Gets the supported input formats.
  18. /// </summary>
  19. /// <value>The supported input formats.</value>
  20. string[] SupportedInputFormats { get; }
  21. /// <summary>
  22. /// Gets the image enhancers.
  23. /// </summary>
  24. /// <value>The image enhancers.</value>
  25. IImageEnhancer[] ImageEnhancers { get; }
  26. /// <summary>
  27. /// Gets the size of the image.
  28. /// </summary>
  29. /// <param name="info">The information.</param>
  30. /// <returns>ImageSize.</returns>
  31. ImageSize GetImageSize(ItemImageInfo info);
  32. ImageSize GetImageSize(ItemImageInfo info, bool allowSlowMethods);
  33. /// <summary>
  34. /// Gets the size of the image.
  35. /// </summary>
  36. /// <param name="path">The path.</param>
  37. /// <returns>ImageSize.</returns>
  38. ImageSize GetImageSize(string path);
  39. /// <summary>
  40. /// Adds the parts.
  41. /// </summary>
  42. /// <param name="enhancers">The enhancers.</param>
  43. void AddParts(IEnumerable<IImageEnhancer> enhancers);
  44. /// <summary>
  45. /// Gets the supported enhancers.
  46. /// </summary>
  47. /// <param name="item">The item.</param>
  48. /// <param name="imageType">Type of the image.</param>
  49. /// <returns>IEnumerable{IImageEnhancer}.</returns>
  50. List<IImageEnhancer> GetSupportedEnhancers(IHasMetadata item, ImageType imageType);
  51. /// <summary>
  52. /// Gets the image cache tag.
  53. /// </summary>
  54. /// <param name="item">The item.</param>
  55. /// <param name="image">The image.</param>
  56. /// <returns>Guid.</returns>
  57. string GetImageCacheTag(IHasMetadata item, ItemImageInfo image);
  58. /// <summary>
  59. /// Gets the image cache tag.
  60. /// </summary>
  61. /// <param name="item">The item.</param>
  62. /// <param name="image">The image.</param>
  63. /// <param name="imageEnhancers">The image enhancers.</param>
  64. /// <returns>Guid.</returns>
  65. string GetImageCacheTag(IHasMetadata item, ItemImageInfo image, List<IImageEnhancer> imageEnhancers);
  66. /// <summary>
  67. /// Processes the image.
  68. /// </summary>
  69. /// <param name="options">The options.</param>
  70. /// <param name="toStream">To stream.</param>
  71. /// <returns>Task.</returns>
  72. Task ProcessImage(ImageProcessingOptions options, Stream toStream);
  73. /// <summary>
  74. /// Processes the image.
  75. /// </summary>
  76. /// <param name="options">The options.</param>
  77. /// <returns>Task.</returns>
  78. Task<Tuple<string, string, DateTime>> ProcessImage(ImageProcessingOptions options);
  79. /// <summary>
  80. /// Gets the enhanced image.
  81. /// </summary>
  82. /// <param name="item">The item.</param>
  83. /// <param name="imageType">Type of the image.</param>
  84. /// <param name="imageIndex">Index of the image.</param>
  85. /// <returns>Task{System.String}.</returns>
  86. Task<string> GetEnhancedImage(IHasMetadata item, ImageType imageType, int imageIndex);
  87. /// <summary>
  88. /// Gets the supported image output formats.
  89. /// </summary>
  90. /// <returns>ImageOutputFormat[].</returns>
  91. ImageFormat[] GetSupportedImageOutputFormats();
  92. /// <summary>
  93. /// Creates the image collage.
  94. /// </summary>
  95. /// <param name="options">The options.</param>
  96. void CreateImageCollage(ImageCollageOptions options);
  97. /// <summary>
  98. /// Gets a value indicating whether [supports image collage creation].
  99. /// </summary>
  100. /// <value><c>true</c> if [supports image collage creation]; otherwise, <c>false</c>.</value>
  101. bool SupportsImageCollageCreation { get; }
  102. IImageEncoder ImageEncoder { get; set; }
  103. bool SupportsTransparency(string path);
  104. }
  105. }