ImageFormat.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. //
  2. // System.Drawing.Imaging.ImageFormat.cs
  3. //
  4. // Authors:
  5. // Everaldo Canuto ([email protected])
  6. // Andreas Nahr ([email protected])
  7. // Dennis Hayes ([email protected])
  8. // Jordi Mas i Hernandez ([email protected])
  9. //
  10. // (C) 2002-4 Ximian, Inc. http://www.ximian.com
  11. // Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
  12. //
  13. // Permission is hereby granted, free of charge, to any person obtaining
  14. // a copy of this software and associated documentation files (the
  15. // "Software"), to deal in the Software without restriction, including
  16. // without limitation the rights to use, copy, modify, merge, publish,
  17. // distribute, sublicense, and/or sell copies of the Software, and to
  18. // permit persons to whom the Software is furnished to do so, subject to
  19. // the following conditions:
  20. //
  21. // The above copyright notice and this permission notice shall be
  22. // included in all copies or substantial portions of the Software.
  23. //
  24. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  28. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  29. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  30. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  31. //
  32. using System.ComponentModel;
  33. namespace System.Drawing.Imaging {
  34. [TypeConverter (typeof (ImageFormatConverter))]
  35. public sealed class ImageFormat
  36. {
  37. private Guid guid;
  38. private static ImageFormat BmpImageFormat = new ImageFormat (new Guid ("b96b3cab-0728-11d3-9d7b-0000f81ef32e"));
  39. private static ImageFormat EmfImageFormat = new ImageFormat (new Guid ("b96b3cac-0728-11d3-9d7b-0000f81ef32e"));
  40. private static ImageFormat ExifImageFormat = new ImageFormat (new Guid ("b96b3cb2-0728-11d3-9d7b-0000f81ef32e"));
  41. private static ImageFormat GifImageFormat = new ImageFormat (new Guid ("b96b3cb0-0728-11d3-9d7b-0000f81ef32e"));
  42. private static ImageFormat TiffImageFormat = new ImageFormat (new Guid ("b96b3cb1-0728-11d3-9d7b-0000f81ef32e"));
  43. private static ImageFormat PngImageFormat = new ImageFormat(new Guid("b96b3caf-0728-11d3-9d7b-0000f81ef32e"));
  44. private static ImageFormat MemoryBmpImageFormat = new ImageFormat (new Guid ("b96b3caa-0728-11d3-9d7b-0000f81ef32e"));
  45. private static ImageFormat IconImageFormat = new ImageFormat (new Guid ("b96b3cb5-0728-11d3-9d7b-0000f81ef32e"));
  46. private static ImageFormat JpegImageFormat = new ImageFormat(new Guid("b96b3cae-0728-11d3-9d7b-0000f81ef32e"));
  47. private static ImageFormat WmfImageFormat = new ImageFormat (new Guid ("b96b3cad-0728-11d3-9d7b-0000f81ef32e"));
  48. // constructors
  49. public ImageFormat (Guid guid)
  50. {
  51. this.guid = guid;
  52. }
  53. // methods
  54. public override bool Equals(object o) {
  55. if (o is ImageFormat)
  56. if ( ((ImageFormat)o).Guid.Equals(this.Guid))
  57. return true;
  58. return false;
  59. }
  60. public override int GetHashCode()
  61. {
  62. return guid.GetHashCode();
  63. }
  64. public override string ToString()
  65. {
  66. return ("[ImageFormat: " + guid.ToString () + "]");
  67. }
  68. // properties
  69. public Guid Guid
  70. {
  71. get { return guid; }
  72. }
  73. public static ImageFormat Bmp
  74. {
  75. get { return BmpImageFormat; }
  76. }
  77. public static ImageFormat Emf
  78. {
  79. get { return EmfImageFormat; }
  80. }
  81. public static ImageFormat Exif
  82. {
  83. get { return ExifImageFormat; }
  84. }
  85. public static ImageFormat Gif
  86. {
  87. get { return GifImageFormat; }
  88. }
  89. public static ImageFormat Icon
  90. {
  91. get { return IconImageFormat; }
  92. }
  93. public static ImageFormat Jpeg
  94. {
  95. get { return JpegImageFormat; }
  96. }
  97. public static ImageFormat MemoryBmp
  98. {
  99. get { return MemoryBmpImageFormat; }
  100. }
  101. public static ImageFormat Png
  102. {
  103. get { return PngImageFormat; }
  104. }
  105. public static ImageFormat Tiff
  106. {
  107. get { return TiffImageFormat; }
  108. }
  109. public static ImageFormat Wmf
  110. {
  111. get { return WmfImageFormat; }
  112. }
  113. }
  114. }