프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / ConvertService / ConverterService / DZConverterLib / Common / ImageFileSaver.cs @ 6c45db59

이력 | 보기 | 이력해설 | 다운로드 (96.5 KB)

1 7ca218b3 KangIngu
using System;
2
using System.Windows.Forms;
3
using System.IO;
4
using Leadtools;
5
using Leadtools.Codecs;
6
using System.Data.Objects.DataClasses;
7
using DeepViewDataModel.DataModel;
8
using DeepView.Toolkit.GuidGenerator;
9
10
namespace DZConverterLib
11
{
12
   public class ImageFileSaver
13
   {
14
      public ImageFileSaver()
15
      {
16
      }
17
18
      [Flags] public enum SaveFormatFlags
19
      {
20
         None = 0,
21
         Progressive = 0x00000001,
22
         CmpQualityFactorPredefined = 0x00000002,
23
         QualityFactor = 0x00000004,
24
         MultiPage = 0x00000008,
25
         Stamp = 0x00000010,
26
         LosslessJpeg = 0x00000020,
27
         Jpeg2000Basic = 0x00000040,
28
         Jpeg2000Advanced = 0x00000080,
29
         PngQualityFactor = 0x00000100,
30
         AbcQualityFactor = 0x00000200,
31
         EcwQualityFactor = 0x00000400,
32
         Jpeg2000AlphaChannel = 0x00000800,
33
         Jbig2Support = 0x00001000,
34
         XpsPngQualityFactor = 0x00002000,
35
         XpsJpegQualityFactor = 0x00004000,
36
      }
37
38
      public struct SaveSubFormat
39
      {
40
         private string _name;
41
         private RasterImageFormat _format;
42
         private string _defaultExtension;
43
         private SaveFormatFlags _flags;
44
45
         public SaveSubFormat(string name, RasterImageFormat format, string defaultExtension, SaveFormatFlags flags)
46
         {
47
            _name = name;
48
            _format = format;
49
            _defaultExtension = defaultExtension;
50
            _flags = flags;
51
         }
52
53
         public string Name
54
         {
55
            get { return _name; }
56
         }
57
58
         public RasterImageFormat Format
59
         {
60
            get { return _format; }
61
         }
62
63
         public string DefaultExtension
64
         {
65
            get { return _defaultExtension; }
66
         }
67
68
         public SaveFormatFlags Flags
69
         {
70
            get { return _flags; }
71
         }
72
73
         public override string ToString()
74
         {
75
            return Name;
76
         }
77
78
         public static readonly SaveSubFormat[] Cmp1 = 
79
         {
80
            new SaveSubFormat( string.Empty, RasterImageFormat.Lead1Bit, "cmp", SaveFormatFlags.None ),
81
         } ;
82
83
         public static readonly SaveSubFormat[] Cmp = 
84
         {
85
            new SaveSubFormat( "Non-Progressive", RasterImageFormat.Cmp,  "cmp", ( SaveFormatFlags.CmpQualityFactorPredefined | SaveFormatFlags.Stamp ) ),
86
            new SaveSubFormat( "Progressive",     RasterImageFormat.Cmp,  "cmp",  ( SaveFormatFlags.CmpQualityFactorPredefined | SaveFormatFlags.Stamp | SaveFormatFlags.Progressive ) ),
87
         } ;
88
89
         public static readonly SaveSubFormat[] Jpeg24 = 
90
         {
91
            new SaveSubFormat( "Yuv 4:4:4",       RasterImageFormat.Jpeg,       "jpg",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
92
            new SaveSubFormat( "Yuv 4:2:2",       RasterImageFormat.Jpeg422,    "jpg",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
93
            new SaveSubFormat( "Yuv 4:1:1",       RasterImageFormat.Jpeg411,    "jpg",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
94
            new SaveSubFormat( "Progressive 444", RasterImageFormat.Jpeg,       "jpg",   ( SaveFormatFlags.Progressive | SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
95
            new SaveSubFormat( "Progressive 422", RasterImageFormat.Jpeg422,    "jpg",   ( SaveFormatFlags.Progressive | SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
96
            new SaveSubFormat( "Progressive 411", RasterImageFormat.Jpeg411,    "jpg",   ( SaveFormatFlags.Progressive | SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
97
            new SaveSubFormat( "Lossless",        RasterImageFormat.Jpeg,       "jpg",   ( SaveFormatFlags.Stamp | SaveFormatFlags.LosslessJpeg ) ),
98
            new SaveSubFormat( "Lab 4:4:4",       RasterImageFormat.JpegLab, "jpg",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
99
            new SaveSubFormat( "Lab 4:2:2",       RasterImageFormat.JpegLab422, "jpg",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
100
            new SaveSubFormat( "Lab 4:1:1",       RasterImageFormat.JpegLab411, "jpg",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
101
         } ;
102
103
         public static readonly SaveSubFormat[] Jpeg12 = 
104
         {
105
            new SaveSubFormat( "Yuv 4:0:0",   RasterImageFormat.Jpeg, "jpg",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
106
            new SaveSubFormat( "Lossless",    RasterImageFormat.Jpeg, "jpg",   ( SaveFormatFlags.Stamp | SaveFormatFlags.LosslessJpeg ) ),
107
         } ;
108
109
         public static readonly SaveSubFormat[] Jpeg8 = 
110
         {
111
            new SaveSubFormat( "Yuv 4:0:0",             RasterImageFormat.Jpeg, "jpg",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
112
            new SaveSubFormat( "Progressive Yuv 4:0:0", RasterImageFormat.Jpeg, "jpg",   ( SaveFormatFlags.Progressive | SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
113
            new SaveSubFormat( "Lossless",              RasterImageFormat.Jpeg, "jpg",   ( SaveFormatFlags.Stamp | SaveFormatFlags.LosslessJpeg ) ),
114
         } ;
115
116
         public static readonly SaveSubFormat[] Cals = 
117
         {
118
            new SaveSubFormat( "Cals Type 1",  RasterImageFormat.Cals,    "cal",   ( SaveFormatFlags.None ) ),
119
            new SaveSubFormat( "Cals Type 2",  RasterImageFormat.Cals2,   "cal",   ( SaveFormatFlags.None ) ),
120
            new SaveSubFormat( "Cals Type 3",  RasterImageFormat.Cals3,   "cal",   ( SaveFormatFlags.None ) ),
121
            new SaveSubFormat( "Cals Type 4",  RasterImageFormat.Cals4,   "cal",   ( SaveFormatFlags.None ) ),
122
         } ;
123
124
         public static readonly SaveSubFormat[] Clp = 
125
         {
126
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.Clp,     "clp",   ( SaveFormatFlags.None ) ),
127
            new SaveSubFormat( "Rle Compressed",  RasterImageFormat.ClpRle,  "clp",   ( SaveFormatFlags.None ) ),
128
         } ;
129
130
         public static readonly SaveSubFormat[] DicomGray8 = 
131
         {
132
            new SaveSubFormat( "Uncompressed Grayscale",    RasterImageFormat.DicomGray,     "dic",   ( SaveFormatFlags.None ) ),
133
            new SaveSubFormat( "Uncompressed Color",        RasterImageFormat.DicomColor,    "dic",   ( SaveFormatFlags.None ) ),
134
            new SaveSubFormat( "Rle Grayscale",             RasterImageFormat.DicomRleGray,  "dic",   ( SaveFormatFlags.None ) ),
135
            new SaveSubFormat( "Rle Color",                 RasterImageFormat.DicomRleColor, "dic",   ( SaveFormatFlags.None ) ),
136
            new SaveSubFormat( "Lossy Jpeg Grayscale",      RasterImageFormat.DicomJpegGray, "dic",   ( SaveFormatFlags.QualityFactor ) ),
137
            new SaveSubFormat( "Lossless Jpeg 2000",        RasterImageFormat.DicomJ2kGray, "dic",   ( SaveFormatFlags.LosslessJpeg ) ),
138
            new SaveSubFormat( "Lossy Jpeg 2000",           RasterImageFormat.DicomJ2kGray, "dic",   ( SaveFormatFlags.QualityFactor ) ),
139
140
         } ;
141
142
         public static readonly SaveSubFormat[] DicomGray16 = 
143
         {
144
            new SaveSubFormat( "Uncompressed Grayscale",  RasterImageFormat.DicomGray,     "dic",   ( SaveFormatFlags.None ) ),
145
            new SaveSubFormat( "Rle Grayscale",           RasterImageFormat.DicomRleGray,  "dic",   ( SaveFormatFlags.None ) ),
146
            new SaveSubFormat( "Lossless Jpeg Grayscale", RasterImageFormat.DicomJpegGray, "dic",   ( SaveFormatFlags.LosslessJpeg ) ),
147
            new SaveSubFormat( "Lossless Jpeg 2000",      RasterImageFormat.DicomJ2kGray,  "dic",   ( SaveFormatFlags.LosslessJpeg ) ),
148
            new SaveSubFormat( "Lossy Jpeg 2000",         RasterImageFormat.DicomJ2kGray,  "dic",   ( SaveFormatFlags.QualityFactor ) ),
149
150
         };
151
152
         public static readonly SaveSubFormat[] DicomColor24 = 
153
         {
154
            new SaveSubFormat( "Uncompressed Color",  RasterImageFormat.DicomColor,     "dic",   ( SaveFormatFlags.None ) ),
155
            new SaveSubFormat( "Rle Color",           RasterImageFormat.DicomRleColor,  "dic",   ( SaveFormatFlags.None ) ),
156
            new SaveSubFormat( "Lossless Jpeg Color", RasterImageFormat.DicomJpegColor, "dic",   ( SaveFormatFlags.LosslessJpeg ) ),
157
            new SaveSubFormat( "Lossy Jpeg Color",    RasterImageFormat.DicomJpegColor, "dic",   ( SaveFormatFlags.QualityFactor ) ),
158
            new SaveSubFormat( "Lossless Jpeg 2000",  RasterImageFormat.DicomJ2kGray,   "dic",   ( SaveFormatFlags.LosslessJpeg ) ),
159
            new SaveSubFormat( "Lossy Jpeg 2000",     RasterImageFormat.DicomJpegColor, "dic",   ( SaveFormatFlags.QualityFactor ) ),
160
161
         } ;
162
163
         public static readonly SaveSubFormat[] Fax = 
164
         {
165
            new SaveSubFormat( "Ccitt Group 3 - 1 Dimension", RasterImageFormat.FaxG31Dim,  "fax", ( SaveFormatFlags.None ) ),
166
            new SaveSubFormat( "Ccitt Group 3 - 2 Dimension", RasterImageFormat.FaxG32Dim,  "fax", ( SaveFormatFlags.None ) ),
167
            new SaveSubFormat( "Ccitt Group 4",               RasterImageFormat.FaxG4,      "fax", ( SaveFormatFlags.None ) ),
168
         } ;
169
170
         public static readonly SaveSubFormat[] Modca1 = 
171
         {
172
            new SaveSubFormat( "Ccitt Group 3 - 1 Dimension", RasterImageFormat.IcaG31Dim,        "ica", ( SaveFormatFlags.MultiPage ) ),
173
            new SaveSubFormat( "Ccitt Group 3 - 2 Dimension", RasterImageFormat.IcaG32Dim,        "ica", ( SaveFormatFlags.MultiPage ) ),
174
            new SaveSubFormat( "Ccitt Group 4",               RasterImageFormat.IcaG4,            "ica", ( SaveFormatFlags.MultiPage ) ),
175
            new SaveSubFormat( "Ibm Mmr",                     RasterImageFormat.IcaIbmMmr,        "ica", ( SaveFormatFlags.MultiPage ) ),
176
            new SaveSubFormat( "Uncompressed",                RasterImageFormat.IcaUncompressed,  "ica", ( SaveFormatFlags.MultiPage ) ),
177
            new SaveSubFormat( "Abic",                        RasterImageFormat.IcaAbic,          "ica", ( SaveFormatFlags.None ) ),
178
         } ;
179
180
         public static readonly SaveSubFormat[] Modca4 = 
181
         {
182
            new SaveSubFormat( "Abic",                        RasterImageFormat.IcaAbic,          "ica", ( SaveFormatFlags.None ) ),
183
         } ;
184
185
         public static readonly SaveSubFormat[] Mrc = 
186
         {
187
            new SaveSubFormat( "LEAD Mrc",  RasterImageFormat.LeadMrc,    "mrc", ( SaveFormatFlags.None ) ),
188
            new SaveSubFormat( "Mrc",       RasterImageFormat.Mrc,        "mrc", ( SaveFormatFlags.None ) ),
189
         } ;
190
      
191
         public static readonly SaveSubFormat[] Itg = 
192
         {
193
            new SaveSubFormat( "Rle Uncompressed",           RasterImageFormat.IntergraphRle,       "itg",   ( SaveFormatFlags.None ) ),
194
            new SaveSubFormat( "Ccitt Group 4",              RasterImageFormat.IntergraphCcittG4,   "itg",   ( SaveFormatFlags.None ) ),
195
         } ;
196
197
          public static readonly SaveSubFormat[] RawIca = 
198
         {
199
            new SaveSubFormat( "Ccitt Group 3 - 1 Dimension", RasterImageFormat.RawIcaG31Dim,        "ica",   ( SaveFormatFlags.None ) ),
200
            new SaveSubFormat( "Ccitt Group 3 - 2 Dimension", RasterImageFormat.RawIcaG32Dim,        "ica",   ( SaveFormatFlags.None ) ),
201
            new SaveSubFormat( "Ccitt Group 4",               RasterImageFormat.RawIcaG4,            "ica",   ( SaveFormatFlags.None ) ),
202
            new SaveSubFormat( "Ibm Mmr",                     RasterImageFormat.RawIcaIbmMmr,        "ica",   ( SaveFormatFlags.None ) ),
203
            new SaveSubFormat( "Uncompressed",                RasterImageFormat.RawIcaUncompressed,  "ica",   ( SaveFormatFlags.None ) ),
204
         } ;
205
206
          public static readonly SaveSubFormat[] Wfx = 
207
         {
208
            new SaveSubFormat( "Ccitt Group 3 - 1 Dimension", RasterImageFormat.WfxG31Dim,           "wfx",   ( SaveFormatFlags.None ) ),
209
            new SaveSubFormat( "Ccitt Group 4",               RasterImageFormat.WfxG4,               "wfx",   ( SaveFormatFlags.None ) ),
210
         } ;
211
212
          public static readonly SaveSubFormat[] Smp = 
213
         {
214
            new SaveSubFormat( "Ccitt Group 3 - 1 Dimension", RasterImageFormat.SmpG31Dim,  "smp",   ( SaveFormatFlags.None ) ),
215
            new SaveSubFormat( "Ccitt Group 3 - 2 Dimension", RasterImageFormat.SmpG32Dim,  "smp",   ( SaveFormatFlags.None ) ),
216
            new SaveSubFormat( "Ccitt Group 4",               RasterImageFormat.SmpG4,      "smp",   ( SaveFormatFlags.None ) ),
217
            new SaveSubFormat( "Uncompressed",                RasterImageFormat.Smp,        "smp",   ( SaveFormatFlags.None ) ),
218
         } ;
219
220
          public static readonly SaveSubFormat[] Exif = 
221
         {
222
            new SaveSubFormat( "Uncompressed Rgb",   RasterImageFormat.Exif,          "tif",   ( SaveFormatFlags.Stamp ) ),
223
            new SaveSubFormat( "Uncompressed YCbCr", RasterImageFormat.ExifYcc,       "tif",   ( SaveFormatFlags.Stamp ) ),
224
            new SaveSubFormat( "Jpeg_4:1:1",         RasterImageFormat.ExifJpeg411,   "tif",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
225
            new SaveSubFormat( "Jpeg_4:2:2",         RasterImageFormat.ExifJpeg422,   "tif",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
226
         } ;
227
228
         public static readonly SaveSubFormat[] Fpx = 
229
         {
230
            new SaveSubFormat( "Uncompressed",           RasterImageFormat.Fpx,            "fpx",   ( SaveFormatFlags.MultiPage ) ),
231
            new SaveSubFormat( "Single Color",           RasterImageFormat.FpxSingleColor, "fpx",   ( SaveFormatFlags.MultiPage ) ),
232
            new SaveSubFormat( "Jpeg Default qFactor",   RasterImageFormat.FpxJpeg,        "fpx",   ( SaveFormatFlags.MultiPage ) ),
233
            new SaveSubFormat( "Jpeg Specify qFactor",   RasterImageFormat.FpxJpegQFactor, "fpx",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.QualityFactor ) ),
234
         } ;
235
236
         public static readonly SaveSubFormat[] Gif = 
237
         {
238
            new SaveSubFormat( "Interlaced 89a",     RasterImageFormat.Gif,  "gif",   ( SaveFormatFlags.MultiPage ) ),
239
            new SaveSubFormat( "Non-Interlaced 89a", RasterImageFormat.Gif,  "gif",   ( SaveFormatFlags.MultiPage ) ) 
240
         } ;
241
242
         public static readonly SaveSubFormat[] Os2 = 
243
         {
244
            new SaveSubFormat( "Version 1.0",  RasterImageFormat.Os2,  "bmp",   ( SaveFormatFlags.None ) ),
245
            new SaveSubFormat( "Version 2.0",  RasterImageFormat.Os22, "bmp",   ( SaveFormatFlags.None ) ),
246
         } ;
247
248
         public static readonly SaveSubFormat[] Tiff1 = 
249
         {
250
            new SaveSubFormat( "Ccitt",                       RasterImageFormat.Ccitt,            "tif",   ( SaveFormatFlags.MultiPage ) ),
251
            new SaveSubFormat( "Ccitt Group 3 - 1 Dimension", RasterImageFormat.CcittGroup31Dim,  "tif",   ( SaveFormatFlags.MultiPage ) ),
252
            new SaveSubFormat( "Ccitt Group 3 - 2 Dimension", RasterImageFormat.CcittGroup32Dim,  "tif",   ( SaveFormatFlags.MultiPage ) ),
253
            new SaveSubFormat( "Ccitt Group 4",               RasterImageFormat.CcittGroup4,      "tif",   ( SaveFormatFlags.MultiPage ) ),
254
            new SaveSubFormat( "Uncompressed Rgb",            RasterImageFormat.Tif,                 "tif",   ( SaveFormatFlags.MultiPage ) ),
255
            new SaveSubFormat( "Packbits(Rle)Rgb",            RasterImageFormat.TifPackBits,         "tif",   ( SaveFormatFlags.MultiPage ) ),
256
            new SaveSubFormat( "Lzw Rgb",                     RasterImageFormat.TifLzw,              "tif",   ( SaveFormatFlags.MultiPage ) ),
257
            new SaveSubFormat( "Jbig",                        RasterImageFormat.TifJbig,             "tif",   ( SaveFormatFlags.MultiPage ) ),
258
            new SaveSubFormat( "Jbig2",                       RasterImageFormat.TifJbig2,            "tif",   ( SaveFormatFlags.MultiPage ) ),
259
            new SaveSubFormat( "LEAD Abc",                    RasterImageFormat.TifAbc,              "tif",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.AbcQualityFactor ) ),
260
            new SaveSubFormat( "Abic",                        RasterImageFormat.TifAbic,             "tif",   ( SaveFormatFlags.None ) ),
261
         } ;
262
263
         public static readonly SaveSubFormat[] TiffOther = 
264
         {
265
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.Tif,           "tif",   ( SaveFormatFlags.MultiPage ) ),
266
            new SaveSubFormat( "Packbits (Rle)",  RasterImageFormat.TifPackBits,   "tif",   ( SaveFormatFlags.MultiPage ) ),
267
            new SaveSubFormat( "Lzw",             RasterImageFormat.TifLzw,        "tif",   ( SaveFormatFlags.MultiPage ) ),
268
            new SaveSubFormat( "Jbig",            RasterImageFormat.TifJbig,       "tif",   ( SaveFormatFlags.MultiPage ) ),
269
         } ;
270
271
         public static readonly SaveSubFormat[] Tiff4 = 
272
         {
273
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.Tif,           "tif",   ( SaveFormatFlags.MultiPage ) ),
274
            new SaveSubFormat( "Packbits (Rle)",  RasterImageFormat.TifPackBits,   "tif",   ( SaveFormatFlags.MultiPage ) ),
275
            new SaveSubFormat( "Lzw",             RasterImageFormat.TifLzw,        "tif",   ( SaveFormatFlags.MultiPage ) ),
276
            new SaveSubFormat( "Jbig",            RasterImageFormat.TifJbig,       "tif",   ( SaveFormatFlags.MultiPage ) ),
277
            new SaveSubFormat( "Abic",            RasterImageFormat.TifAbic,      "tif",   ( SaveFormatFlags.None ) ),
278
         } ;
279
280
         public static readonly SaveSubFormat[] Tiff8 = 
281
         {
282
            new SaveSubFormat( "Uncompressed Rgb",   RasterImageFormat.Tif,           "tif", ( SaveFormatFlags.MultiPage ) ),
283
            new SaveSubFormat( "Packbits (Rle)Rgb",  RasterImageFormat.TifPackBits,   "tif", ( SaveFormatFlags.MultiPage ) ),
284
            new SaveSubFormat( "Jpeg (GRAY) YCbCr",  RasterImageFormat.TifJpeg,       "tif", ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage ) ),
285
            new SaveSubFormat( "Lossless Jpeg",      RasterImageFormat.TifJpeg,       "tif", ( SaveFormatFlags.MultiPage | SaveFormatFlags.LosslessJpeg ) ),
286
            new SaveSubFormat( "Lzw Rgb",            RasterImageFormat.TifLzw,        "tif", ( SaveFormatFlags.MultiPage ) ),
287
            new SaveSubFormat( "Jbig",               RasterImageFormat.TifJbig,       "tif", ( SaveFormatFlags.MultiPage ) ),
288
            new SaveSubFormat( "Cmp",                RasterImageFormat.TifCmp,        "tif", ( SaveFormatFlags.CmpQualityFactorPredefined | SaveFormatFlags.MultiPage ) ),
289
            new SaveSubFormat( "Jpeg 2000 Stream",   RasterImageFormat.TifJ2k,        "tif", ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced ) ),
290
            new SaveSubFormat( "Wavelet Cmp",        RasterImageFormat.TifCmw,        "tif", ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Jpeg2000Basic ) ) 
291
         } ;
292
293
         public static readonly SaveSubFormat[] Tiff12 = 
294
         {
295
            new SaveSubFormat( "Uncompressed",       RasterImageFormat.Tif,           "tif", ( SaveFormatFlags.MultiPage ) ),
296
            new SaveSubFormat( "Packbits (Rle)",     RasterImageFormat.TifPackBits,   "tif", ( SaveFormatFlags.MultiPage ) ),
297
            new SaveSubFormat( "Lossless Jpeg",      RasterImageFormat.TifJpeg,       "tif", ( SaveFormatFlags.MultiPage | SaveFormatFlags.LosslessJpeg ) ),
298
            new SaveSubFormat( "Jpeg (GRAY) YCbCr",  RasterImageFormat.TifJpeg,       "tif", ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage ) ),
299
            new SaveSubFormat( "Lzw",                RasterImageFormat.TifLzw,        "tif", ( SaveFormatFlags.MultiPage ) ),
300
            new SaveSubFormat( "Jpeg 2000 Stream",   RasterImageFormat.TifJ2k,        "tif", ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced ) ),
301
            new SaveSubFormat( "Wavelet Cmp",        RasterImageFormat.TifCmw,        "tif", ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Jpeg2000Basic ) ) 
302
         } ;
303
304
         public static readonly SaveSubFormat[] Tiff16 = 
305
         {
306
            new SaveSubFormat( "Uncompressed",       RasterImageFormat.Tif,           "tif", ( SaveFormatFlags.MultiPage ) ),
307
            new SaveSubFormat( "Packbits (Rle)",     RasterImageFormat.TifPackBits,   "tif", ( SaveFormatFlags.MultiPage ) ),
308
            new SaveSubFormat( "Lossless Jpeg",      RasterImageFormat.TifJpeg,       "tif", ( SaveFormatFlags.MultiPage | SaveFormatFlags.LosslessJpeg ) ),
309
            new SaveSubFormat( "Lzw",                RasterImageFormat.TifLzw,        "tif", ( SaveFormatFlags.MultiPage ) ),
310
            new SaveSubFormat( "Jpeg 2000 Stream",   RasterImageFormat.TifJ2k,        "tif", ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced ) ),
311
            new SaveSubFormat( "Wavelet Cmp",        RasterImageFormat.TifCmw,        "tif", ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Jpeg2000Basic ) ) 
312
         } ;
313
314
         public static readonly SaveSubFormat[] Tiff24 = 
315
         {
316
            new SaveSubFormat( "Uncompressed Rgb",   RasterImageFormat.Tif,              "tif",   ( SaveFormatFlags.MultiPage ) ),
317
            new SaveSubFormat( "Uncompressed Cmyk",  RasterImageFormat.TifCmyk,          "tif",   ( SaveFormatFlags.MultiPage ) ),
318
            new SaveSubFormat( "Uncompressed YCbCr", RasterImageFormat.TifYcc,           "tif",   ( SaveFormatFlags.MultiPage ) ),
319
            new SaveSubFormat( "Packbits Rgb",       RasterImageFormat.TifPackBits,      "tif",   ( SaveFormatFlags.MultiPage ) ),
320
            new SaveSubFormat( "Packbits Cmyk",      RasterImageFormat.TifPackBitsCmyk,  "tif",   ( SaveFormatFlags.MultiPage ) ),
321
            new SaveSubFormat( "Packbits YCbCr",     RasterImageFormat.TifPackbitsYcc,   "tif",   ( SaveFormatFlags.MultiPage ) ),
322
            new SaveSubFormat( "Jpeg YCbCr 4:4:4",   RasterImageFormat.TifJpeg,          "tif",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage ) ),
323
            new SaveSubFormat( "Jpeg YCbCr 4:2:2",   RasterImageFormat.TifJpeg422,       "tif",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage ) ),
324
            new SaveSubFormat( "Jpeg YCbCr 4:1:1",   RasterImageFormat.TifJpeg411,       "tif",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage ) ),
325
            new SaveSubFormat( "Lossless Jpeg",      RasterImageFormat.TifJpeg,          "tif",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.LosslessJpeg ) ),
326
            new SaveSubFormat( "Lzw Rgb",            RasterImageFormat.TifLzw,           "tif",   ( SaveFormatFlags.MultiPage ) ),
327
            new SaveSubFormat( "Lzw Cmyk",           RasterImageFormat.TifLzwCmyk,       "tif",   ( SaveFormatFlags.MultiPage ) ),
328
            new SaveSubFormat( "Lzw YCbCr",          RasterImageFormat.TifLzwYcc,        "tif",   ( SaveFormatFlags.MultiPage ) ),
329
            new SaveSubFormat( "Cmp",                RasterImageFormat.TifCmp,           "tif",   ( SaveFormatFlags.CmpQualityFactorPredefined | SaveFormatFlags.MultiPage ) ),
330
            new SaveSubFormat( "Progressive Cmp",    RasterImageFormat.TifCmp,           "tif",   ( SaveFormatFlags.CmpQualityFactorPredefined | SaveFormatFlags.MultiPage | SaveFormatFlags.Progressive ) ),
331
            new SaveSubFormat( "Jpeg 2000 Stream",   RasterImageFormat.TifJ2k,           "tif",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced ) ),
332
            new SaveSubFormat( "Wavelet Cmp",        RasterImageFormat.TifCmw,           "tif",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Jpeg2000Basic ) ),
333
            new SaveSubFormat( "LEAD Mrc",           RasterImageFormat.TifLeadMrc,       "tif",   ( SaveFormatFlags.MultiPage ) ),
334
            new SaveSubFormat( "Mrc",                RasterImageFormat.TifMrc,           "tif",   ( SaveFormatFlags.MultiPage ) ),
335
         } ;
336
337
         public static readonly SaveSubFormat[] Tiff32 = 
338
         {
339
            new SaveSubFormat( "Uncompressed Rgb",   RasterImageFormat.Tif,              "tif", ( SaveFormatFlags.MultiPage ) ),
340
            new SaveSubFormat( "Uncompressed Cmyk",  RasterImageFormat.TifCmyk,          "tif", ( SaveFormatFlags.MultiPage ) ),
341
            new SaveSubFormat( "Packbits Rgb",       RasterImageFormat.TifPackBits,      "tif", ( SaveFormatFlags.MultiPage ) ),
342
            new SaveSubFormat( "Packbits Cmyk",      RasterImageFormat.TifPackBitsCmyk,  "tif", ( SaveFormatFlags.MultiPage ) ),
343
            new SaveSubFormat( "Lzw Rgb",            RasterImageFormat.TifLzw,           "tif", ( SaveFormatFlags.MultiPage ) ),
344
            new SaveSubFormat( "Lzw Cmyk",           RasterImageFormat.TifLzwCmyk,       "tif", ( SaveFormatFlags.MultiPage ) ),
345
         } ;
346
347
         public static readonly SaveSubFormat[] Tiff48 = 
348
         {
349
            new SaveSubFormat( "Uncompressed Rgb",   RasterImageFormat.Tif,     "tif",   ( SaveFormatFlags.MultiPage ) ),
350
            new SaveSubFormat( "Lzw Rgb",            RasterImageFormat.TifLzw,  "tif",   ( SaveFormatFlags.MultiPage ) ),
351
         } ;
352
353
         public static readonly SaveSubFormat[] Tiff64 = 
354
         {
355
            new SaveSubFormat( "Uncompressed Rgb",   RasterImageFormat.Tif,     "tif",   ( SaveFormatFlags.MultiPage ) ),
356
            new SaveSubFormat( "Lzw Rgb",            RasterImageFormat.TifLzw,  "tif",   ( SaveFormatFlags.MultiPage ) ),
357
         } ;
358
359
         public static readonly SaveSubFormat[] Bmp = 
360
         {
361
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.Bmp,     "bmp",   ( SaveFormatFlags.None ) ),
362
            new SaveSubFormat( "Rle Compressed",  RasterImageFormat.BmpRle,  "bmp",   ( SaveFormatFlags.None ) ),
363
         } ;
364
365
         public static readonly SaveSubFormat[] Ppm = 
366
         {
367
            new SaveSubFormat( "Ascii",  RasterImageFormat.PpmAscii,   "ppm",   ( SaveFormatFlags.None ) ),
368
            new SaveSubFormat( "Binary", RasterImageFormat.PpmBinary,  "ppm",   ( SaveFormatFlags.None ) ),
369
         } ;
370
371
         //public static readonly SaveSubFormat[] Psp = 
372
         //{
373
         //   new SaveSubFormat( "Rle Compressed",  RasterImageFormat.PspRle,   "psp",   ( SaveFormatFlags.None ) ),
374
         //   new SaveSubFormat( "Uncompressed",    RasterImageFormat.Psp,      "psp",   ( SaveFormatFlags.None ) ),
375
         //} ;
376
377
         public static readonly SaveSubFormat[] Tifx1 = 
378
         {
379
            new SaveSubFormat( "Ccitt G4",    RasterImageFormat.TifxFaxG4,   "tifx",   ( SaveFormatFlags.None ) ),
380
            new SaveSubFormat( "Ccitt G3 1D", RasterImageFormat.TifxFaxG31D, "tifx",   ( SaveFormatFlags.None ) ),
381
            new SaveSubFormat( "Ccitt G3 2D", RasterImageFormat.TifxFaxG32D, "tifx",   ( SaveFormatFlags.None ) ),
382
            new SaveSubFormat( "Jbig",        RasterImageFormat.TifxJbig,    "tifx",   ( SaveFormatFlags.None ) ),
383
         };
384
385
         public static readonly SaveSubFormat[] Tifx3 = 
386
         {
387
            new SaveSubFormat( "Jbig T43",    RasterImageFormat.TifxJbigT43, "tifx",  ( SaveFormatFlags.None ) ),
388
         };
389
390
         public static readonly SaveSubFormat[] Tifx8 = 
391
         {
392
            new SaveSubFormat( "Jbig T43 ItuLab",    RasterImageFormat.TifxJbigT43ItuLab, "tifx",  ( SaveFormatFlags.None ) ),
393
         };
394
395
         public static readonly SaveSubFormat[] Tifx24 = 
396
         {
397
            new SaveSubFormat( "Jpeg",    RasterImageFormat.TifxJpeg, "tifx",  ( SaveFormatFlags.None ) ),
398
         };
399
400
         public static readonly SaveSubFormat[] Pgm = 
401
         {
402
            new SaveSubFormat( "Ascii",  RasterImageFormat.PgmAscii,   "pgm",   ( SaveFormatFlags.None ) ),
403
            new SaveSubFormat( "Binary", RasterImageFormat.PgmBinary,  "pgm",   ( SaveFormatFlags.None ) ),
404
         } ;
405
406
         public static readonly SaveSubFormat[] Pbm = 
407
         {
408
            new SaveSubFormat( "Ascii",  RasterImageFormat.PbmAscii,   "pbm",   ( SaveFormatFlags.None ) ),
409
            new SaveSubFormat( "Binary", RasterImageFormat.PbmBinary,  "pbm",   ( SaveFormatFlags.None ) ),
410
         } ;
411
412
         public static readonly SaveSubFormat[] Iff = 
413
         {
414
            new SaveSubFormat( "Ilbm Uncompressed",     RasterImageFormat.IffIlbmUncompressed, "iff",   ( SaveFormatFlags.None ) ),
415
            new SaveSubFormat( "Ilbm Rle Compressed",   RasterImageFormat.IffIlbm,             "iff",   ( SaveFormatFlags.None ) ),
416
            new SaveSubFormat( "Cat Uncompressed",      RasterImageFormat.IffCatUncompressed,  "iff",   ( SaveFormatFlags.MultiPage ) ),
417
            new SaveSubFormat( "Cat Rle Compressed",    RasterImageFormat.IffCat,              "iff",   ( SaveFormatFlags.MultiPage ) ),
418
         } ;
419
420
         public static readonly SaveSubFormat[] Sgi = 
421
         {
422
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.Sgi,     "sgi",   ( SaveFormatFlags.None ) ),
423
            new SaveSubFormat( "Rle Compressed",  RasterImageFormat.SgiRle,  "sgi",   ( SaveFormatFlags.None ) ),
424
         } ;
425
426
         public static readonly SaveSubFormat[] Pdf1 = 
427
         {
428
            new SaveSubFormat( "Uncompressed",                RasterImageFormat.RasPdf,        "pdf",   ( SaveFormatFlags.MultiPage ) ),
429
            new SaveSubFormat( "Ccitt Group 3 - 1 Dimension", RasterImageFormat.RasPdfG31Dim,  "pdf",   ( SaveFormatFlags.MultiPage ) ),
430
            new SaveSubFormat( "Ccitt Group 3 - 2 Dimension", RasterImageFormat.RasPdfG32Dim,  "pdf",   ( SaveFormatFlags.MultiPage ) ),
431
            new SaveSubFormat( "Ccitt Group 4",               RasterImageFormat.RasPdfG4,      "pdf",   ( SaveFormatFlags.MultiPage ) ),
432
            new SaveSubFormat( "Lzw Rgb",                     RasterImageFormat.RasPdfLzw,     "pdf",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.QualityFactor ) ),
433
            new SaveSubFormat( "Jbig2",                       RasterImageFormat.RasPdfJbig2,   "pdf",   ( SaveFormatFlags.MultiPage ) ),
434
         } ;
435
436
         public static readonly SaveSubFormat[] Pdf2 = 
437
         {
438
            new SaveSubFormat( "Uncompressed", RasterImageFormat.RasPdf,    "pdf",  SaveFormatFlags.MultiPage ),
439
            new SaveSubFormat( "Lzw Rgb",      RasterImageFormat.RasPdfLzw, "pdf",  SaveFormatFlags.MultiPage ),
440
         } ;
441
442
         public static readonly SaveSubFormat[] Pdf4 = 
443
         {
444
            new SaveSubFormat( "Uncompressed", RasterImageFormat.RasPdf,    "pdf",  SaveFormatFlags.MultiPage ),
445
            new SaveSubFormat( "Lzw Rgb",      RasterImageFormat.RasPdfLzw, "pdf",  SaveFormatFlags.MultiPage ),
446
         };
447
448
         public static readonly SaveSubFormat[] Pdf8 = 
449
         {
450
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.RasPdf,     "pdf",   ( SaveFormatFlags.MultiPage ) ),
451
            new SaveSubFormat( "Lossless Jpeg",   RasterImageFormat.RasPdfJpeg, "pdf",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.LosslessJpeg ) ),
452
            new SaveSubFormat( "Lzw Rgb",         RasterImageFormat.RasPdfLzw,  "pdf",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.QualityFactor ) ),
453
         } ;
454
455
         public static readonly SaveSubFormat[] Pdf24 = 
456
         {
457
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.RasPdf,        "pdf",   ( SaveFormatFlags.MultiPage ) ),
458
            new SaveSubFormat( "Jpeg Yuv 4:4:4",  RasterImageFormat.RasPdfJpeg,    "pdf",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.QualityFactor ) ),
459
            new SaveSubFormat( "Jpeg Yuv 4:2:2",  RasterImageFormat.RasPdfJpeg422, "pdf",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.QualityFactor ) ),
460
            new SaveSubFormat( "Jpeg Yuv 4:1:1",  RasterImageFormat.RasPdfJpeg411, "pdf",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.QualityFactor ) ),
461
            new SaveSubFormat( "Lzw Rgb",         RasterImageFormat.RasPdfLzw,     "pdf",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.QualityFactor ) ),
462
            new SaveSubFormat( "LEAD Mrc",        RasterImageFormat.PdfLeadMrc,    "pdf",   ( SaveFormatFlags.None ) ),
463
            new SaveSubFormat( "Uncompressed CMYK",RasterImageFormat.RasPdfCmyk,   "pdf",   ( SaveFormatFlags.MultiPage ) ),
464
            new SaveSubFormat( "Lzw CMYK",        RasterImageFormat.RasPdfLzwCmyk ,"pdf",   ( SaveFormatFlags.MultiPage | SaveFormatFlags.QualityFactor) ),
465
         } ;
466
467
         public static readonly SaveSubFormat[] J2k = 
468
         {
469
            new SaveSubFormat( "Jpeg 2000 Stream",   RasterImageFormat.J2k,  "j2k",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor ) ),
470
            new SaveSubFormat( "JP2 File",           RasterImageFormat.Jp2,  "jp2",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor ) ),
471
            new SaveSubFormat( "JPX File",           RasterImageFormat.Jpx,  "jpx",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor ) ),
472
         } ;
473
474
         public static readonly SaveSubFormat[] J2k32 = 
475
         {
476
            new SaveSubFormat( "Jpeg 2000 Stream",   RasterImageFormat.J2k,  "j2k",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
477
            new SaveSubFormat( "JP2 File",           RasterImageFormat.Jp2,  "jp2",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
478
            new SaveSubFormat( "JPX File",           RasterImageFormat.Jpx,  "jpx",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
479
         } ;
480
481
         public static readonly SaveSubFormat[] J2k48 = 
482
         {
483
            new SaveSubFormat( "Jpeg 2000 Stream",   RasterImageFormat.J2k,  "j2k",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
484
            new SaveSubFormat( "JP2 File",           RasterImageFormat.Jp2,  "jp2",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
485
            new SaveSubFormat( "JPX File",           RasterImageFormat.Jpx,  "jpx",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
486
         } ;
487
488
         public static readonly SaveSubFormat[] J2k64 = 
489
         {
490
            new SaveSubFormat( "Jpeg 2000 Stream",   RasterImageFormat.J2k,  "j2k",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
491
            new SaveSubFormat( "JP2 File",           RasterImageFormat.Jp2,  "jp2",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
492
            new SaveSubFormat( "JPX File",           RasterImageFormat.Jpx,  "jpx",   ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel ) ),
493
         } ;
494
495
         public static readonly SaveSubFormat[] Tga = 
496
         {
497
            new SaveSubFormat( "Rle Compressed",  RasterImageFormat.TgaRle,  "tga",   ( SaveFormatFlags.None ) ),
498
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.Tga,     "tga",   ( SaveFormatFlags.None ) ),
499
         } ;
500
501
         public static readonly SaveSubFormat[] Ras = 
502
         {
503
            new SaveSubFormat( "Rle Compressed",  RasterImageFormat.RasRle,  "ras", ( SaveFormatFlags.None ) ),
504
            new SaveSubFormat( "Uncompressed",    RasterImageFormat.Ras,     "ras", ( SaveFormatFlags.None ) ),
505
         } ;
506
507
         public static readonly SaveSubFormat[] Xwd = 
508
         {
509
            new SaveSubFormat( "Version 10",   RasterImageFormat.Xwd10,   "xwd",   ( SaveFormatFlags.None ) ),
510
            new SaveSubFormat( "Version 11",   RasterImageFormat.Xwd11,   "xwd",   ( SaveFormatFlags.None ) ),
511
         } ;
512
513
         public static readonly SaveSubFormat[] Xwd11 = 
514
         {
515
            new SaveSubFormat( "Version 11",   RasterImageFormat.Xwd11,   "xwd",   ( SaveFormatFlags.None ) ),
516
         } ;
517
518
         public static readonly SaveSubFormat[] Hdp16 = 
519
         {
520
            new SaveSubFormat( "MS HDPhoto - Gray",   RasterImageFormat.HdpGray,   "hdp",   ( SaveFormatFlags.QualityFactor ) ),
521
            new SaveSubFormat( "MS HDPhoto - Rgb",    RasterImageFormat.Hdp,       "hdp",   ( SaveFormatFlags.QualityFactor ) ),
522
         };
523
524
         public static readonly SaveSubFormat[] Hdp32 = 
525
         {
526
            new SaveSubFormat( "MS HDPhoto - Rgb",    RasterImageFormat.Hdp,       "hdp",   ( SaveFormatFlags.QualityFactor ) ),
527
            new SaveSubFormat( "MS HDPhoto - Cmyk",   RasterImageFormat.HdpCmyk,   "hdp",   ( SaveFormatFlags.QualityFactor ) ),
528
         };
529
530
         public static readonly SaveSubFormat[] Xps1 = 
531
         {
532
            new SaveSubFormat( "CServe Png",       RasterImageFormat.Xps,      "xps",   ( SaveFormatFlags.XpsPngQualityFactor | SaveFormatFlags.MultiPage) ),
533
         };
534
535
         public static readonly SaveSubFormat[] Xps4 = 
536
         {
537
            new SaveSubFormat( "CServe Png",       RasterImageFormat.Xps,      "xps",   ( SaveFormatFlags.XpsPngQualityFactor | SaveFormatFlags.MultiPage) ),
538
         };
539
540
         public static readonly SaveSubFormat[] Xps8 = 
541
         {
542
            new SaveSubFormat( "CServe Png",       RasterImageFormat.Xps,      "xps",   ( SaveFormatFlags.XpsPngQualityFactor | SaveFormatFlags.MultiPage) ),
543
            new SaveSubFormat( "Jpeg Yuv 4:0:0",   RasterImageFormat.XpsJpeg,  "xps",   ( SaveFormatFlags.XpsJpegQualityFactor | SaveFormatFlags.MultiPage) ),
544
            new SaveSubFormat( "Jpeg Lossless",    RasterImageFormat.XpsJpeg,  "xps",   ( SaveFormatFlags.XpsJpegQualityFactor | SaveFormatFlags.LosslessJpeg | SaveFormatFlags.MultiPage) ),
545
         };
546
547
         public static readonly SaveSubFormat[] Xps24 = 
548
         {
549
            new SaveSubFormat( "CServe Png",       RasterImageFormat.Xps       ,  "xps",   ( SaveFormatFlags.XpsPngQualityFactor | SaveFormatFlags.MultiPage) ),
550
            new SaveSubFormat( "Jpeg Yuv 4:4:4",   RasterImageFormat.XpsJpeg   ,  "xps",   ( SaveFormatFlags.XpsJpegQualityFactor | SaveFormatFlags.MultiPage) ),
551
            new SaveSubFormat( "Jpeg Yuv 4:2:2",   RasterImageFormat.XpsJpeg422,  "xps",   ( SaveFormatFlags.XpsJpegQualityFactor | SaveFormatFlags.MultiPage) ),
552
            new SaveSubFormat( "Jpeg Yuv 4:1:1",   RasterImageFormat.XpsJpeg411,  "xps",   ( SaveFormatFlags.XpsJpegQualityFactor | SaveFormatFlags.MultiPage) ),
553
         };
554
555
         public static readonly SaveSubFormat[] Xps32 = 
556
         {
557
            new SaveSubFormat( "CServe Png",       RasterImageFormat.Xps,      "xps",   ( SaveFormatFlags.XpsPngQualityFactor | SaveFormatFlags.MultiPage) ),
558
         };
559
560
         public static readonly SaveSubFormat[] Mng1 = 
561
         {
562
            new SaveSubFormat( "PNG Gray",      RasterImageFormat.MngGray,  "mng",   ( SaveFormatFlags.MultiPage) ),
563
            new SaveSubFormat( "PNG",           RasterImageFormat.Mng,      "mng",   ( SaveFormatFlags.MultiPage) ),
564
         };
565
566
         public static readonly SaveSubFormat[] Mng2 = 
567
         {
568
            new SaveSubFormat( "PNG Gray",      RasterImageFormat.MngGray,  "mng",   ( SaveFormatFlags.MultiPage) ),
569
            new SaveSubFormat( "PNG",           RasterImageFormat.Mng,      "mng",   ( SaveFormatFlags.MultiPage) ),
570
         };
571
572
         public static readonly SaveSubFormat[] Mng4 = 
573
         {
574
            new SaveSubFormat( "PNG Gray",      RasterImageFormat.MngGray,  "mng",   ( SaveFormatFlags.MultiPage) ),
575
            new SaveSubFormat( "PNG",           RasterImageFormat.Mng,      "mng",   ( SaveFormatFlags.MultiPage) ),
576
         };
577
578
         public static readonly SaveSubFormat[] Mng8 = 
579
         {
580
            new SaveSubFormat( "PNG Gray",      RasterImageFormat.MngGray,  "mng",   ( SaveFormatFlags.MultiPage) ),
581
            new SaveSubFormat( "PNG",           RasterImageFormat.Mng,      "mng",   ( SaveFormatFlags.MultiPage) ),
582
            new SaveSubFormat( "JNG Lossless",  RasterImageFormat.MngJng,   "mng",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.LosslessJpeg) ),
583
            new SaveSubFormat( "JNG YUV 4:0:0", RasterImageFormat.MngJng,   "mng",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage) ),
584
         };
585
586
         public static readonly SaveSubFormat[] Mng16 = 
587
         {
588
            new SaveSubFormat( "PNG Gray",      RasterImageFormat.MngGray,  "mng",   ( SaveFormatFlags.MultiPage) ),
589
         };
590
591
         public static readonly SaveSubFormat[] Mng24 = 
592
         {
593
            new SaveSubFormat( "PNG",                       RasterImageFormat.Mng,       "mng",   ( SaveFormatFlags.MultiPage) ),
594
            new SaveSubFormat( "JNG YUV 4:4:4",             RasterImageFormat.MngJng,    "mng",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage) ),
595
            new SaveSubFormat( "JNG Progressive YUV 4:4:4", RasterImageFormat.MngJng,    "mng",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Progressive) ),
596
            new SaveSubFormat( "JNG YUV 4:1:1",             RasterImageFormat.MngJng411, "mng",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage) ),
597
            new SaveSubFormat( "JNG Progressive YUV 4:1:1", RasterImageFormat.MngJng411, "mng",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Progressive) ),
598
            new SaveSubFormat( "JNG YUV 4:2:2",             RasterImageFormat.MngJng422, "mng",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage) ),
599
            new SaveSubFormat( "JNG Progressive YUV 4:2:2", RasterImageFormat.MngJng422, "mng",   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.MultiPage | SaveFormatFlags.Progressive) ),
600
         };
601
602
         public static readonly SaveSubFormat[] Mng32 = 
603
         {
604
            new SaveSubFormat( "PNG",        RasterImageFormat.Mng,      "mng",   ( SaveFormatFlags.MultiPage) ),
605
         };
606
607
         public static readonly SaveSubFormat[] Mng48 = 
608
         {
609
            new SaveSubFormat( "PNG",        RasterImageFormat.Mng,      "mng",   ( SaveFormatFlags.MultiPage) ),
610
         };
611
612
         public static readonly SaveSubFormat[] Mng64 = 
613
         {
614
            new SaveSubFormat( "PNG",        RasterImageFormat.Mng,      "mng",   ( SaveFormatFlags.MultiPage) ),
615
         };
616
      }
617
618
      public struct SaveBitsPerPixelTable
619
      {
620
         private int _bitsPerPixel;
621
         private string _defaultExtensoin;
622
         private int _defaultSubFormatIndex;
623
         private SaveSubFormat[] _subFormats;
624
         private SaveFormatFlags _flags;
625
626
         public SaveBitsPerPixelTable(int bitsPerPixel, string defaultExtensoin, int defaultSubFormatIndex, SaveSubFormat[] subFormats, SaveFormatFlags flags)
627
         {
628
            _bitsPerPixel = bitsPerPixel;
629
            _defaultExtensoin = defaultExtensoin;
630
            _defaultSubFormatIndex = defaultSubFormatIndex;
631
            _subFormats = subFormats;
632
            _flags = flags;
633
         }
634
635
         public int BitsPerPixel
636
         {
637
            get { return _bitsPerPixel; }
638
         }
639
640
         public string DefaultExtensoin
641
         {
642
            get { return _defaultExtensoin; }
643
         }
644
645
         public int DefaultSubFormatIndex
646
         {
647
            get { return _defaultSubFormatIndex; }
648
         }
649
650
         public SaveSubFormat[] SubFormats
651
         {
652
            get { return _subFormats; }
653
         }
654
655
         public SaveFormatFlags Flags
656
         {
657
            get { return _flags; }
658
         }
659
660
         public override string ToString()
661
         {
662
            return string.Format("{0} Bits/Pixel", BitsPerPixel);
663
         }
664
665
        public static readonly SaveBitsPerPixelTable[] Cmp =   
666
         {
667
            new SaveBitsPerPixelTable( 1,  null, 0,  SaveSubFormat.Cmp1, ( SaveFormatFlags.None ) ),
668
            new SaveBitsPerPixelTable( 8,  null, 0,  SaveSubFormat.Cmp,  ( SaveFormatFlags.CmpQualityFactorPredefined | SaveFormatFlags.Stamp ) ),
669
            new SaveBitsPerPixelTable( 24, null, 0,  SaveSubFormat.Cmp,  ( SaveFormatFlags.CmpQualityFactorPredefined | SaveFormatFlags.Stamp ) ),
670
         } ;
671
672
         public static readonly SaveBitsPerPixelTable[] Jpeg =
673
         {
674
            new SaveBitsPerPixelTable( 8 , null,    0, SaveSubFormat.Jpeg8,   ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ),
675
            new SaveBitsPerPixelTable( 12, null,    0, SaveSubFormat.Jpeg12, ( SaveFormatFlags.Stamp ) ),
676
            new SaveBitsPerPixelTable( 16, "jpg",   0,                        null,       ( SaveFormatFlags.LosslessJpeg | SaveFormatFlags.Stamp ) ),
677
            new SaveBitsPerPixelTable( 24, null,    2, SaveSubFormat.Jpeg24, ( SaveFormatFlags.QualityFactor | SaveFormatFlags.Stamp ) ) ,
678
         } ;
679
680
         public static readonly SaveBitsPerPixelTable[] Cmw =
681
         {
682
            new SaveBitsPerPixelTable( 8,  "cmw",   0, null, ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.QualityFactor) ),
683
            new SaveBitsPerPixelTable( 12, "cmw",   0, null, ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.QualityFactor) ),
684
            new SaveBitsPerPixelTable( 16, "cmw",   0, null, ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.QualityFactor) ),
685
            new SaveBitsPerPixelTable( 24, "cmw",   0, null, ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.QualityFactor) ),
686
         } ;
687
688
         public static readonly SaveBitsPerPixelTable[] J2k =
689
         {
690
            new SaveBitsPerPixelTable( 8,  "null",  1, SaveSubFormat.J2k,       ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor ) ),
691
            new SaveBitsPerPixelTable( 12, "null",  1, SaveSubFormat.J2k,       ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor ) ),
692
            new SaveBitsPerPixelTable( 16, "null",  1, SaveSubFormat.J2k,       ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor ) ),
693
            new SaveBitsPerPixelTable( 24, "null",  1, SaveSubFormat.J2k,       ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor ) ),
694
            new SaveBitsPerPixelTable( 32, "null",  1, SaveSubFormat.J2k32,     ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel) ),
695
            new SaveBitsPerPixelTable( 48, "null",  1, SaveSubFormat.J2k48,     ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel) ),
696
            new SaveBitsPerPixelTable( 64, "null",  1, SaveSubFormat.J2k64,     ( SaveFormatFlags.Jpeg2000Basic | SaveFormatFlags.Jpeg2000Advanced | SaveFormatFlags.QualityFactor | SaveFormatFlags.Jpeg2000AlphaChannel) ),
697
         } ;
698
699
         public static readonly SaveBitsPerPixelTable[] Tif =
700
         {
701
            new SaveBitsPerPixelTable( 1,  "null",  3,      SaveSubFormat.Tiff1,     ( SaveFormatFlags.MultiPage ) ),
702
            new SaveBitsPerPixelTable( 2,  "null",  0, SaveSubFormat.TiffOther, ( SaveFormatFlags.MultiPage ) ),
703
            new SaveBitsPerPixelTable( 3,  "null",  0, SaveSubFormat.TiffOther, ( SaveFormatFlags.MultiPage ) ),
704
            new SaveBitsPerPixelTable( 4,  "null",  0,     SaveSubFormat.Tiff4, ( SaveFormatFlags.MultiPage ) ),
705
            new SaveBitsPerPixelTable( 5,  "null",  0, SaveSubFormat.TiffOther, ( SaveFormatFlags.MultiPage ) ),
706
            new SaveBitsPerPixelTable( 6,  "null",  0, SaveSubFormat.TiffOther, ( SaveFormatFlags.MultiPage ) ),
707
            new SaveBitsPerPixelTable( 7,  "null",  0, SaveSubFormat.TiffOther, ( SaveFormatFlags.MultiPage ) ),
708
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Tiff8,     ( SaveFormatFlags.MultiPage ) ),
709
            new SaveBitsPerPixelTable( 12, "null",  0, SaveSubFormat.Tiff12,    ( SaveFormatFlags.MultiPage ) ),
710
            new SaveBitsPerPixelTable( 16, "null",  0, SaveSubFormat.Tiff16,    ( SaveFormatFlags.MultiPage ) ),
711
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Tiff24,    ( SaveFormatFlags.MultiPage ) ),
712
            new SaveBitsPerPixelTable( 32, "null",  0, SaveSubFormat.Tiff32,    ( SaveFormatFlags.MultiPage ) ),
713
            new SaveBitsPerPixelTable( 48, "null",  0, SaveSubFormat.Tiff48,    ( SaveFormatFlags.MultiPage ) ),
714
            new SaveBitsPerPixelTable( 64, "null",  0, SaveSubFormat.Tiff64,    ( SaveFormatFlags.MultiPage ) ),
715
         } ;
716
717
         public static readonly SaveBitsPerPixelTable[] Gif =
718
         {
719
            new SaveBitsPerPixelTable( 1,  "null",  0, SaveSubFormat.Gif,       ( SaveFormatFlags.MultiPage ) ),
720
            new SaveBitsPerPixelTable( 2,  "null",  0, SaveSubFormat.Gif,       ( SaveFormatFlags.MultiPage ) ),
721
            new SaveBitsPerPixelTable( 3,  "null",  0, SaveSubFormat.Gif,       ( SaveFormatFlags.MultiPage ) ),
722
            new SaveBitsPerPixelTable( 4,  "null",  0, SaveSubFormat.Gif,       ( SaveFormatFlags.MultiPage ) ),
723
            new SaveBitsPerPixelTable( 5,  "null",  0, SaveSubFormat.Gif,       ( SaveFormatFlags.MultiPage ) ),
724
            new SaveBitsPerPixelTable( 6,  "null",  0, SaveSubFormat.Gif,       ( SaveFormatFlags.MultiPage ) ),
725
            new SaveBitsPerPixelTable( 7,  "null",  0, SaveSubFormat.Gif,       ( SaveFormatFlags.MultiPage ) ),
726
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Gif,       ( SaveFormatFlags.MultiPage ) ),
727
         } ;
728
729
         public static readonly SaveBitsPerPixelTable[] Png =
730
         {
731
            new SaveBitsPerPixelTable( 1,  "png",   0, null, ( SaveFormatFlags.PngQualityFactor ) ),
732
            new SaveBitsPerPixelTable( 4,  "png",   0, null, ( SaveFormatFlags.PngQualityFactor ) ),
733
            new SaveBitsPerPixelTable( 8,  "png",   0, null, ( SaveFormatFlags.PngQualityFactor ) ),
734
            new SaveBitsPerPixelTable( 24, "png",   0, null, ( SaveFormatFlags.PngQualityFactor ) ),
735
            new SaveBitsPerPixelTable( 32, "png",   0, null, ( SaveFormatFlags.PngQualityFactor ) ),
736
         } ;
737
738
         public static readonly SaveBitsPerPixelTable[] Ani =
739
         {
740
            new SaveBitsPerPixelTable( 1,  "ani",   0, null, ( SaveFormatFlags.MultiPage ) ),
741
            new SaveBitsPerPixelTable( 4,  "ani",   0, null, ( SaveFormatFlags.MultiPage ) ),
742
            new SaveBitsPerPixelTable( 8,  "ani",   0, null, ( SaveFormatFlags.MultiPage ) ),
743
            new SaveBitsPerPixelTable( 24, "ani",   0, null, ( SaveFormatFlags.MultiPage ) ),
744
         } ;
745
746
         public static readonly SaveBitsPerPixelTable[] Abic =
747
         {
748
            new SaveBitsPerPixelTable( 1,  "abic",   0, null, ( SaveFormatFlags.None ) ),
749
            new SaveBitsPerPixelTable( 4,  "abic",   0, null, ( SaveFormatFlags.None ) ),
750
         } ;
751
752
         public static readonly SaveBitsPerPixelTable[] Cals =
753
         {
754
            new SaveBitsPerPixelTable( 1 , "null",  0, SaveSubFormat.Cals, ( SaveFormatFlags.None ) ),
755
         } ;
756
757
         public static readonly SaveBitsPerPixelTable[] Cin =
758
         {
759
            new SaveBitsPerPixelTable( 24, "cin",   0, null, ( SaveFormatFlags.None ) ),
760
         } ;
761
762
         public static readonly SaveBitsPerPixelTable[] Clp =
763
         {
764
            new SaveBitsPerPixelTable( 1,  "clp",   0,                                       null,                     ( SaveFormatFlags.None ) ),
765
            new SaveBitsPerPixelTable( 4,  "clp",   0,                                       null,                     ( SaveFormatFlags.None ) ),
766
            new SaveBitsPerPixelTable( 8,  "null",  0,                                       SaveSubFormat.Clp, ( SaveFormatFlags.None ) ),
767
            new SaveBitsPerPixelTable( 24, "clp",   0,                                       null,                     ( SaveFormatFlags.None ) ),
768
         } ;
769
770
         public static readonly SaveBitsPerPixelTable[] Wmz =
771
         {
772
            new SaveBitsPerPixelTable( 24,  "wmz", 0, null, ( SaveFormatFlags.None ) ),
773
         } ;
774
775
         public static readonly SaveBitsPerPixelTable[] Cut =
776
         {
777
            new SaveBitsPerPixelTable( 8,  "cut",   0, null, ( SaveFormatFlags.None ) ),
778
         } ;
779
780
         public static readonly SaveBitsPerPixelTable[] Emf =
781
         {
782
            new SaveBitsPerPixelTable( 8,  "emf",   0, null, ( SaveFormatFlags.None ) ),
783
            new SaveBitsPerPixelTable( 24, "emf",   0, null, ( SaveFormatFlags.None ) ),
784
         } ;
785
786
      
787
         public static readonly SaveBitsPerPixelTable[] Ecw =
788
         {
789
            new SaveBitsPerPixelTable( 24,  "ecw",   0, null, ( SaveFormatFlags.EcwQualityFactor ) ),
790
         } ;
791
792
         public static readonly SaveBitsPerPixelTable[] Eps =
793
         {
794
            new SaveBitsPerPixelTable( 8,  "eps",   0, null, ( SaveFormatFlags.None ) ),
795
         } ;
796
797
         public static readonly SaveBitsPerPixelTable[] Exif =
798
         {
799
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Exif, ( SaveFormatFlags.Stamp ) ),
800
         } ;
801
802
         public static readonly SaveBitsPerPixelTable[] Fpx =
803
         {
804
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Fpx, ( SaveFormatFlags.MultiPage ) ),
805
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Fpx, ( SaveFormatFlags.MultiPage ) ),
806
         } ;
807
808
         public static readonly SaveBitsPerPixelTable[] Fax =
809
         {
810
            new SaveBitsPerPixelTable( 1,  "null",  0, SaveSubFormat.Fax, ( SaveFormatFlags.None ) ),
811
         } ;
812
813
         public static readonly SaveBitsPerPixelTable[] Fit =
814
         {
815
            new SaveBitsPerPixelTable( 8,  "fit",   0, null, ( SaveFormatFlags.None ) ),
816
            new SaveBitsPerPixelTable( 16, "fit",   0, null, ( SaveFormatFlags.None ) ),
817
            new SaveBitsPerPixelTable( 32, "fit",   0, null, ( SaveFormatFlags.None ) ),
818
         } ;
819
820
         public static readonly SaveBitsPerPixelTable[] Flc =
821
         {
822
            new SaveBitsPerPixelTable( 8,  "flc",   0, null, ( SaveFormatFlags.MultiPage ) ),
823
         } ;
824
825
         public static readonly SaveBitsPerPixelTable[] Img =
826
         {
827
            new SaveBitsPerPixelTable( 1,  "img",   0, null, ( SaveFormatFlags.None ) ),
828
         } ;
829
830
         public static readonly SaveBitsPerPixelTable[] GeoTiff =
831
         {
832
            new SaveBitsPerPixelTable( 1,  "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
833
            new SaveBitsPerPixelTable( 2,  "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
834
            new SaveBitsPerPixelTable( 3,  "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
835
            new SaveBitsPerPixelTable( 4,  "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
836
            new SaveBitsPerPixelTable( 5,  "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
837
            new SaveBitsPerPixelTable( 6,  "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
838
            new SaveBitsPerPixelTable( 7,  "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
839
            new SaveBitsPerPixelTable( 8,  "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
840
            new SaveBitsPerPixelTable( 12, "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
841
            new SaveBitsPerPixelTable( 16, "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
842
            new SaveBitsPerPixelTable( 24, "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
843
            new SaveBitsPerPixelTable( 32, "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
844
            new SaveBitsPerPixelTable( 48, "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
845
            new SaveBitsPerPixelTable( 64, "tif",   0, null, ( SaveFormatFlags.MultiPage ) ),
846
         } ;
847
848
         public static readonly SaveBitsPerPixelTable[] Iff =
849
         {
850
            new SaveBitsPerPixelTable( 1,  "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
851
            new SaveBitsPerPixelTable( 2,  "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
852
            new SaveBitsPerPixelTable( 3,  "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
853
            new SaveBitsPerPixelTable( 4,  "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
854
            new SaveBitsPerPixelTable( 5,  "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
855
            new SaveBitsPerPixelTable( 6,  "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
856
            new SaveBitsPerPixelTable( 7,  "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
857
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
858
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Iff, ( SaveFormatFlags.None ) ),
859
         } ;
860
861
         public static readonly SaveBitsPerPixelTable[] Modca =
862
         {
863
            new SaveBitsPerPixelTable( 1,  "null",  0, SaveSubFormat.Modca1, ( SaveFormatFlags.MultiPage ) ),
864
            new SaveBitsPerPixelTable( 4,  "null",  0,        SaveSubFormat.Modca4, ( SaveFormatFlags.None ) ),
865
         } ;
866
867
         public static readonly SaveBitsPerPixelTable[] Mrc =
868
         {
869
            new SaveBitsPerPixelTable( 24,  "null",  0, SaveSubFormat.Mrc, ( SaveFormatFlags.None ) ),
870
         } ;
871
872
         public static readonly SaveBitsPerPixelTable[] Awd =
873
         {
874
            new SaveBitsPerPixelTable( 1,  "awd",   0, null, ( SaveFormatFlags.None ) ),
875
         } ;
876
      
877
878
         public static readonly SaveBitsPerPixelTable[] Itg =
879
         {
880
            new SaveBitsPerPixelTable( 1 , "null",  1, SaveSubFormat.Itg, ( SaveFormatFlags.None ) ),
881
         } ;
882
883
         public static readonly SaveBitsPerPixelTable[] Jbig =
884
         {
885
            new SaveBitsPerPixelTable( 1,  "jbg",   0, null, ( SaveFormatFlags.Progressive ) ),
886
            new SaveBitsPerPixelTable( 2,  "jbg",   0, null, ( SaveFormatFlags.Progressive ) ),
887
            new SaveBitsPerPixelTable( 3,  "jbg",   0, null, ( SaveFormatFlags.Progressive ) ),
888
            new SaveBitsPerPixelTable( 4,  "jbg",   0, null, ( SaveFormatFlags.Progressive ) ),
889
            new SaveBitsPerPixelTable( 5,  "jbg",   0, null, ( SaveFormatFlags.Progressive ) ),
890
            new SaveBitsPerPixelTable( 6,  "jbg",   0, null, ( SaveFormatFlags.Progressive ) ),
891
            new SaveBitsPerPixelTable( 7,  "jbg",   0, null, ( SaveFormatFlags.Progressive ) ),
892
            new SaveBitsPerPixelTable( 8,  "jbg",   0, null, ( SaveFormatFlags.Progressive ) ),
893
         } ;
894
895
         public static readonly SaveBitsPerPixelTable[] Jbig2 =
896
         {
897
            new SaveBitsPerPixelTable( 1,  "jb2",   0, null, ( SaveFormatFlags.Jbig2Support ) ),
898
         } ;
899
900
         public static readonly SaveBitsPerPixelTable[] Abc =
901
         {
902
            new SaveBitsPerPixelTable( 1,  "abc",   0, null, ( SaveFormatFlags.AbcQualityFactor ) ),
903
         } ;
904
905
         public static readonly SaveBitsPerPixelTable[] Mac =
906
         {
907
            new SaveBitsPerPixelTable( 1,  "mac", 0, null, ( SaveFormatFlags.None ) ),
908
         } ;
909
910
         public static readonly SaveBitsPerPixelTable[] Pct =
911
         {
912
            new SaveBitsPerPixelTable( 1, "pct", 0, null, ( SaveFormatFlags.None ) ),
913
            new SaveBitsPerPixelTable( 4, "pct", 0, null, ( SaveFormatFlags.None ) ),
914
            new SaveBitsPerPixelTable( 8, "pct", 0, null, ( SaveFormatFlags.None ) ),
915
            new SaveBitsPerPixelTable( 16, "pct", 0, null, ( SaveFormatFlags.None ) ),
916
            new SaveBitsPerPixelTable( 24, "pct", 0, null, ( SaveFormatFlags.None ) ),
917
         } ;
918
919
         public static readonly SaveBitsPerPixelTable[] RawIca =
920
         {
921
            new SaveBitsPerPixelTable( 1,  "null", 3, SaveSubFormat.RawIca, ( SaveFormatFlags.None ) ),
922
         } ;
923
924
         public static readonly SaveBitsPerPixelTable[] Wfx =
925
         {
926
            new SaveBitsPerPixelTable( 1,  "null", 0, SaveSubFormat.Wfx, ( SaveFormatFlags.None ) ),
927
         } ;
928
929
         public static readonly SaveBitsPerPixelTable[] Msp =
930
         {
931
            new SaveBitsPerPixelTable( 1,  "msp",   0, null, ( SaveFormatFlags.None ) ),
932
         } ;
933
934
         public static readonly SaveBitsPerPixelTable[] Os2 =
935
         {
936
            new SaveBitsPerPixelTable( 1,  "null",  0, SaveSubFormat.Os2, ( SaveFormatFlags.None ) ),
937
            new SaveBitsPerPixelTable( 4,  "null",  0, SaveSubFormat.Os2, ( SaveFormatFlags.None ) ),
938
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Os2, ( SaveFormatFlags.None ) ),
939
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Os2, ( SaveFormatFlags.None ) ),
940
         } ;
941
942
         public static readonly SaveBitsPerPixelTable[] Pbm =
943
         {
944
            new SaveBitsPerPixelTable( 1, "null", 1, SaveSubFormat.Pbm, ( SaveFormatFlags.None ) ),
945
         } ;
946
947
         public static readonly SaveBitsPerPixelTable[] Pcx =
948
         {
949
            new SaveBitsPerPixelTable( 1,  "pcx",   0, null, ( SaveFormatFlags.MultiPage ) ),
950
            new SaveBitsPerPixelTable( 4,  "pcx",   0, null, ( SaveFormatFlags.MultiPage ) ),
951
            new SaveBitsPerPixelTable( 8,  "pcx",   0, null, ( SaveFormatFlags.MultiPage ) ),
952
            new SaveBitsPerPixelTable( 24, "pcx",   0, null, ( SaveFormatFlags.MultiPage ) ),
953
         } ;
954
955
         public static readonly SaveBitsPerPixelTable[] Pdf =
956
         {
957
            new SaveBitsPerPixelTable( 1,  "null",  3,  SaveSubFormat.Pdf1,  ( SaveFormatFlags.MultiPage ) ),
958
            new SaveBitsPerPixelTable( 2,  "null",  0,       SaveSubFormat.Pdf2,  ( SaveFormatFlags.MultiPage ) ),
959
            new SaveBitsPerPixelTable( 4,  "null",  0,       SaveSubFormat.Pdf4,  ( SaveFormatFlags.MultiPage ) ),
960
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Pdf8,  ( SaveFormatFlags.MultiPage ) ),
961
            new SaveBitsPerPixelTable( 24, "null",  3,  SaveSubFormat.Pdf24, ( SaveFormatFlags.MultiPage ) ),
962
         } ;
963
964
         public static readonly SaveBitsPerPixelTable[] Pgm =
965
         {
966
            new SaveBitsPerPixelTable( 8, "null", 1, SaveSubFormat.Pgm, ( SaveFormatFlags.None ) ),
967
         } ;
968
969
         public static readonly SaveBitsPerPixelTable[] Ppm =
970
         {
971
            new SaveBitsPerPixelTable( 24, "null",  1, SaveSubFormat.Ppm, ( SaveFormatFlags.None ) ),
972
         } ;
973
974
         public static readonly SaveBitsPerPixelTable[] Psd =
975
         {
976
            new SaveBitsPerPixelTable( 1,  "psd",   0, null, ( SaveFormatFlags.None ) ),
977
            new SaveBitsPerPixelTable( 8,  "psd",   0, null, ( SaveFormatFlags.None ) ),
978
            new SaveBitsPerPixelTable( 24, "psd",   0, null, ( SaveFormatFlags.None ) ),
979
         } ;
980
981
         //public static readonly SaveBitsPerPixelTable[] Psp =
982
         //{
983
         //   new SaveBitsPerPixelTable( 1,  "null",  ( L_Int ) PspSubTypesIndex::Uncompressed, SaveSubFormat.Psp, ( SaveFormatFlags.None ) ),
984
         //   new SaveBitsPerPixelTable( 4,  "null",  ( L_Int ) PspSubTypesIndex::Uncompressed, SaveSubFormat.Psp, ( SaveFormatFlags.None ) ),
985
         //   new SaveBitsPerPixelTable( 8,  "null",  ( L_Int ) PspSubTypesIndex::Uncompressed, SaveSubFormat.Psp, ( SaveFormatFlags.None ) ),
986
         //   new SaveBitsPerPixelTable( 24, "null",  ( L_Int ) PspSubTypesIndex::Uncompressed, SaveSubFormat.Psp, ( SaveFormatFlags.None ) ),
987
         //} ;
988
989
         public static readonly SaveBitsPerPixelTable[] Raw =
990
         {
991
            new SaveBitsPerPixelTable( 0, "raw",   0, null, ( SaveFormatFlags.None ) ),
992
         } ;
993
994
         public static readonly SaveBitsPerPixelTable[] Sct =
995
         {
996
            new SaveBitsPerPixelTable( 24, "sct",   0, null, ( SaveFormatFlags.None ) ),
997
         } ;
998
999
         public static readonly SaveBitsPerPixelTable[] Sgi =
1000
         {
1001
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Sgi, ( SaveFormatFlags.None ) ),
1002
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Sgi, ( SaveFormatFlags.None ) ),
1003
            new SaveBitsPerPixelTable( 32, "null",  0, SaveSubFormat.Sgi, ( SaveFormatFlags.None ) ),
1004
         } ;
1005
1006
         public static readonly SaveBitsPerPixelTable[] Sff =
1007
         {
1008
            new SaveBitsPerPixelTable( 1,  "sff",   0, null, ( SaveFormatFlags.None ) ),
1009
         } ;
1010
1011
         public static readonly SaveBitsPerPixelTable[] Ras =
1012
         {
1013
            new SaveBitsPerPixelTable( 1,  "null",  0, SaveSubFormat.Ras, ( SaveFormatFlags.None ) ),
1014
            new SaveBitsPerPixelTable( 4,  "null",  0, SaveSubFormat.Ras, ( SaveFormatFlags.None ) ),
1015
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Ras, ( SaveFormatFlags.None ) ),
1016
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Ras, ( SaveFormatFlags.None ) ),
1017
            new SaveBitsPerPixelTable( 32, "null",  0, SaveSubFormat.Ras, ( SaveFormatFlags.None ) ),
1018
         } ;
1019
1020
         public static readonly SaveBitsPerPixelTable[] Tga =
1021
         {
1022
            new SaveBitsPerPixelTable( 8 , "null",  0, SaveSubFormat.Tga, ( SaveFormatFlags.None ) ),
1023
            new SaveBitsPerPixelTable( 16, "null",  0, SaveSubFormat.Tga, ( SaveFormatFlags.None ) ),
1024
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Tga, ( SaveFormatFlags.None ) ),
1025
            new SaveBitsPerPixelTable( 32, "null",  0, SaveSubFormat.Tga, ( SaveFormatFlags.None ) ),
1026
         } ;
1027
1028
         public static readonly SaveBitsPerPixelTable[] Tifx =
1029
         {
1030
            new SaveBitsPerPixelTable( 1 , "null",  0,       SaveSubFormat.Tifx1, ( SaveFormatFlags.None ) ),
1031
            new SaveBitsPerPixelTable( 3,  "null",  0,  SaveSubFormat.Tifx3, ( SaveFormatFlags.None ) ),
1032
            new SaveBitsPerPixelTable( 8,  "null",  0,  SaveSubFormat.Tifx8, ( SaveFormatFlags.None ) ),
1033
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Tifx24, ( SaveFormatFlags.None ) ),
1034
         } ;
1035
1036
         public static readonly SaveBitsPerPixelTable[] Bmp =
1037
         {
1038
            new SaveBitsPerPixelTable( 1,  "bmp",   0,                                       null,                     ( SaveFormatFlags.None ) ),
1039
            new SaveBitsPerPixelTable( 4,  "null",  0, SaveSubFormat.Bmp, ( SaveFormatFlags.None ) ),
1040
            new SaveBitsPerPixelTable( 8,  "null",  0, SaveSubFormat.Bmp, ( SaveFormatFlags.None ) ),
1041
            new SaveBitsPerPixelTable( 16, "bmp",   0,                                       null,                     ( SaveFormatFlags.None ) ),
1042
            new SaveBitsPerPixelTable( 24, "bmp",   0,                                       null,                     ( SaveFormatFlags.None ) ),
1043
            new SaveBitsPerPixelTable( 32, "bmp",   0,                                       null,                     ( SaveFormatFlags.None ) ),
1044
         } ;
1045
1046
         public static readonly SaveBitsPerPixelTable[] Cur =
1047
         {
1048
            new SaveBitsPerPixelTable( 1,  "cur",   0, null, ( SaveFormatFlags.MultiPage ) ),
1049
            new SaveBitsPerPixelTable( 4,  "cur",   0, null, ( SaveFormatFlags.MultiPage ) ),
1050
            new SaveBitsPerPixelTable( 8,  "cur",   0, null, ( SaveFormatFlags.MultiPage ) ),
1051
            new SaveBitsPerPixelTable( 24, "cur",   0, null, ( SaveFormatFlags.MultiPage ) ),
1052
         } ;
1053
1054
1055
         public static readonly SaveBitsPerPixelTable[] Ico =
1056
         {
1057
            new SaveBitsPerPixelTable( 1,  "ico",   0, null, ( SaveFormatFlags.MultiPage ) ),
1058
            new SaveBitsPerPixelTable( 4,  "ico",   0, null, ( SaveFormatFlags.MultiPage ) ),
1059
            new SaveBitsPerPixelTable( 8,  "ico",   0, null, ( SaveFormatFlags.MultiPage ) ),
1060
            new SaveBitsPerPixelTable( 24, "ico",   0, null, ( SaveFormatFlags.MultiPage ) ),
1061
         } ;
1062
1063
         public static readonly SaveBitsPerPixelTable[] Wbmp =
1064
         {
1065
            new SaveBitsPerPixelTable( 1,  "wbmp",  0, null, ( SaveFormatFlags.None ) ),
1066
         } ;
1067
1068
         public static readonly SaveBitsPerPixelTable[] Wmf =
1069
         {
1070
            new SaveBitsPerPixelTable( 8,  "wmf",   0, null, ( SaveFormatFlags.None ) ),
1071
            new SaveBitsPerPixelTable( 24, "wmf",   0, null, ( SaveFormatFlags.None ) ),
1072
         } ;
1073
1074
         public static readonly SaveBitsPerPixelTable[] Wpg =
1075
         {
1076
            new SaveBitsPerPixelTable( 1,  "wpg",   0, null, ( SaveFormatFlags.None ) ),
1077
            new SaveBitsPerPixelTable( 4,  "wpg",   0, null, ( SaveFormatFlags.None ) ),
1078
            new SaveBitsPerPixelTable( 8,  "wpg",   0, null, ( SaveFormatFlags.None ) ),
1079
         } ;
1080
1081
1082
         public static readonly SaveBitsPerPixelTable[] Xbm =
1083
         {
1084
            new SaveBitsPerPixelTable( 1,  "xbm",   0, null, ( SaveFormatFlags.None ) ),
1085
         } ;
1086
1087
         public static readonly SaveBitsPerPixelTable[] Smp =
1088
         {
1089
            new SaveBitsPerPixelTable( 1,  "null",  2, SaveSubFormat.Smp, ( SaveFormatFlags.None ) ),
1090
         } ;
1091
1092
         public static readonly SaveBitsPerPixelTable[] Xpm =
1093
         {
1094
            new SaveBitsPerPixelTable( 8,  "xpm",   0, null, ( SaveFormatFlags.None ) ),
1095
            new SaveBitsPerPixelTable( 16, "xpm",   0, null, ( SaveFormatFlags.None ) ),
1096
            new SaveBitsPerPixelTable( 24, "xpm",   0, null, ( SaveFormatFlags.None ) ),
1097
            new SaveBitsPerPixelTable( 32, "xpm",   0, null, ( SaveFormatFlags.None ) ),
1098
         } ;
1099
1100
         public static readonly SaveBitsPerPixelTable[] Xwd =
1101
         {
1102
            new SaveBitsPerPixelTable( 1,  "null",  1, SaveSubFormat.Xwd,   ( SaveFormatFlags.None ) ),
1103
            new SaveBitsPerPixelTable( 4,  "null",  1, SaveSubFormat.Xwd,   ( SaveFormatFlags.None ) ),
1104
            new SaveBitsPerPixelTable( 8,  "null",  1, SaveSubFormat.Xwd,   ( SaveFormatFlags.None ) ),
1105
            new SaveBitsPerPixelTable( 16, "null",  0, SaveSubFormat.Xwd11, ( SaveFormatFlags.None ) ),
1106
            new SaveBitsPerPixelTable( 24, "null",  0, SaveSubFormat.Xwd11, ( SaveFormatFlags.None ) ),
1107
            new SaveBitsPerPixelTable( 32, "null",  0, SaveSubFormat.Xwd11, ( SaveFormatFlags.None ) ),
1108
         } ;
1109
1110
         public static readonly SaveBitsPerPixelTable[] Hdp =
1111
         {
1112
            new SaveBitsPerPixelTable( 1,   "hdp",  0,  null,                     ( SaveFormatFlags.QualityFactor ) ),
1113
            new SaveBitsPerPixelTable( 8,   "hdp",  1, null,                     ( SaveFormatFlags.QualityFactor ) ),
1114
            new SaveBitsPerPixelTable( 16,  "hdp",  0,                                            SaveSubFormat.Hdp16,  ( SaveFormatFlags.QualityFactor ) ),
1115
            new SaveBitsPerPixelTable( 24,  "hdp",  0,  null,                     ( SaveFormatFlags.QualityFactor ) ),
1116
            new SaveBitsPerPixelTable( 32,  "hdp",  0,                                            SaveSubFormat.Hdp32,  ( SaveFormatFlags.QualityFactor ) ),
1117
            new SaveBitsPerPixelTable( 48,  "hdp",  0,  null,                     ( SaveFormatFlags.QualityFactor ) ),
1118
            new SaveBitsPerPixelTable( 64,  "hdp",  0,  null,                     ( SaveFormatFlags.QualityFactor ) ),
1119
         } ;
1120
1121
         public static readonly SaveBitsPerPixelTable[] PngIco =
1122
         {
1123
            new SaveBitsPerPixelTable( 1,   "ico",  0, null,  ( SaveFormatFlags.MultiPage ) ),
1124
            new SaveBitsPerPixelTable( 4,   "ico",  0, null,  ( SaveFormatFlags.MultiPage ) ),
1125
            new SaveBitsPerPixelTable( 8,   "ico",  0, null,  ( SaveFormatFlags.MultiPage ) ),
1126
            new SaveBitsPerPixelTable( 24,  "ico",  0, null,  ( SaveFormatFlags.MultiPage ) ),
1127
            new SaveBitsPerPixelTable( 32,  "ico",  0, null,  ( SaveFormatFlags.MultiPage ) ),
1128
         } ;
1129
1130
         public static readonly SaveBitsPerPixelTable[] Xps =
1131
         {
1132
            new SaveBitsPerPixelTable( 1,   "xps", 0,                                             SaveSubFormat.Xps1,  ( SaveFormatFlags.XpsPngQualityFactor | SaveFormatFlags.MultiPage) ),
1133
            new SaveBitsPerPixelTable( 4,   "xps", 0,                                             SaveSubFormat.Xps4,  ( SaveFormatFlags.XpsPngQualityFactor | SaveFormatFlags.MultiPage) ),
1134
            new SaveBitsPerPixelTable( 8,   "xps", 0,   SaveSubFormat.Xps8,  ( SaveFormatFlags.XpsJpegQualityFactor | SaveFormatFlags.MultiPage) ),
1135
            new SaveBitsPerPixelTable( 24,  "xps", 0,  SaveSubFormat.Xps24, ( SaveFormatFlags.XpsJpegQualityFactor | SaveFormatFlags.MultiPage) ),
1136
            new SaveBitsPerPixelTable( 32,  "xps", 0,                                             SaveSubFormat.Xps32, ( SaveFormatFlags.XpsPngQualityFactor | SaveFormatFlags.MultiPage) ),
1137
         } ;
1138
1139
         public static readonly SaveBitsPerPixelTable[] Mng =
1140
         {
1141
            new SaveBitsPerPixelTable( 1,   "mng", 1,   SaveSubFormat.Mng1,  ( SaveFormatFlags.MultiPage) ),
1142
            new SaveBitsPerPixelTable( 2,   "mng", 1,   SaveSubFormat.Mng2,  ( SaveFormatFlags.MultiPage) ),
1143
            new SaveBitsPerPixelTable( 4,   "mng", 1,   SaveSubFormat.Mng4,  ( SaveFormatFlags.MultiPage) ),
1144
            new SaveBitsPerPixelTable( 8,   "mng", 1,   SaveSubFormat.Mng8,  ( SaveFormatFlags.MultiPage) ),
1145
            new SaveBitsPerPixelTable( 16,  "mng", 0,                                             SaveSubFormat.Mng16, ( SaveFormatFlags.MultiPage) ),
1146
            new SaveBitsPerPixelTable( 24,  "mng", 0,  SaveSubFormat.Mng24, ( SaveFormatFlags.MultiPage) ),
1147
            new SaveBitsPerPixelTable( 32,  "mng", 0,                                             SaveSubFormat.Mng32, ( SaveFormatFlags.MultiPage) ),
1148
            new SaveBitsPerPixelTable( 48,  "mng", 0,                                             SaveSubFormat.Mng48, ( SaveFormatFlags.MultiPage) ),
1149
            new SaveBitsPerPixelTable( 64,  "mng", 0,                                             SaveSubFormat.Mng64, ( SaveFormatFlags.MultiPage) ),
1150
         } ;
1151
      };
1152
1153
      public struct SaveFileType
1154
      {
1155
         private string _name;
1156
         private string _extensions;
1157
         private RasterImageFormat _format;
1158
         private int _defaultBitsPerPixel;
1159
         private SaveBitsPerPixelTable[] _bitsPerPixelTable;
1160
1161
         public SaveFileType(string name, string extensions, RasterImageFormat format, int defaultBitsPerPixel, SaveBitsPerPixelTable[] bitsPerPixelTable)
1162
         {
1163
            _name = name;
1164
            _extensions = extensions;
1165
            _format = format;
1166
            _defaultBitsPerPixel = defaultBitsPerPixel;
1167
            _bitsPerPixelTable = bitsPerPixelTable;
1168
         }
1169
1170
         public string Name
1171
         {
1172
            get { return _name; }
1173
         }
1174
1175
         public string Extensions
1176
         {
1177
            get { return _extensions; }
1178
         }
1179
1180
         public RasterImageFormat Format
1181
         {
1182
            get { return _format; }
1183
         }
1184
1185
         public int DefaultBitsPerPixel
1186
         {
1187
            get { return _defaultBitsPerPixel; }
1188
         }
1189
1190
         public SaveBitsPerPixelTable[] BitsPerPixelTable
1191
         {
1192
            get { return _bitsPerPixelTable; }
1193
         }
1194
1195
         public override string ToString()
1196
         {
1197
            return string.Format("{0} ({1})", Name, Extensions);
1198
         }
1199
1200
         public static readonly SaveFileType[] Entries =
1201
         {
1202
            // LEAD Constant formats order
1203
         new SaveFileType( "LEAD",                            "*.cmp",         RasterImageFormat.Cmp,           24, SaveBitsPerPixelTable.Cmp),
1204
         new SaveFileType( "Jpeg",                            "*.jpg",         RasterImageFormat.Jpeg,          24, SaveBitsPerPixelTable.Jpeg),
1205
         new SaveFileType( "LEAD Wavelet",                    "*.cmw",         RasterImageFormat.Cmw,           24, SaveBitsPerPixelTable.Cmw),
1206
         new SaveFileType( "Jpeg 2000;*.jp2;*.jpx",           "*.j2k;*.jp2;*.jpx",         RasterImageFormat.J2k,           24, SaveBitsPerPixelTable.J2k),
1207
         new SaveFileType( "Tif",                             "*.tif",         RasterImageFormat.Tif,           24, SaveBitsPerPixelTable.Tif),
1208
         new SaveFileType( "CompuServe Gif",                  "*.gif",         RasterImageFormat.Gif,           8,  SaveBitsPerPixelTable.Gif),
1209
         new SaveFileType( "CServe Png",                      "*.png",         RasterImageFormat.Png,           32, SaveBitsPerPixelTable.Png),
1210
         new SaveFileType( "Windows Bitmap",                  "*.bmp",         RasterImageFormat.Bmp,           24, SaveBitsPerPixelTable.Bmp),
1211
1212
            // +++ "A" +++
1213
         new SaveFileType( "LEAD Advanced Bitonal Compression",    "*.abc",    RasterImageFormat.Abc,           1,  SaveBitsPerPixelTable.Abc),
1214
         new SaveFileType( "Adaptive bi-level image Compression", "*.abic",   RasterImageFormat.Abic,          1,  SaveBitsPerPixelTable.Abic),
1215
         new SaveFileType( "Animated Cursor",                 "*.ani",         RasterImageFormat.Ani,           24, SaveBitsPerPixelTable.Ani),
1216
1217
            // +++ "C" +++
1218
         new SaveFileType( "Cals",                            "*.cal",         RasterImageFormat.Cals,          1,  SaveBitsPerPixelTable.Cals),
1219
         new SaveFileType( "Cineon",                          "*.cin",         RasterImageFormat.Cin,           24, SaveBitsPerPixelTable.Cin),
1220
         new SaveFileType( "Clipboard",                       "*.clp",         RasterImageFormat.Clp,           24, SaveBitsPerPixelTable.Clp),
1221
         new SaveFileType( "Compressed Windows Metafile",     "*.wmz",         RasterImageFormat.Wmz,           24, SaveBitsPerPixelTable.Wmz),
1222
1223
            // +++ "D" +++
1224
         new SaveFileType( "Dr Halo",                         "*.cut",         RasterImageFormat.Cut,           8,  SaveBitsPerPixelTable.Cut),
1225
1226
            // +++ "E" +++
1227
         new SaveFileType( "Ecw",                             "*.ecw",         RasterImageFormat.Ecw,           24, SaveBitsPerPixelTable.Ecw),
1228
         new SaveFileType( "Eps",                             "*.eps",         RasterImageFormat.Eps,           8,  SaveBitsPerPixelTable.Eps),
1229
         new SaveFileType( "Exif",                            "*.tif",         RasterImageFormat.Exif,          24, SaveBitsPerPixelTable.Exif),
1230
1231
            // +++ "F" +++
1232
         new SaveFileType( "Fax (Raw)",                       "*.fax",         RasterImageFormat.FaxG4,         1,  SaveBitsPerPixelTable.Fax),
1233
         new SaveFileType( "Flexible Image Transport System", "*.fit",         RasterImageFormat.Fit,           32, SaveBitsPerPixelTable.Fit),
1234
         new SaveFileType( "Flc",                             "*.flc",         RasterImageFormat.Flc,           8,  SaveBitsPerPixelTable.Flc),
1235
         new SaveFileType( "Fpx",                             "*.fpx",         RasterImageFormat.Fpx,           24, SaveBitsPerPixelTable.Fpx),
1236
1237
            // +++ "G" +++
1238
         new SaveFileType( "Gem",                              "*.img",        RasterImageFormat.Img,           1,  SaveBitsPerPixelTable.Img),
1239
         new SaveFileType( "GeoTiff",                          "*.tif",        RasterImageFormat.GeoTiff,       16, SaveBitsPerPixelTable.GeoTiff),
1240
1241
            // +++ "I" +++
1242
         new SaveFileType( "Iff",                              "*.iff",        RasterImageFormat.IffIlbm,       24, SaveBitsPerPixelTable.Iff),
1243
         new SaveFileType( "Itg",                              "*.itg",        RasterImageFormat.IntergraphRle, 1,  SaveBitsPerPixelTable.Itg),
1244
1245
            // +++ "J" +++
1246
         new SaveFileType( "Jbig",                             "*.jbg",        RasterImageFormat.Jbig,          8,  SaveBitsPerPixelTable.Jbig),
1247
         new SaveFileType( "Jbig2",                            "*.jb2",        RasterImageFormat.Jbig2,         1,  SaveBitsPerPixelTable.Jbig2),
1248
1249
         // +++ "M" +++
1250
         new SaveFileType( "MacPaint",                         "*.mac",        RasterImageFormat.Mac,           1,  SaveBitsPerPixelTable.Mac),
1251
         new SaveFileType( "Mac PICT",                         "*.pct",        RasterImageFormat.Pct,           24, SaveBitsPerPixelTable.Pct),
1252
         new SaveFileType( "Modca:Ioca",                       "*.ica",        RasterImageFormat.IcaG4,         1,  SaveBitsPerPixelTable.Modca),
1253
         new SaveFileType( "Mrc",                              "*.mrc",        RasterImageFormat.Mrc,           24, SaveBitsPerPixelTable.Mrc),
1254
#if FOR_WIN64
1255
         new SaveFileType( "MS Fax (Awd)",                     "*.awd",        RasterImageFormat.Awd,           1,  SaveBitsPerPixelTable.Awd),
1256
#endif // FOR_WIN64
1257
         new SaveFileType( "MS Paint",                         "*.msp",        RasterImageFormat.Msp,           1,  SaveBitsPerPixelTable.Msp),
1258
1259
            // +++ "O" +++
1260
         new SaveFileType( "OS/2 Bitmap",                      "*.bmp",        RasterImageFormat.Os2,           24, SaveBitsPerPixelTable.Os2),
1261
1262
            // +++ "P" +++
1263
         new SaveFileType( "Pbm",                              "*.pbm",        RasterImageFormat.PbmAscii,      1,  SaveBitsPerPixelTable.Pbm),
1264
         new SaveFileType( "Pcx",                              "*.pcx",        RasterImageFormat.Pcx,           24, SaveBitsPerPixelTable.Pcx),
1265
         new SaveFileType( "Pdf",                              "*.pdf",        RasterImageFormat.RasPdf,        24, SaveBitsPerPixelTable.Pdf),
1266
         new SaveFileType( "Pgm",                              "*.pgm",        RasterImageFormat.PgmAscii,      8,  SaveBitsPerPixelTable.Pgm),
1267
         new SaveFileType( "Ppm",                              "*.ppm",        RasterImageFormat.PpmAscii,      24, SaveBitsPerPixelTable.Ppm),
1268
         new SaveFileType( "Psd",                              "*.psd",        RasterImageFormat.Psd,           24, SaveBitsPerPixelTable.Psd),
1269
//         new SaveFileType( "Psp",                              "*.psp",        RasterImageFormat.Psp,           24, SaveBitsPerPixelTable.Psp),
1270
1271
            // +++ "R" +++
1272
         new SaveFileType( "Raw data",                         "*.raw",        RasterImageFormat.Raw,           0,  SaveBitsPerPixelTable.Raw),
1273
         new SaveFileType( "Raw Ioca",                         "*.ica",        RasterImageFormat.RawIcaG4,      1,  SaveBitsPerPixelTable.RawIca),
1274
1275
            // +++ "" +++
1276
         new SaveFileType( "Scitex Continuous Tone Sct",       "*.sct",        RasterImageFormat.Sct,           24, SaveBitsPerPixelTable.Sct),
1277
         new SaveFileType( "Sgi",                              "*.sgi",        RasterImageFormat.Sgi,           32, SaveBitsPerPixelTable.Sgi),
1278
         new SaveFileType( "Structured Fax File",              "*.sff",        RasterImageFormat.Sff,           1,  SaveBitsPerPixelTable.Sff),
1279
         new SaveFileType( "Sun Raster",                       "*.ras",        RasterImageFormat.Ras,           32, SaveBitsPerPixelTable.Ras),
1280
1281
            // +++ "T" +++ 
1282
         new SaveFileType( "Tga",                              "*.tga",        RasterImageFormat.Tga,           32, SaveBitsPerPixelTable.Tga),
1283
         new SaveFileType( "Tifx",                            "*.tifx",       RasterImageFormat.Jpeg,          24, SaveBitsPerPixelTable.Tifx),
1284
1285
            // +++ "W" +++
1286
         new SaveFileType( "Windows Cursor",                   "*.cur",        RasterImageFormat.WinCur,        24, SaveBitsPerPixelTable.Cur),
1287
         new SaveFileType( "Windows Enhanced Metafile",        "*.emf",        RasterImageFormat.Emf,           24, SaveBitsPerPixelTable.Emf),
1288
         new SaveFileType( "Windows Icon",                     "*.ico",        RasterImageFormat.WinIco,        24, SaveBitsPerPixelTable.Ico),
1289
         new SaveFileType( "Windows Metafile",                 "*.wmf",        RasterImageFormat.Wmf,           24, SaveBitsPerPixelTable.Wmf),
1290
         new SaveFileType( "WinFax",                           "*.wfx",        RasterImageFormat.WfxG31Dim,     1,  SaveBitsPerPixelTable.Wfx),
1291
         new SaveFileType( "Wireless Bitmap",                 "*.wbmp",       RasterImageFormat.Wbmp,          1,  SaveBitsPerPixelTable.Wbmp),
1292
         new SaveFileType( "WordPerfect Graphic",              "*.wpg",        RasterImageFormat.Wpg,           8,  SaveBitsPerPixelTable.Wpg),
1293
1294
            // +++ "X" +++
1295
         new SaveFileType( "Xbm",                              "*.xbm",        RasterImageFormat.Xbm,           1,  SaveBitsPerPixelTable.Xbm),
1296
         new SaveFileType( "Xionics Smp",                      "*.smp",        RasterImageFormat.Smp,           1,  SaveBitsPerPixelTable.Smp),
1297
         new SaveFileType( "Xpm",                              "*.xpm",        RasterImageFormat.Xpm,           32, SaveBitsPerPixelTable.Xpm),
1298
         new SaveFileType( "Xwd",                              "*.xwd",        RasterImageFormat.Xwd10,         24, SaveBitsPerPixelTable.Xwd),
1299
1300
         new SaveFileType( "MS HDPhoto",                       "*.hdp",        RasterImageFormat.Hdp,           24, SaveBitsPerPixelTable.Hdp),
1301
         new SaveFileType( "Vista Png Icon",                   "*.ico",        RasterImageFormat.PngIco,        24, SaveBitsPerPixelTable.PngIco),
1302
         new SaveFileType( "XPS Document",                     "*.xps",        RasterImageFormat.Xps,           24, SaveBitsPerPixelTable.Xps),
1303
         new SaveFileType( "Multiple-image Network Graphics",  "*.mng",        RasterImageFormat.Mng,           24, SaveBitsPerPixelTable.Mng),
1304
        };
1305
      }
1306
1307
      public struct CmpQualityFactor
1308
      {
1309
         private CodecsCmpQualityFactorPredefined _predefined;
1310
         private string _name;
1311
1312
         public CmpQualityFactor(CodecsCmpQualityFactorPredefined predefined, string name)
1313
         {
1314
            _predefined = predefined;
1315
            _name = name;
1316
         }
1317
1318
         public CodecsCmpQualityFactorPredefined Predefined
1319
         {
1320
            get { return _predefined; }
1321
         }
1322
1323
         public string Name
1324
         {
1325
            get { return _name; }
1326
         }
1327
1328
         public override string ToString()
1329
         {
1330
            return Name;
1331
         }
1332
1333
         public static readonly CmpQualityFactor[] Entries =
1334
         {
1335
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.PerfectQuality1,     "Perfect quality 1"),
1336
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.PerfectQuality2,     "Perfect quality 2"),
1337
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.SuperQuality,        "Quality far more important than size"),
1338
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.Quality,             "Quality more important than size"),
1339
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.QualityAndSize,      "Quality and size equally important"),
1340
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.Sharp,               "Size more important than quality (sharp)"),
1341
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.LessTiling,          "Size more important than quality (less tiling)"),
1342
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.MaximumQuality,      "Maximum compression keeping quality"),
1343
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.MaximumCompression,  "Maximum compression"),
1344
            new CmpQualityFactor(CodecsCmpQualityFactorPredefined.Custom,              "Custom"),
1345
         };
1346
      }
1347
1348
      private string _fileName;
1349
      private int _filterIndex;
1350
      private RasterImageFormat _format;
1351
      private int _bitsPerPixel;
1352
      private int _firstPage;
1353
      private int _lastPage;
1354
      private int _savePageNumber;
1355
      private CodecsSavePageMode _pageMode;
1356
        private int _min;
1357
        private int _max;
1358
1359
      public int FilterIndex
1360
      {
1361
         get { return _filterIndex; }
1362
         set { _filterIndex = value; }
1363
      }
1364
1365
      public string FileName
1366
      {
1367
         get { return _fileName; }
1368
         set { _fileName = value; }
1369
      }
1370
1371
      public RasterImageFormat Format
1372
      {
1373
         get { return _format; }
1374
      }
1375
1376
      public int BitsPerPixel
1377
      {
1378
         get { return _bitsPerPixel; }
1379
      }
1380
1381
      public int FirstPage
1382
      {
1383
         get { return _firstPage; }
1384
      }
1385
1386
      public int LastPage
1387
      {
1388
         get { return _lastPage; }
1389
      }
1390
1391
      public int SavePageNumber
1392
      {
1393
         get { return _savePageNumber; }
1394
      }
1395
1396
      public CodecsSavePageMode PageMode
1397
      {
1398
         get { return _pageMode; }
1399
      }
1400
        public int Min
1401
        {
1402
            get;
1403
            set;
1404
        }
1405
        public int Max
1406
        {
1407
            get;
1408
            set;
1409
        }
1410
1411
        public EntityCollection<DOCPAGE> pageSet
1412
        {
1413
            get;
1414
            set;
1415
        }
1416
1417
        //public EntityCollection<DOCPAGE> pageSet = new EntityCollection<DOCPAGE>();
1418
1419
        public EntityCollection<DOCPAGE> Save(IWin32Window owner, RasterCodecs codecs, RasterImage image, Boolean Flag)
1420
        {
1421
            DZConverter dZConverter = new DZConverter();
1422
1423
            _format = RasterImageFormat.Unknown;
1424
            _bitsPerPixel = 0;
1425
            _firstPage = -1;
1426
            _lastPage = -1;
1427
            _savePageNumber = -1;
1428
            _pageMode = CodecsSavePageMode.Overwrite;
1429
            //DZConverterLib.DZConverter dZConverter = new DZConverter();
1430
            //EntityCollection<DOCPAGE> pageSet = new EntityCollection<DOCPAGE>();
1431
1432
            codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = Leadtools.Codecs.CodecsCmpQualityFactorPredefined.Sharp;
1433
1434
            _fileName = _fileName.Trim().Replace(".PDF", "").Replace(".pdf", ""); // D:\ConvertTest\PDF\dhdh.cmp
1435
            _format = Leadtools.RasterImageFormat.Cmp; // Leadtools.RasterImageFormat.Cmp
1436
            _bitsPerPixel = 24; // 24
1437
            _firstPage = 0; // 0
1438
            _lastPage = 1; // 0
1439
            _savePageNumber = 1; // 0
1440
            _pageMode = Leadtools.Codecs.CodecsSavePageMode.Append; // Leadtools.Codecs.CodecsSavePageMode.Append
1441
            try
1442
            {
1443
                using (RasterImage img = new RasterImage(image))
1444
                {
1445
1446
                    string _name = "";
1447
                    int page_no = 0;
1448
                    for (int i = 0; i <= Max - Min; i++)
1449
                    {
1450
                        img.Page = i + 1;
1451
                        page_no = i + Min;
1452
1453
                        using (RasterImage destImage = new RasterImage(
1454
                           RasterMemoryFlags.Conventional,
1455
                           img.Width / 4,
1456
                           img.Height / 4,
1457
                           img.BitsPerPixel,
1458
                           img.Order,
1459
                           img.ViewPerspective,
1460
                           img.GetPalette(),
1461
                           IntPtr.Zero,
1462
                           0))
1463
                        {
1464
                            byte[] buffer = new byte[destImage.BytesPerLine];
1465
                            RasterImageResize resize = new RasterImageResize();
1466
                            resize.Start
1467
                                (
1468
                                    img,
1469
                                    img.Width / 4,
1470
                                    img.Height / 4,
1471
                                    img.BitsPerPixel,
1472
                                    img.Order,
1473
                                    img.DitheringMethod,
1474
                                    RasterSizeFlags.None,
1475
                                    img.GetPalette()
1476
                                    );
1477
1478
                            destImage.Access();
1479
                            // get the rows for the resized image, one by one
1480
                            for (int row = 0; row < destImage.Height; row++)
1481
                            {
1482
                                resize.ResizeBuffer(row, 0, buffer, 0, destImage.BytesPerLine);
1483
                                destImage.SetRow(row, buffer, 0, destImage.BytesPerLine);
1484
                            }
1485
1486
                            image.XResolution = 92;
1487
                            image.YResolution = 92;
1488
                            destImage.XResolution = 92;
1489
                            destImage.YResolution = 92;
1490
1491
                            destImage.Release();
1492
                            resize.Stop();
1493
1494
                            _fileName = _fileName.Replace("TEST_C", "");
1495
                            // Save the destination image
1496
1497
                            //D:\TileSource
1498
1499
                            codecs.Save(destImage, Path.GetDirectoryName(_fileName) + "\\" + page_no + ".jpg", RasterImageFormat.Jpeg, 24);
1500
                            
1501
                        }
1502
1503
                        //_name = Path.GetFileName(_fileName) + "_" + page_no;
1504
                        //_name = page_no.ToString();
1505
                        codecs.Save(image, Path.GetDirectoryName(_fileName) + "\\" + page_no + ".cmp", _format, _bitsPerPixel);
1506
1507
                        int widthData = image.Width;
1508
                        int heightData = image.Height;
1509
1510
                        pageSet.Add(new DOCPAGE
1511
                        {
1512
                            ID = GuidGenerator.GetUniqueGuid().ToString(),
1513
                            PAGE_WIDTH = widthData.ToString(),
1514
                            PAGE_HEIGHT = heightData.ToString(),
1515
                            PAGE_NUMBER = page_no,
1516
                            PAGE_ANGLE = 0,
1517
                        });
1518
                    }
1519
                }
1520
            }
1521
            catch (Exception ex)
1522
            {
1523
                MessageBox.Show(ex.Message);
1524
                //return false;
1525
            }
1526
            return pageSet;
1527
        }
1528
1529
      //  public EntityCollection<DOCPAGE> Save(IWin32Window owner, RasterCodecs codecs, RasterImage image, Boolean Flag)
1530
      //{
1531
      //      DZConverter dZConverter = new DZConverter();
1532
1533
      //      _format = RasterImageFormat.Unknown;
1534
      //      _bitsPerPixel = 0;
1535
      //      _firstPage = -1;
1536
      //      _lastPage = -1;
1537
      //      _savePageNumber = -1;
1538
      //      _pageMode = CodecsSavePageMode.Overwrite;
1539
      //      //DZConverterLib.DZConverter dZConverter = new DZConverter();
1540
      //      //EntityCollection<DOCPAGE> pageSet = new EntityCollection<DOCPAGE>();
1541
1542
      //      codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = Leadtools.Codecs.CodecsCmpQualityFactorPredefined.Sharp;
1543
1544
      //      _fileName = _fileName.Trim().Replace(".PDF","").Replace(".pdf",""); // D:\ConvertTest\PDF\dhdh.cmp
1545
      //          _format = Leadtools.RasterImageFormat.Cmp; // Leadtools.RasterImageFormat.Cmp
1546
      //          _bitsPerPixel = 24; // 24
1547
      //          _firstPage = 0; // 0
1548
      //          _lastPage = 1; // 0
1549
      //          _savePageNumber = 1; // 0
1550
      //          _pageMode = Leadtools.Codecs.CodecsSavePageMode.Append; // Leadtools.Codecs.CodecsSavePageMode.Append
1551
      //      try
1552
      //      {
1553
      //          using (RasterImage img = new RasterImage(image))
1554
      //          {
1555
1556
      //              string _name = "";
1557
      //              int page_no = 0;
1558
      //              for (int i = 0; i <= Max - Min; i++)
1559
      //              {
1560
      //                  img.Page = i + 1;
1561
      //                  page_no = i + Min;
1562
1563
      //                  using (RasterImage destImage = new RasterImage(
1564
      //                     RasterMemoryFlags.Conventional,
1565
      //                     img.Width / 4,
1566
      //                     img.Height / 4,
1567
      //                     img.BitsPerPixel,
1568
      //                     img.Order,
1569
      //                     img.ViewPerspective,
1570
      //                     img.GetPalette(),
1571
      //                     IntPtr.Zero,
1572
      //                     0))
1573
      //                  {
1574
      //                      byte[] buffer = new byte[destImage.BytesPerLine];
1575
      //                      RasterImageResize resize = new RasterImageResize();
1576
      //                      resize.Start
1577
      //                          (
1578
      //                              img,
1579
      //                              img.Width / 4,
1580
      //                              img.Height / 4,
1581
      //                              img.BitsPerPixel,
1582
      //                              img.Order,
1583
      //                              img.DitheringMethod,
1584
      //                              RasterSizeFlags.None,
1585
      //                              img.GetPalette()
1586
      //                              );
1587
1588
      //                      destImage.Access();
1589
      //                      // get the rows for the resized image, one by one
1590
      //                      for (int row = 0; row < destImage.Height; row++)
1591
      //                      {
1592
      //                          resize.ResizeBuffer(row, 0, buffer, 0, destImage.BytesPerLine);
1593
      //                          destImage.SetRow(row, buffer, 0, destImage.BytesPerLine);
1594
      //                      }
1595
1596
      //                      image.XResolution = 92;
1597
      //                      image.YResolution = 92;
1598
      //                      destImage.XResolution = 92;
1599
      //                      destImage.YResolution = 92;
1600
1601
      //                      destImage.Release();
1602
      //                      resize.Stop();
1603
1604
      //                      _fileName = _fileName.Replace("TEST_B", "");
1605
      //                      // Save the destination image
1606
1607
                            
1608
1609
      //                      codecs.Save(destImage, Path.GetDirectoryName(_fileName) + "\\" + page_no + ".jpg", RasterImageFormat.Jpeg, 24);
1610
      //                  }
1611
                        
1612
      //                  //_name = Path.GetFileName(_fileName) + "_" + page_no;
1613
      //                  //_name = page_no.ToString();
1614
      //                  codecs.Save(image, Path.GetDirectoryName(_fileName) + "\\" + page_no + ".cmp", _format, _bitsPerPixel);
1615
1616
      //                  //int widthData = image.Width;
1617
      //                  //int heightData = image.Height;
1618
1619
      //                  //pageSet.Add(new DOCPAGE
1620
      //                  //{
1621
      //                  //    ID = GuidGenerator.GetUniqueGuid().ToString(),
1622
      //                  //    PAGE_WIDTH = widthData.ToString(),
1623
      //                  //    PAGE_HEIGHT = heightData.ToString(),
1624
      //                  //    PAGE_NUMBER = page_no,
1625
      //                  //    PAGE_ANGLE = 0,
1626
      //                  //});
1627
      //              }
1628
      //          }
1629
      //      }
1630
      //      catch (Exception ex)
1631
      //      {
1632
      //          MessageBox.Show(ex.Message);
1633
      //      }
1634
      //      return pageSet;
1635
      //  }
1636
   }
1637
}
클립보드 이미지 추가 (최대 크기: 500 MB)