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

Update to SWT 3.4M7
author Frank Benoit <benoit@tionex.de>
date Sat, 17 May 2008 17:34:28 +0200
parents 9a64a7781bab
children fd9c62a2998e
comparison
equal deleted inserted replaced
212:ab60f3309436 213:36f5cb12e1a2
27 import dwt.internal.image.PngTrnsChunk; 27 import dwt.internal.image.PngTrnsChunk;
28 import dwt.internal.image.PngIdatChunk; 28 import dwt.internal.image.PngIdatChunk;
29 import dwt.internal.image.PngEncoder; 29 import dwt.internal.image.PngEncoder;
30 import dwt.internal.image.PngInputStream; 30 import dwt.internal.image.PngInputStream;
31 import dwt.internal.image.PngDecodingDataStream; 31 import dwt.internal.image.PngDecodingDataStream;
32 import dwt.dwthelper.utils;
32 33
33 import dwt.dwthelper.BufferedInputStream; 34 import dwt.dwthelper.BufferedInputStream;
34 import dwt.dwthelper.System;
35 35
36 import tango.core.Exception; 36 import tango.core.Exception;
37 37
38 final class PNGFileFormat : FileFormat { 38 final class PNGFileFormat : FileFormat {
39 static final int SIGNATURE_LENGTH = 8; 39 static final int SIGNATURE_LENGTH = 8;
174 if ((signature[2] & 0xFF) !is 78) return false; //N 174 if ((signature[2] & 0xFF) !is 78) return false; //N
175 if ((signature[3] & 0xFF) !is 71) return false; //G 175 if ((signature[3] & 0xFF) !is 71) return false; //G
176 if ((signature[4] & 0xFF) !is 13) return false; //<RETURN> 176 if ((signature[4] & 0xFF) !is 13) return false; //<RETURN>
177 if ((signature[5] & 0xFF) !is 10) return false; //<LINEFEED> 177 if ((signature[5] & 0xFF) !is 10) return false; //<LINEFEED>
178 if ((signature[6] & 0xFF) !is 26) return false; //<CTRL/Z> 178 if ((signature[6] & 0xFF) !is 26) return false; //<CTRL/Z>
179 if ((signature[7] & 0xFF) !is 10) return false; //<LINEFEED> 179 if ((signature[7] & 0xFF) !is 10) return false; //<LINEFEED>
180 return true; 180 return true;
181 } catch (Exception e) { 181 } catch (Exception e) {
182 return false; 182 return false;
183 } 183 }
184 } 184 }
312 //TEMPORARY CODE 312 //TEMPORARY CODE
313 //PORTING_FIXME 313 //PORTING_FIXME
314 bool use3_2 = true;//System.getProperty("dwt.internal.image.PNGFileFormat_3.2") !is null; 314 bool use3_2 = true;//System.getProperty("dwt.internal.image.PNGFileFormat_3.2") !is null;
315 InputStream inflaterStream = use3_2 ? null : Compatibility.newInflaterInputStream(stream); 315 InputStream inflaterStream = use3_2 ? null : Compatibility.newInflaterInputStream(stream);
316 if (inflaterStream !is null) { 316 if (inflaterStream !is null) {
317 stream = new BufferedInputStream(inflaterStream); 317 stream = inflaterStream;
318 } else { 318 } else {
319 stream = new PngDecodingDataStream(stream); 319 stream = new PngDecodingDataStream(stream);
320 } 320 }
321 int interlaceMethod = headerChunk.getInterlaceMethod(); 321 int interlaceMethod = headerChunk.getInterlaceMethod();
322 if (interlaceMethod is PngIhdrChunk.INTERLACE_METHOD_NONE) { 322 if (interlaceMethod is PngIhdrChunk.INTERLACE_METHOD_NONE) {