comparison dwt/internal/image/FileFormat.d @ 213:36f5cb12e1a2

Update to SWT 3.4M7
author Frank Benoit <benoit@tionex.de>
date Sat, 17 May 2008 17:34:28 +0200
parents ab60f3309436
children fd9c62a2998e
comparison
equal deleted inserted replaced
212:ab60f3309436 213:36f5cb12e1a2
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language: 10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de> 11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/ 12 *******************************************************************************/
13 module dwt.internal.image.FileFormat; 13 module dwt.internal.image.FileFormat;
14
15 import dwt.dwthelper.utils;
14 16
15 public import dwt.graphics.ImageLoader; 17 public import dwt.graphics.ImageLoader;
16 public import dwt.graphics.ImageData; 18 public import dwt.graphics.ImageData;
17 public import dwt.internal.image.LEDataInputStream; 19 public import dwt.internal.image.LEDataInputStream;
18 public import dwt.internal.image.LEDataOutputStream; 20 public import dwt.internal.image.LEDataOutputStream;
30 import dwt.internal.image.JPEGFileFormat; 32 import dwt.internal.image.JPEGFileFormat;
31 import dwt.internal.image.PNGFileFormat; 33 import dwt.internal.image.PNGFileFormat;
32 34
33 import tango.core.Exception; 35 import tango.core.Exception;
34 import tango.core.Tuple; 36 import tango.core.Tuple;
35 import dwt.dwthelper.utils;
36 37
37 /** 38 /**
38 * Abstract factory class for loading/unloading images from files or streams 39 * Abstract factory class for loading/unloading images from files or streams
39 * in various image file formats. 40 * in various image file formats.
40 * 41 *
79 * return the device independent image array represented by the stream. 80 * return the device independent image array represented by the stream.
80 */ 81 */
81 public static ImageData[] load(InputStream istr, ImageLoader loader) { 82 public static ImageData[] load(InputStream istr, ImageLoader loader) {
82 FileFormat fileFormat = null; 83 FileFormat fileFormat = null;
83 LEDataInputStream stream = new LEDataInputStream(istr); 84 LEDataInputStream stream = new LEDataInputStream(istr);
84 bool isSupported = false; 85 bool isSupported = false;
85 foreach( TFormat; TFormats ){ 86 foreach( TFormat; TFormats ){
86 try{ 87 try{
87 fileFormat = new TFormat(); 88 fileFormat = new TFormat();
88 if (fileFormat.isFileFormat(stream)) { 89 if (fileFormat.isFileFormat(stream)) {
89 isSupported = true; 90 isSupported = true;