ImageCodecInfo.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. //
  9. // (C) 2002 Ximian, Inc. http://www.ximian.com
  10. //
  11. using System;
  12. using System.Runtime.InteropServices;
  13. using System.Collections;
  14. using System.IO;
  15. namespace System.Drawing.Imaging {
  16. [ComVisible (false)]
  17. public sealed class ImageCodecInfo {
  18. Guid clsid;
  19. string codecName;
  20. string dllName;
  21. string filenameExtension;
  22. ImageCodecFlags flags;
  23. string formatDescription;
  24. Guid formatID;
  25. string mimeType;
  26. byte[][] signatureMasks;
  27. byte[][] signaturePatterns;
  28. int version;
  29. static ArrayList allCodecs = new ArrayList();
  30. static ImageCodecInfo() {
  31. allCodecs.Add(BMPCodec.CodecInfo);
  32. allCodecs.Add(JPEGCodec.CodecInfo);
  33. allCodecs.Add(PNGCodec.CodecInfo);
  34. }
  35. internal ImageCodecInfo()
  36. {
  37. }
  38. internal delegate void DecodeFromStream (Image image, Stream stream, BitmapData info);
  39. internal DecodeFromStream decode;
  40. internal delegate void EncodeToStream (Image image, Stream stream);
  41. internal EncodeToStream encode;
  42. // methods
  43. [MonoTODO]
  44. public static ImageCodecInfo[] GetImageDecoders() {
  45. ArrayList decoders = new ArrayList();
  46. foreach( ImageCodecInfo info in allCodecs) {
  47. if( (info.Flags & ImageCodecFlags.Decoder) != 0) {
  48. decoders.Add( info);
  49. }
  50. }
  51. ImageCodecInfo[] result = new ImageCodecInfo[decoders.Count];
  52. decoders.CopyTo( result, 0);
  53. return result;
  54. }
  55. [MonoTODO]
  56. public static ImageCodecInfo[] GetImageEncoders() {
  57. ArrayList encoders = new ArrayList();
  58. foreach( ImageCodecInfo info in allCodecs) {
  59. if( (info.Flags & ImageCodecFlags.Encoder) != 0) {
  60. encoders.Add( info);
  61. }
  62. }
  63. ImageCodecInfo[] result = new ImageCodecInfo[encoders.Count];
  64. encoders.CopyTo( result, 0);
  65. return result;
  66. }
  67. // properties
  68. [MonoTODO]
  69. public Guid Clsid {
  70. get { return clsid; }
  71. set { clsid = value; }
  72. }
  73. [MonoTODO]
  74. public string CodecName {
  75. get { return codecName; }
  76. set { codecName = value; }
  77. }
  78. [MonoTODO]
  79. public string DllName {
  80. get { return dllName; }
  81. set { dllName = value; }
  82. }
  83. [MonoTODO]
  84. public string FilenameExtension {
  85. get { return filenameExtension; }
  86. set { filenameExtension = value; }
  87. }
  88. [MonoTODO]
  89. public ImageCodecFlags Flags {
  90. get { return flags; }
  91. set { flags = value; }
  92. }
  93. [MonoTODO]
  94. public string FormatDescription {
  95. get { return formatDescription; }
  96. set { formatDescription = value; }
  97. }
  98. [MonoTODO]
  99. public Guid FormatID {
  100. get { return formatID; }
  101. set { formatID = value; }
  102. }
  103. [MonoTODO]
  104. public string MimeType {
  105. get { return mimeType; }
  106. set { mimeType = value; }
  107. }
  108. [MonoTODO]
  109. [CLSCompliant(false)]
  110. public byte[][] SignatureMasks {
  111. get { return signatureMasks; }
  112. set { signatureMasks = value; }
  113. }
  114. [MonoTODO]
  115. [CLSCompliant(false)]
  116. public byte[][] SignaturePatterns {
  117. get { return signaturePatterns; }
  118. set { signaturePatterns = value; }
  119. }
  120. [MonoTODO]
  121. public int Version {
  122. get { return version; }
  123. set { version = value; }
  124. }
  125. }
  126. }