1
0

IDynamicTextureManager.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System.IO;
  28. using OpenMetaverse;
  29. namespace OpenSim.Region.Framework.Interfaces
  30. {
  31. public interface IDynamicTextureManager
  32. {
  33. void RegisterRender(string handleType, IDynamicTextureRender render);
  34. void ReturnData(UUID id, byte[] data);
  35. UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams,
  36. int updateTimer);
  37. UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams,
  38. int updateTimer, bool SetBlending, byte AlphaValue);
  39. UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams,
  40. int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face);
  41. UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
  42. int updateTimer);
  43. /// Apply a dynamically generated texture to all sides of the given prim. The texture is not persisted to the
  44. /// asset service.
  45. /// </summary>
  46. /// <param name="simID">The simulator in which the texture is being generated</param>
  47. /// <param name="primID">The prim to which to apply the texture.</param>
  48. /// <param name="contentType">The content type to create. Current choices are "vector" to create a vector
  49. /// based texture or "image" to create a texture from an image at a particular URL</param>
  50. /// <param name="data">The data for the generator</param>
  51. /// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param>
  52. /// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive
  53. /// the image is updated at the given interval. Not implemented for </param>
  54. /// <param name="SetBlending">
  55. /// If true, the newly generated texture is blended with the appropriate existing ones on the prim
  56. /// </param>
  57. /// <param name="AlphaValue">
  58. /// The alpha value of the generated texture.
  59. /// </param>
  60. /// <returns>
  61. /// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
  62. /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
  63. /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
  64. /// </returns>
  65. UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
  66. int updateTimer, bool SetBlending, byte AlphaValue);
  67. /// <summary>
  68. /// Apply a dynamically generated texture to the given prim.
  69. /// </summary>
  70. /// <param name="simID">The simulator in which the texture is being generated</param>
  71. /// <param name="primID">The prim to which to apply the texture.</param>
  72. /// <param name="contentType">The content type to create. Current choices are "vector" to create a vector
  73. /// based texture or "image" to create a texture from an image at a particular URL</param>
  74. /// <param name="data">The data for the generator</param>
  75. /// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param>
  76. /// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive
  77. /// the image is updated at the given interval. Not implemented for </param>
  78. /// <param name="SetBlending">
  79. /// If true, the newly generated texture is blended with the appropriate existing ones on the prim
  80. /// </param>
  81. /// <param name="disp">
  82. /// Display flags. If DISP_EXPIRE then the old texture is deleted if it is replaced by a
  83. /// newer generated texture (may not currently be implemented). If DISP_TEMP then the asset is flagged as
  84. /// temporary, which often means that it is not persisted to the database.
  85. /// </param>
  86. /// <param name="AlphaValue">
  87. /// The alpha value of the generated texture.
  88. /// </param>
  89. /// <param name="face">
  90. /// The face of the prim on which to put the generated texture. If ALL_SIDES then all sides of the prim are
  91. /// set
  92. /// </param>
  93. /// <returns>
  94. /// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
  95. /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
  96. /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
  97. /// </returns>
  98. UUID AddDynamicTextureData(
  99. UUID simID, UUID primID, string contentType, string data, string extraParams,
  100. int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face);
  101. void GetDrawStringSize(string contentType, string text, string fontName, int fontSize,
  102. out double xSize, out double ySize);
  103. }
  104. public interface IDynamicTextureRender
  105. {
  106. string GetName();
  107. string GetContentType();
  108. bool SupportsAsynchronous();
  109. byte[] ConvertUrl(string url, string extraParams);
  110. byte[] ConvertStream(Stream data, string extraParams);
  111. bool AsyncConvertUrl(UUID id, string url, string extraParams);
  112. bool AsyncConvertData(UUID id, string bodyData, string extraParams);
  113. void GetDrawStringSize(string text, string fontName, int fontSize,
  114. out double xSize, out double ySize);
  115. }
  116. }