ImageCodecInfo.jvm.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. //
  2. // System.Drawing.Imaging.ImageCodecInfo.cs
  3. //
  4. // Authors:
  5. // Everaldo Canuto ([email protected])
  6. // Andreas Nahr ([email protected])
  7. // Dennis Hayes ([email protected])
  8. // Andreas Nahr ([email protected])
  9. // Dennis Hayes ([email protected])
  10. // Jordi Mas i Hernandez ([email protected])
  11. //
  12. // (C) 2002 Ximian, Inc. http://www.ximian.com
  13. //
  14. //
  15. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  16. //
  17. // Permission is hereby granted, free of charge, to any person obtaining
  18. // a copy of this software and associated documentation files (the
  19. // "Software"), to deal in the Software without restriction, including
  20. // without limitation the rights to use, copy, modify, merge, publish,
  21. // distribute, sublicense, and/or sell copies of the Software, and to
  22. // permit persons to whom the Software is furnished to do so, subject to
  23. // the following conditions:
  24. //
  25. // The above copyright notice and this permission notice shall be
  26. // included in all copies or substantial portions of the Software.
  27. //
  28. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  29. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  30. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  31. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  32. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  33. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  34. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  35. //
  36. using System;
  37. using System.Runtime.InteropServices;
  38. using System.Collections;
  39. using System.Collections.Specialized;
  40. using System.Configuration;
  41. using System.IO;
  42. using Mainsoft.Drawing.Imaging;
  43. using imageio = javax.imageio;
  44. using spi = javax.imageio.spi;
  45. namespace System.Drawing.Imaging {
  46. [ComVisible (false)]
  47. public sealed class ImageCodecInfo
  48. {
  49. private Guid clsid;
  50. private string codecName;
  51. private string dllName;
  52. private string filenameExtension;
  53. private ImageCodecFlags flags;
  54. private string formatDescription;
  55. private Guid formatID;
  56. private string mimeType;
  57. private byte[][] signatureMasks;
  58. private byte[][] signaturePatterns;
  59. private int version;
  60. public static ImageCodecInfo[] GetImageDecoders ()
  61. {
  62. Hashtable oldInfo = ImageCodec.Decoders;
  63. ImageCodecInfo [] newInfo = new ImageCodecInfo [oldInfo.Count];
  64. int i=0;
  65. foreach (ImageCodecInfo codec in oldInfo.Values) {
  66. //newInfo [i++] = (ImageCodecInfo) codec.MemberwiseClone ();
  67. newInfo [i] = new ImageCodecInfo ();
  68. newInfo [i].clsid = codec.clsid;
  69. newInfo [i].formatID = codec.formatID;
  70. newInfo [i].codecName = codec.codecName;
  71. newInfo [i].dllName = codec.dllName;
  72. newInfo [i].flags = codec.flags;
  73. newInfo [i].filenameExtension = codec.filenameExtension;
  74. newInfo [i].formatDescription = codec.formatDescription;
  75. newInfo [i].mimeType = codec.mimeType;
  76. newInfo [i].signatureMasks = codec.signatureMasks;
  77. newInfo [i].signaturePatterns = codec.signaturePatterns;
  78. newInfo [i++].version = codec.version;
  79. }
  80. return newInfo;
  81. }
  82. internal ImageCodecInfo () {
  83. }
  84. public static ImageCodecInfo[] GetImageEncoders ()
  85. {
  86. Hashtable oldInfo = ImageCodec.Encoders;
  87. ImageCodecInfo [] newInfo = new ImageCodecInfo [oldInfo.Count];
  88. int i=0;
  89. foreach (ImageCodecInfo codec in oldInfo.Values) {
  90. //newInfo [i++] = (ImageCodecInfo) codec.MemberwiseClone ();
  91. newInfo [i] = new ImageCodecInfo ();
  92. newInfo [i].clsid = codec.clsid;
  93. newInfo [i].formatID = codec.formatID;
  94. newInfo [i].codecName = codec.codecName;
  95. newInfo [i].dllName = codec.dllName;
  96. newInfo [i].flags = codec.flags;
  97. newInfo [i].filenameExtension = codec.filenameExtension;
  98. newInfo [i].formatDescription = codec.formatDescription;
  99. newInfo [i].mimeType = codec.mimeType;
  100. newInfo [i].signatureMasks = codec.signatureMasks;
  101. newInfo [i].signaturePatterns = codec.signaturePatterns;
  102. newInfo [i++].version = codec.version;
  103. }
  104. return newInfo;
  105. }
  106. // properties
  107. public Guid Clsid
  108. {
  109. get { return clsid; }
  110. set { clsid = value; }
  111. }
  112. public string CodecName
  113. {
  114. get { return codecName; }
  115. set { codecName = value; }
  116. }
  117. public string DllName
  118. {
  119. get { return dllName; }
  120. set { dllName = value; }
  121. }
  122. public string FilenameExtension
  123. {
  124. get { return filenameExtension; }
  125. set { filenameExtension = value; }
  126. }
  127. public ImageCodecFlags Flags
  128. {
  129. get { return flags; }
  130. set { flags = value; }
  131. }
  132. public string FormatDescription
  133. {
  134. get { return formatDescription; }
  135. set { formatDescription = value; }
  136. }
  137. public Guid FormatID
  138. {
  139. get { return formatID; }
  140. set { formatID = value; }
  141. }
  142. public string MimeType
  143. {
  144. get { return mimeType; }
  145. set { mimeType = value; }
  146. }
  147. [CLSCompliant(false)]
  148. public byte[][] SignatureMasks
  149. {
  150. get { return signatureMasks; }
  151. set { signatureMasks = value; }
  152. }
  153. [CLSCompliant(false)]
  154. public byte[][] SignaturePatterns
  155. {
  156. get { return signaturePatterns; }
  157. set { signaturePatterns = value; }
  158. }
  159. public int Version
  160. {
  161. get { return version; }
  162. set { version = value; }
  163. }
  164. }
  165. }