ImageCodecInfo.jvm.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. }
  68. return newInfo;
  69. }
  70. internal ImageCodecInfo () {
  71. }
  72. public static ImageCodecInfo[] GetImageEncoders ()
  73. {
  74. Hashtable oldInfo = ImageCodec.Encoders;
  75. ImageCodecInfo [] newInfo = new ImageCodecInfo [oldInfo.Count];
  76. int i=0;
  77. foreach (ImageCodecInfo codec in oldInfo.Values) {
  78. //newInfo [i++] = (ImageCodecInfo) codec.MemberwiseClone ();
  79. newInfo [i] = new ImageCodecInfo ();
  80. newInfo [i].clsid = codec.clsid;
  81. newInfo [i].formatID = codec.formatID;
  82. newInfo [i].codecName = codec.codecName;
  83. newInfo [i].dllName = codec.dllName;
  84. newInfo [i].flags = codec.flags;
  85. newInfo [i].filenameExtension = codec.filenameExtension;
  86. newInfo [i].formatDescription = codec.formatDescription;
  87. newInfo [i].mimeType = codec.mimeType;
  88. newInfo [i].signatureMasks = codec.signatureMasks;
  89. newInfo [i].signaturePatterns = codec.signaturePatterns;
  90. newInfo [i++].version = codec.version;
  91. }
  92. return newInfo;
  93. }
  94. // properties
  95. public Guid Clsid
  96. {
  97. get { return clsid; }
  98. set { clsid = value; }
  99. }
  100. public string CodecName
  101. {
  102. get { return codecName; }
  103. set { codecName = value; }
  104. }
  105. public string DllName
  106. {
  107. get { return dllName; }
  108. set { throw new NotSupportedException(); }
  109. }
  110. public string FilenameExtension
  111. {
  112. get { return filenameExtension; }
  113. set { filenameExtension = value; }
  114. }
  115. public ImageCodecFlags Flags
  116. {
  117. get { return flags; }
  118. set { flags = value; }
  119. }
  120. public string FormatDescription
  121. {
  122. get { return formatDescription; }
  123. set { formatDescription = value; }
  124. }
  125. public Guid FormatID
  126. {
  127. get { return formatID; }
  128. set { formatID = value; }
  129. }
  130. public string MimeType
  131. {
  132. get { return mimeType; }
  133. set { mimeType = value; }
  134. }
  135. [CLSCompliant(false)]
  136. public byte[][] SignatureMasks
  137. {
  138. get { return signatureMasks; }
  139. set { signatureMasks = value; }
  140. }
  141. [CLSCompliant(false)]
  142. public byte[][] SignaturePatterns
  143. {
  144. get { return signaturePatterns; }
  145. set { signaturePatterns = value; }
  146. }
  147. public int Version
  148. {
  149. get { return version; }
  150. set { version = value; }
  151. }
  152. }
  153. }