Mercurial > projects > dwt-win
comparison dwt/internal/image/PngIhdrChunk.d @ 212:ab60f3309436
reverted the char[] to String and use the an alias.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:12:38 +0200 |
parents | 9a64a7781bab |
children | 36f5cb12e1a2 |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2006 IBM Corporation and others. | 2 * Copyright (c) 2000, 2006 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
18 import dwt.graphics.RGB; | 18 import dwt.graphics.RGB; |
19 import dwt.internal.image.PngFileReadState; | 19 import dwt.internal.image.PngFileReadState; |
20 import dwt.internal.image.PngIhdrChunk; | 20 import dwt.internal.image.PngIhdrChunk; |
21 import dwt.internal.image.PngChunk; | 21 import dwt.internal.image.PngChunk; |
22 import tango.text.convert.Format; | 22 import tango.text.convert.Format; |
23 import dwt.dwthelper.utils; | |
23 | 24 |
24 class PngIhdrChunk : PngChunk { | 25 class PngIhdrChunk : PngChunk { |
25 static const int IHDR_DATA_LENGTH = 13; | 26 static const int IHDR_DATA_LENGTH = 13; |
26 | 27 |
27 static const int WIDTH_DATA_OFFSET = DATA_OFFSET + 0; | 28 static const int WIDTH_DATA_OFFSET = DATA_OFFSET + 0; |
269 if (colorType is COLOR_TYPE_PALETTE && bitDepth > 8) { | 270 if (colorType is COLOR_TYPE_PALETTE && bitDepth > 8) { |
270 DWT.error(DWT.ERROR_INVALID_IMAGE); | 271 DWT.error(DWT.ERROR_INVALID_IMAGE); |
271 } | 272 } |
272 } | 273 } |
273 | 274 |
274 char[] getColorTypeString() { | 275 String getColorTypeString() { |
275 switch (colorType) { | 276 switch (colorType) { |
276 case COLOR_TYPE_GRAYSCALE: return "Grayscale"; | 277 case COLOR_TYPE_GRAYSCALE: return "Grayscale"; |
277 case COLOR_TYPE_RGB: return "RGB"; | 278 case COLOR_TYPE_RGB: return "RGB"; |
278 case COLOR_TYPE_PALETTE: return "Palette"; | 279 case COLOR_TYPE_PALETTE: return "Palette"; |
279 case COLOR_TYPE_GRAYSCALE_WITH_ALPHA: return "Grayscale with Alpha"; | 280 case COLOR_TYPE_GRAYSCALE_WITH_ALPHA: return "Grayscale with Alpha"; |
280 case COLOR_TYPE_RGB_WITH_ALPHA: return "RGB with Alpha"; | 281 case COLOR_TYPE_RGB_WITH_ALPHA: return "RGB with Alpha"; |
281 default: return "Unknown - " ~ cast(char)colorType; | 282 default: return "Unknown - " ~ cast(char)colorType; |
282 } | 283 } |
283 } | 284 } |
284 | 285 |
285 char[] getFilterMethodString() { | 286 String getFilterMethodString() { |
286 switch (filterMethod) { | 287 switch (filterMethod) { |
287 case FILTER_NONE: return "None"; | 288 case FILTER_NONE: return "None"; |
288 case FILTER_SUB: return "Sub"; | 289 case FILTER_SUB: return "Sub"; |
289 case FILTER_UP: return "Up"; | 290 case FILTER_UP: return "Up"; |
290 case FILTER_AVERAGE: return "Average"; | 291 case FILTER_AVERAGE: return "Average"; |
291 case FILTER_PAETH: return "Paeth"; | 292 case FILTER_PAETH: return "Paeth"; |
292 default: return "Unknown"; | 293 default: return "Unknown"; |
293 } | 294 } |
294 } | 295 } |
295 | 296 |
296 char[] getInterlaceMethodString() { | 297 String getInterlaceMethodString() { |
297 switch (interlaceMethod) { | 298 switch (interlaceMethod) { |
298 case INTERLACE_METHOD_NONE: return "Not Interlaced"; | 299 case INTERLACE_METHOD_NONE: return "Not Interlaced"; |
299 case INTERLACE_METHOD_ADAM7: return "Interlaced - ADAM7"; | 300 case INTERLACE_METHOD_ADAM7: return "Interlaced - ADAM7"; |
300 default: return "Unknown"; | 301 default: return "Unknown"; |
301 } | 302 } |
302 } | 303 } |
303 | 304 |
304 override char[] contributeToString() { | 305 override String contributeToString() { |
305 return Format( "\n\tWidth: {}\n\tHeight: {}\n\tBit Depth: {}\n\tColor Type: {}\n\tCompression Method: {}\n\tFilter Method: {}\n\tInterlace Method: {}", | 306 return Format( "\n\tWidth: {}\n\tHeight: {}\n\tBit Depth: {}\n\tColor Type: {}\n\tCompression Method: {}\n\tFilter Method: {}\n\tInterlace Method: {}", |
306 width, height, bitDepth, getColorTypeString(), compressionMethod, getFilterMethodString(), getInterlaceMethodString() ); | 307 width, height, bitDepth, getColorTypeString(), compressionMethod, getFilterMethodString(), getInterlaceMethodString() ); |
307 } | 308 } |
308 | 309 |
309 bool getMustHavePalette() { | 310 bool getMustHavePalette() { |