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