2005-10-04 Zoltan Varga <vargaz@freemail.hu>
[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 ();\r
73                                 newInfo [i] = new ImageCodecInfo ();
74                                 newInfo [i].clsid = codec.clsid;
75                                 newInfo [i].formatID = codec.formatID;
76                                 newInfo [i].codecName = codec.codecName;
77                                 newInfo [i].dllName = codec.dllName;
78                                 newInfo [i].flags = codec.flags;
79                                 newInfo [i].filenameExtension = codec.filenameExtension;
80                                 newInfo [i].formatDescription = codec.formatDescription;
81                                 newInfo [i].mimeType = codec.mimeType;
82                                 newInfo [i].signatureMasks = codec.signatureMasks;
83                                 newInfo [i].signaturePatterns = codec.signaturePatterns;
84                                 newInfo [i++].version = codec.version;
85                         }\r
86                         return newInfo;
87                 }
88                 
89                 internal ImageCodecInfo () {
90                 }
91
92                 public static ImageCodecInfo[] GetImageEncoders () 
93                 {
94                         Hashtable oldInfo = ImageCodec.Encoders;
95                         ImageCodecInfo [] newInfo = new ImageCodecInfo [oldInfo.Count];
96                         int i=0;
97                         foreach (ImageCodecInfo codec in oldInfo.Values) {
98                                 //newInfo [i++] = (ImageCodecInfo) codec.MemberwiseClone ();
99                                 newInfo [i] = new ImageCodecInfo ();
100                                 newInfo [i].clsid = codec.clsid;
101                                 newInfo [i].formatID = codec.formatID;
102                                 newInfo [i].codecName = codec.codecName;
103                                 newInfo [i].dllName = codec.dllName;
104                                 newInfo [i].flags = codec.flags;
105                                 newInfo [i].filenameExtension = codec.filenameExtension;
106                                 newInfo [i].formatDescription = codec.formatDescription;
107                                 newInfo [i].mimeType = codec.mimeType;
108                                 newInfo [i].signatureMasks = codec.signatureMasks;
109                                 newInfo [i].signaturePatterns = codec.signaturePatterns;
110                                 newInfo [i++].version = codec.version;
111                         }
112                         return newInfo;
113                 }
114
115                 // properties
116                 
117                 public Guid Clsid 
118                 {
119                         get { return clsid; }
120                         set { clsid = value; }
121                 }
122
123                 
124                 public string CodecName 
125                 {
126                         get { return codecName; }
127                         set { codecName = value; }
128                 }
129
130                 
131                 public string DllName 
132                 {
133                         get { return dllName; }
134                         set { dllName = value; }
135                 }
136
137                 
138                 public string FilenameExtension 
139                 {
140                         get { return filenameExtension; }
141                         set { filenameExtension = value; }
142                 }
143
144                 
145                 public ImageCodecFlags Flags 
146                 {
147                         get { return flags; }
148                         set { flags = value; }
149                 }
150                 
151                 public string FormatDescription 
152                 {
153                         get { return formatDescription; }
154                         set { formatDescription = value; }
155                 }
156                 
157                 public Guid FormatID 
158                 {
159                         get { return formatID; }
160                         set { formatID = value; }
161                 }
162
163                 
164                 public string MimeType 
165                 {
166                         get { return mimeType; }
167                         set { mimeType = value; }
168                 }
169
170                 
171                 [CLSCompliant(false)]
172                 public byte[][] SignatureMasks 
173                 {
174                         get { return signatureMasks; }
175                         set { signatureMasks = value; }
176                 }
177
178                 [CLSCompliant(false)]
179                 public byte[][] SignaturePatterns 
180                 {
181                         get { return signaturePatterns; }
182                         set { signaturePatterns = value; }
183                 }
184                 
185                 public int Version 
186                 {
187                         get { return version; }
188                         set { version = value; }
189                 }
190
191         }
192
193 }