Mercurial > projects > dwt-mac
comparison dwt/internal/image/OS2BMPFileFormat.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 380af2bdd8e5 |
children | 5123b17c98ef |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
147 int n = pal.colors is null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256); | 147 int n = pal.colors is null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256); |
148 byte[] bytes = new byte[n * 3]; | 148 byte[] bytes = new byte[n * 3]; |
149 int offset = 0; | 149 int offset = 0; |
150 for (int i = 0; i < n; i++) { | 150 for (int i = 0; i < n; i++) { |
151 RGB col = pal.colors[i]; | 151 RGB col = pal.colors[i]; |
152 bytes[offset] = (byte)col.blue; | 152 bytes[offset] = cast(byte)col.blue; |
153 bytes[offset + 1] = (byte)col.green; | 153 bytes[offset + 1] = cast(byte)col.green; |
154 bytes[offset + 2] = (byte)col.red; | 154 bytes[offset + 2] = cast(byte)col.red; |
155 offset += 3; | 155 offset += 3; |
156 } | 156 } |
157 return bytes; | 157 return bytes; |
158 } | 158 } |
159 /** | 159 /** |
260 try { | 260 try { |
261 outputStream.writeInt(BMPHeaderFixedSize); | 261 outputStream.writeInt(BMPHeaderFixedSize); |
262 outputStream.writeShort(image.width); | 262 outputStream.writeShort(image.width); |
263 outputStream.writeShort(image.height); | 263 outputStream.writeShort(image.height); |
264 outputStream.writeShort(1); | 264 outputStream.writeShort(1); |
265 outputStream.writeShort((short)image.depth); | 265 outputStream.writeShort(cast(short)image.depth); |
266 } catch (IOException e) { | 266 } catch (IOException e) { |
267 DWT.error(DWT.ERROR_IO, e); | 267 DWT.error(DWT.ERROR_IO, e); |
268 } | 268 } |
269 | 269 |
270 // Unload palette | 270 // Unload palette |