AdHostImageAppServices.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. //
  2. //
  3. //////////////////////////////////////////////////////////////////////////////
  4. //
  5. // Copyright 2015 Autodesk, Inc. All rights reserved.
  6. //
  7. // Use of this software is subject to the terms of the Autodesk license
  8. // agreement provided at the time of installation or download, or which
  9. // otherwise accompanies this software in either electronic or hard copy form.
  10. //
  11. //////////////////////////////////////////////////////////////////////////////
  12. #pragma once
  13. #include "AdAChar.h"
  14. // Forward class declarations
  15. namespace Atil {
  16. class ImageFormatCodec;
  17. class ProgressCallbackInterface;
  18. };
  19. class AdHostImageAppServices;
  20. ////////////////////////////////////////////////////////////////////////
  21. // class AdHostImageAppServices
  22. ////////////////////////////////////////////////////////////////////////
  23. /// <summary>
  24. /// This class defines an interface to publish the
  25. /// initialization/un-initialization of format codecs with the imaging
  26. /// library that an application (like AutoCAD) might be internally using.
  27. /// </summary>
  28. ///
  29. /// <remarks>
  30. /// Applications (like AutoCAD) which are clients of some imaging library
  31. /// themselves can provide implementation for this interface. It is preferred
  32. /// to have a singleton object implementing this interface for the entire
  33. /// application session. Using this interface, applications can mask the
  34. /// internals of how it initializes the imaging library it uses.
  35. /// </remarks>
  36. ///
  37. class __declspec(novtable) AdHostImageAppServices
  38. {
  39. public:
  40. ///
  41. /// <summary>
  42. /// Use this function to get the list of image file extensions
  43. /// supported by the currently in use imaging library.
  44. /// </summary>
  45. ///
  46. /// <param name="bRefresh">
  47. /// If set to true would re-populate the list of format file
  48. /// extensions that the underlying imaging library supports.
  49. /// Callers to this function would usually set bRefresh parameter to
  50. /// true after registering a new format codec with the imaging library.
  51. /// </param>
  52. ///
  53. /// <returns>
  54. /// Returns a pointer to a array of character which has semicolon
  55. /// separated extension strings.
  56. /// Format of the returned string will be as follows:
  57. /// "bmp;dib;rle;tif;tiff;cal;mil;rst;cg4;gp4;cals;gif"
  58. /// </returns>
  59. ///
  60. virtual const ACHAR* imageFileExtensions (bool bRefresh = false) = 0;
  61. ///
  62. /// <summary>
  63. /// Use this function to get the filtered list of image
  64. /// file descriptions and extensions supported by the currently
  65. /// in use imaging library.
  66. /// </summary>
  67. ///
  68. /// <param name="bRefresh">
  69. /// If set to true would re-populate the filter strings
  70. /// supported by the underlying imaging library.
  71. /// Callers to this function would usually set bRefresh parameter to
  72. /// true after registering a new format codec with the imaging library.
  73. /// </param>
  74. ///
  75. /// <returns>
  76. /// Returns a pointer to a array of character which has semicolon
  77. /// separated format specific filtered strings.
  78. /// Format of the returned string will be as follows:
  79. /// "Windows Bitmap:bmp,dib,rle;Tagged Image File Format:tif,tiff;
  80. /// CALS MIL-R-28002A Type I Reader:cal,mil,rst,cg4,gp4,cals;
  81. /// Image Systems CCITT Group 4 compression:ig4;Macintosh PICT:pct,pict;RLC:rlc;
  82. /// TrueVision Targa Bitmap:tga;
  83. /// Portable Network Graphics file (PNG):png;
  84. /// JFIF(JPEG) 6.0:jpg;ZSoft Paint:pcx;
  85. /// Autodesk Animator FLI/FLC File:fli,flc;Graphic Interchange format:gif"
  86. /// </returns>
  87. ///
  88. virtual const ACHAR* imageFilterString (bool bRefresh = false) = 0;
  89. ///
  90. /// <summary>
  91. /// Registers the supplied format codec with the imaging library.
  92. /// </summary>
  93. ///
  94. /// <param name="pCodec">
  95. /// A pointer to an object that implements Atil::ImageFormatCodec
  96. /// interface.
  97. /// </param>
  98. ///
  99. /// <returns>
  100. /// Returns true if the registration succeeded.
  101. /// </returns>
  102. ///
  103. virtual bool registerFormatCodec (Atil::ImageFormatCodec& codec) = 0;
  104. ///
  105. /// <summary>
  106. /// Use this method to find out if a format codec is already registered
  107. /// with the imaging library.
  108. /// </summary>
  109. ///
  110. /// <param name="pCodec">
  111. /// A pointer to an object that implements Atil::ImageFormatCodec
  112. /// interface.
  113. /// </param>
  114. ///
  115. /// <returns>
  116. /// Returns true if the input format codec is already registered
  117. /// with the imaging library.
  118. /// </returns>
  119. ///
  120. virtual bool formatCodecRegistered (Atil::ImageFormatCodec& codec) = 0;
  121. ///
  122. /// <summary>
  123. /// Re-registers the input format codec with the imaging library.
  124. /// </summary>
  125. ///
  126. /// <param name="pCodec">
  127. /// A pointer to an object that implements Atil::ImageFormatCodec
  128. /// interface.
  129. /// </param>
  130. ///
  131. /// <returns>
  132. /// Returns true if the reregistration process succeeded.
  133. /// </returns>
  134. ///
  135. virtual bool reRegisterFormatCodec (Atil::ImageFormatCodec& codec) = 0;
  136. ///
  137. /// <summary>
  138. /// Unregisters the input format codec with the imaging library.
  139. /// </summary>
  140. ///
  141. /// <param name="pCodec">
  142. /// A pointer to an object that implements Atil::ImageFormatCodec
  143. /// interface.
  144. /// </param>
  145. ///
  146. /// <returns>
  147. /// Returns true if the un-registration process succeeded.
  148. /// </returns>
  149. ///
  150. virtual bool unRegisterFormatCodec (Atil::ImageFormatCodec& codec) = 0;
  151. ///
  152. /// <summary>
  153. /// Registers a progress call back with the imaging library.
  154. /// </summary>
  155. ///
  156. /// <param name="pCallback">
  157. /// A pointer to an object that implements Atil::ProgressCallbackInterface
  158. /// interface.
  159. /// </param>
  160. ///
  161. /// <returns>
  162. /// Returns the pointer to the old Atil::ProgressCallbackInterface object.
  163. /// </returns>
  164. ///
  165. virtual Atil::ProgressCallbackInterface* registerProgressCallback (Atil::ProgressCallbackInterface* pCallback ) = 0;
  166. };
  167. ///
  168. /// <summary>
  169. /// Gives access to the global object that implements the
  170. /// AdHostImageAppServices interface.
  171. /// </summary>
  172. ///
  173. /// <returns>
  174. /// If succeeded, returns a pointer to the AdHostImageAppServices interface.
  175. /// Returns NULL if failed.
  176. /// </returns>
  177. ///
  178. AdHostImageAppServices* getAdHostImageAppServices();