IImageProcessor.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Threading.Tasks;
  5. using MediaBrowser.Controller.Entities;
  6. using MediaBrowser.Model.Drawing;
  7. using MediaBrowser.Model.Entities;
  8. namespace MediaBrowser.Controller.Drawing
  9. {
  10. /// <summary>
  11. /// Interface IImageProcessor
  12. /// </summary>
  13. public interface IImageProcessor
  14. {
  15. /// <summary>
  16. /// Gets the supported input formats.
  17. /// </summary>
  18. /// <value>The supported input formats.</value>
  19. IReadOnlyCollection<string> SupportedInputFormats { get; }
  20. /// <summary>
  21. /// Gets a value indicating whether [supports image collage creation].
  22. /// </summary>
  23. /// <value><c>true</c> if [supports image collage creation]; otherwise, <c>false</c>.</value>
  24. bool SupportsImageCollageCreation { get; }
  25. /// <summary>
  26. /// Gets the dimensions of the image.
  27. /// </summary>
  28. /// <param name="path">Path to the image file.</param>
  29. /// <returns>ImageDimensions</returns>
  30. ImageDimensions GetImageDimensions(string path);
  31. /// <summary>
  32. /// Gets the dimensions of the image.
  33. /// </summary>
  34. /// <param name="item">The base item.</param>
  35. /// <param name="info">The information.</param>
  36. /// <returns>ImageDimensions</returns>
  37. ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info);
  38. /// <summary>
  39. /// Gets the dimensions of the image.
  40. /// </summary>
  41. /// <param name="item">The base item.</param>
  42. /// <param name="info">The information.</param>
  43. /// <param name="updateItem">Whether or not the item info should be updated.</param>
  44. /// <returns>ImageDimensions</returns>
  45. ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info, bool updateItem);
  46. /// <summary>
  47. /// Gets the image cache tag.
  48. /// </summary>
  49. /// <param name="item">The item.</param>
  50. /// <param name="image">The image.</param>
  51. /// <returns>Guid.</returns>
  52. string GetImageCacheTag(BaseItem item, ItemImageInfo image);
  53. string GetImageCacheTag(BaseItem item, ChapterInfo info);
  54. /// <summary>
  55. /// Processes the image.
  56. /// </summary>
  57. /// <param name="options">The options.</param>
  58. /// <param name="toStream">To stream.</param>
  59. /// <returns>Task.</returns>
  60. Task ProcessImage(ImageProcessingOptions options, Stream toStream);
  61. /// <summary>
  62. /// Processes the image.
  63. /// </summary>
  64. /// <param name="options">The options.</param>
  65. /// <returns>Task.</returns>
  66. Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options);
  67. /// <summary>
  68. /// Gets the supported image output formats.
  69. /// </summary>
  70. /// <returns><see cref="IReadOnlyCollection{ImageOutput}" />.</returns>
  71. IReadOnlyCollection<ImageFormat> GetSupportedImageOutputFormats();
  72. /// <summary>
  73. /// Creates the image collage.
  74. /// </summary>
  75. /// <param name="options">The options.</param>
  76. void CreateImageCollage(ImageCollageOptions options);
  77. bool SupportsTransparency(string path);
  78. }
  79. }