Changeset 15
- Timestamp:
- 05/18/04 02:28:11 (5 years ago)
- Files:
-
- branches/0.1/HelloWorld.d (deleted)
- branches/0.1/hello (deleted)
- branches/0.1/obj (deleted)
- branches/0.1/src/HelloDWT.d (added)
- branches/0.1/src/SConstruct (added)
- branches/0.1/src/dwt/accessibility/accessible.d (added)
- branches/0.1/src/dwt/dwtmain.d (deleted)
- branches/0.1/src/dwt/graphics/IDrawable.d (added)
- branches/0.1/src/dwt/graphics/all.d (deleted)
- branches/0.1/src/dwt/graphics/color.d (modified) (2 diffs)
- branches/0.1/src/dwt/graphics/cursor.d (modified) (1 diff)
- branches/0.1/src/dwt/graphics/font.d (modified) (1 diff)
- branches/0.1/src/dwt/graphics/fontdata.d (modified) (2 diffs)
- branches/0.1/src/dwt/graphics/gc.d (modified) (5 diffs)
- branches/0.1/src/dwt/graphics/image.d (modified) (12 diffs)
- branches/0.1/src/dwt/graphics/imagedata.d (modified) (44 diffs)
- branches/0.1/src/dwt/graphics/point.d (modified) (1 diff)
- branches/0.1/src/dwt/graphics/region.d (modified) (1 diff)
- branches/0.1/src/dwt/internal/all.d (deleted)
- branches/0.1/src/dwt/internal/compatibility.d (modified) (4 diffs)
- branches/0.1/src/dwt/internal/gtk/os.d (modified) (2 diffs)
- branches/0.1/src/dwt/internal/win32/all.d (deleted)
- branches/0.1/src/dwt/internal/win32/os.d (modified) (2 diffs)
- branches/0.1/src/dwt/internal/win32/shactivateinfo.d (added)
- branches/0.1/src/dwt/internal/win32/tchar.d (modified) (1 diff)
- branches/0.1/src/dwt/internal/win32/windowpos.d (added)
- branches/0.1/src/dwt/util/all.d (deleted)
- branches/0.1/src/dwt/util/string.d (modified) (8 diffs)
- branches/0.1/src/dwt/util/stringclass_old_01.d (deleted)
- branches/0.1/src/dwt/util/throwable.d (added)
- branches/0.1/src/dwt/util/util.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/all.d (deleted)
- branches/0.1/src/dwt/widgets/button.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/caret.d (modified) (4 diffs)
- branches/0.1/src/dwt/widgets/composite.d (modified) (6 diffs)
- branches/0.1/src/dwt/widgets/control.d (modified) (3 diffs)
- branches/0.1/src/dwt/widgets/decorations.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/display.d (modified) (61 diffs)
- branches/0.1/src/dwt/widgets/event.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/item.d (modified) (5 diffs)
- branches/0.1/src/dwt/widgets/layout.d (added)
- branches/0.1/src/dwt/widgets/monitor.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/runnablelock.d (added)
- branches/0.1/src/dwt/widgets/scrollable.d (modified) (15 diffs)
- branches/0.1/src/dwt/widgets/shell.d (modified) (20 diffs)
- branches/0.1/src/dwt/widgets/synchronizer.d (added)
- branches/0.1/src/dwt/widgets/widget.d (modified) (24 diffs)
- branches/0.1/src/dwt/widgets/widgets.d (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.1/src/dwt/graphics/color.d
r11 r15 149 149 if (object == this) return true; 150 150 // TODO: deal with instanceof if (!(object instanceof Color)) return false; 151 Color color = (Color) object;151 Color color = cast(Color) object; 152 152 return device == color.device && (handle & 0xFFFFFF) == (color.handle & 0xFFFFFF); 153 153 } … … 254 254 byte[] entry = new byte[4]; 255 255 OS.GetPaletteEntries(hPal, index, 1, entry); 256 if ((entry[0] == (byte)red) && (entry[1] ==(byte)green) &&257 (entry[2] == (byte)blue)) {256 if ((entry[0] == cast(byte)red) && (entry[1] == cast(byte)green) && 257 (entry[2] == cast(byte)blue)) { 258 258 /* Found the color. Increment the ref count and return */ 259 259 colorRefCount[index]++; branches/0.1/src/dwt/graphics/cursor.d
r3 r15 55 55 */ 56 56 static final byte[] HAND_SOURCE = [ 57 (byte)0xf9,(byte)0xff,(byte)0xff,(byte)0xff,58 (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,59 (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,60 (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,61 (byte)0xf0,(byte)0x3f,(byte)0xff,(byte)0xff,62 (byte)0xf0,(byte)0x07,(byte)0xff,(byte)0xff,63 (byte)0xf0,(byte)0x03,(byte)0xff,(byte)0xff,64 (byte)0xf0,(byte)0x00,(byte)0xff,(byte)0xff,65 66 (byte)0x10,(byte)0x00,(byte)0x7f,(byte)0xff,67 (byte)0x00,(byte)0x00,(byte)0x7f,(byte)0xff,68 (byte)0x80,(byte)0x00,(byte)0x7f,(byte)0xff,69 (byte)0xc0,(byte)0x00,(byte)0x7f,(byte)0xff,70 (byte)0xe0,(byte)0x00,(byte)0x7f,(byte)0xff,71 (byte)0xf0,(byte)0x00,(byte)0x7f,(byte)0xff,72 (byte)0xf8,(byte)0x00,(byte)0xff,(byte)0xff,73 (byte)0xfc,(byte)0x01,(byte)0xff,(byte)0xff,74 75 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,76 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,77 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,78 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,79 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,80 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,81 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,82 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,83 84 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,85 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,86 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,87 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,88 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,89 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,90 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,91 (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff57 cast(byte)0xf9,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 58 cast(byte)0xf0,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 59 cast(byte)0xf0,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 60 cast(byte)0xf0,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 61 cast(byte)0xf0,cast(byte)0x3f,cast(byte)0xff,cast(byte)0xff, 62 cast(byte)0xf0,cast(byte)0x07,cast(byte)0xff,cast(byte)0xff, 63 cast(byte)0xf0,cast(byte)0x03,cast(byte)0xff,cast(byte)0xff, 64 cast(byte)0xf0,cast(byte)0x00,cast(byte)0xff,cast(byte)0xff, 65 66 cast(byte)0x10,cast(byte)0x00,cast(byte)0x7f,cast(byte)0xff, 67 cast(byte)0x00,cast(byte)0x00,cast(byte)0x7f,cast(byte)0xff, 68 cast(byte)0x80,cast(byte)0x00,cast(byte)0x7f,cast(byte)0xff, 69 cast(byte)0xc0,cast(byte)0x00,cast(byte)0x7f,cast(byte)0xff, 70 cast(byte)0xe0,cast(byte)0x00,cast(byte)0x7f,cast(byte)0xff, 71 cast(byte)0xf0,cast(byte)0x00,cast(byte)0x7f,cast(byte)0xff, 72 cast(byte)0xf8,cast(byte)0x00,cast(byte)0xff,cast(byte)0xff, 73 cast(byte)0xfc,cast(byte)0x01,cast(byte)0xff,cast(byte)0xff, 74 75 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 76 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 77 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 78 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 79 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 80 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 81 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 82 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 83 84 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 85 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 86 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 87 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 88 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 89 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 90 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff, 91 cast(byte)0xff,cast(byte)0xff,cast(byte)0xff,cast(byte)0xff 92 92 ]; 93 93 static final byte[] HAND_MASK = [ 94 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,95 (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,96 (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,97 (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,98 (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,99 (byte)0x06,(byte)0xc0,(byte)0x00,(byte)0x00,100 (byte)0x06,(byte)0xd8,(byte)0x00,(byte)0x00,101 (byte)0x06,(byte)0xd8,(byte)0x00,(byte)0x00,102 103 (byte)0x07,(byte)0xdb,(byte)0x00,(byte)0x00,104 (byte)0x67,(byte)0xfb,(byte)0x00,(byte)0x00,105 (byte)0x3f,(byte)0xff,(byte)0x00,(byte)0x00,106 (byte)0x1f,(byte)0xff,(byte)0x00,(byte)0x00,107 (byte)0x0f,(byte)0xff,(byte)0x00,(byte)0x00,108 (byte)0x07,(byte)0xff,(byte)0x00,(byte)0x00,109 (byte)0x03,(byte)0xfe,(byte)0x00,(byte)0x00,110 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,111 112 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,113 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,114 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,115 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,116 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,117 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,118 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,119 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,120 121 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,122 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,123 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,124 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,125 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,126 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,127 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,128 (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x0094 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 95 cast(byte)0x06,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 96 cast(byte)0x06,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 97 cast(byte)0x06,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 98 cast(byte)0x06,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 99 cast(byte)0x06,cast(byte)0xc0,cast(byte)0x00,cast(byte)0x00, 100 cast(byte)0x06,cast(byte)0xd8,cast(byte)0x00,cast(byte)0x00, 101 cast(byte)0x06,cast(byte)0xd8,cast(byte)0x00,cast(byte)0x00, 102 103 cast(byte)0x07,cast(byte)0xdb,cast(byte)0x00,cast(byte)0x00, 104 cast(byte)0x67,cast(byte)0xfb,cast(byte)0x00,cast(byte)0x00, 105 cast(byte)0x3f,cast(byte)0xff,cast(byte)0x00,cast(byte)0x00, 106 cast(byte)0x1f,cast(byte)0xff,cast(byte)0x00,cast(byte)0x00, 107 cast(byte)0x0f,cast(byte)0xff,cast(byte)0x00,cast(byte)0x00, 108 cast(byte)0x07,cast(byte)0xff,cast(byte)0x00,cast(byte)0x00, 109 cast(byte)0x03,cast(byte)0xfe,cast(byte)0x00,cast(byte)0x00, 110 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 111 112 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 113 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 114 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 115 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 116 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 117 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 118 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 119 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 120 121 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 122 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 123 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 124 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 125 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 126 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 127 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00, 128 cast(byte)0x00,cast(byte)0x00,cast(byte)0x00,cast(byte)0x00 129 129 ]; 130 130 branches/0.1/src/dwt/graphics/font.d
r11 r15 162 162 if (object == this) return true; 163 163 // TODO: instanceof if (!(object instanceof Font)) return false; 164 Font font = (Font) object;164 Font font = cast(Font) object; 165 165 return device == font.device && handle == font.handle; 166 166 } branches/0.1/src/dwt/graphics/fontdata.d
r11 r15 258 258 if (object == this) return true; 259 259 // TODO: instanceof if (!(object instanceof FontData)) return false; 260 FontData fd = (FontData)object;260 FontData fd = cast(FontData)object; 261 261 LOGFONT* lf = fd.data; 262 262 return data.lfCharSet == lf.lfCharSet && … … 309 309 int [] lpCs = new int[8]; 310 310 OS.TranslateCharsetInfo(cp, lpCs, OS.TCI_SRCCODEPAGE); 311 data.lfCharSet = (byte)lpCs[0];311 data.lfCharSet = cast(byte)lpCs[0]; 312 312 return 0; 313 313 } branches/0.1/src/dwt/graphics/gc.d
r12 r15 26 26 import dwt.graphics.rgb; 27 27 28 import dwt.util.util;29 30 import dwt.internal.win32.all;31 28 import dwt.internal.compatibility; 29 30 import dwt.internal.win32.iconinfo; 31 import dwt.internal.win32.os; 32 import dwt.internal.win32.rect; 33 import dwt.internal.win32.tchar; 34 import dwt.internal.win32.textmetric; 35 import dwt.internal.win32.types; 36 32 37 import dwt.util.util; 33 38 … … 841 846 byte oldValue = pBits[0]; 842 847 int mask = (0xFF << (8 - bm.bmBitsPixel)) & 0x00FF; 843 pBits[0] = (byte)((srcImage.transparentPixel << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask));848 pBits[0] = cast(byte)((srcImage.transparentPixel << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask)); 844 849 OS.MoveMemory(bm.bmBits, pBits, 1); 845 850 int color = OS.GetPixel(srcHdc, 0, 0); … … 856 861 byte[] newColors = new byte[oldColors.length]; 857 862 transRed = transGreen = transBlue = 0xff; 858 newColors[offset] = (byte)transBlue;859 newColors[offset+1] = (byte)transGreen;860 newColors[offset+2] = (byte)transRed;863 newColors[offset] = cast(byte)transBlue; 864 newColors[offset+1] = cast(byte)transGreen; 865 newColors[offset+2] = cast(byte)transRed; 861 866 OS.SetDIBColorTable(srcHdc, 0, maxColors, newColors); 862 867 originalColors = oldColors; … … 1652 1657 trivertex[0].x = x; 1653 1658 trivertex[0].y = y; 1654 trivertex[0].Red = (short)((fromRGB.red << 8) | fromRGB.red);1655 trivertex[0].Green = (short)((fromRGB.green << 8) | fromRGB.green);1656 trivertex[0].Blue = (short)((fromRGB.blue << 8) | fromRGB.blue);1659 trivertex[0].Red = cast(short)((fromRGB.red << 8) | fromRGB.red); 1660 trivertex[0].Green = cast(short)((fromRGB.green << 8) | fromRGB.green); 1661 trivertex[0].Blue = cast(short)((fromRGB.blue << 8) | fromRGB.blue); 1657 1662 trivertex[0].Alpha = -1; 1658 1663 //OS.MoveMemory(pVertex, trivertex, TRIVERTEX.sizeof); … … 1660 1665 trivertex[1].x = x + width; 1661 1666 trivertex[1].y = y + height; 1662 trivertex[1].Red = (short)((toRGB.red << 8) | toRGB.red);1663 trivertex[1].Green = (short)((toRGB.green << 8) | toRGB.green);1664 trivertex[1].Blue = (short)((toRGB.blue << 8) | toRGB.blue);1667 trivertex[1].Red = cast(short)((toRGB.red << 8) | toRGB.red); 1668 trivertex[1].Green = cast(short)((toRGB.green << 8) | toRGB.green); 1669 trivertex[1].Blue = cast(short)((toRGB.blue << 8) | toRGB.blue); 1665 1670 trivertex[1].Alpha = -1; 1666 1671 //OS.MoveMemory(pVertex + TRIVERTEX.sizeof, trivertex, TRIVERTEX.sizeof); branches/0.1/src/dwt/graphics/image.d
r12 r15 281 281 /*byte[] rgbBwBitmapInfo = { 282 282 40,0,0,0, // biSize 283 (byte)(r.width & 0xFF), // biWidth284 (byte)((r.width & 0xFF00) >> 8),285 (byte)((r.width & 0xFF0000) >> 16),286 (byte)((r.width & 0xFF000000) >> 24),287 (byte)(r.height & 0xFF), // biHeight288 (byte)((r.height & 0xFF00) >> 8),289 (byte)((r.height & 0xFF0000) >> 16),290 (byte)((r.height & 0xFF000000) >> 24),283 cast(byte)(r.width & 0xFF), // biWidth 284 cast(byte)((r.width & 0xFF00) >> 8), 285 cast(byte)((r.width & 0xFF0000) >> 16), 286 cast(byte)((r.width & 0xFF000000) >> 24), 287 cast(byte)(r.height & 0xFF), // biHeight 288 cast(byte)((r.height & 0xFF00) >> 8), 289 cast(byte)((r.height & 0xFF0000) >> 16), 290 cast(byte)((r.height & 0xFF000000) >> 24), 291 291 1,0, // biPlanes 292 292 1,0, // biBitCount … … 298 298 0,0,0,0, // biClrImportant 299 299 0,0,0,0, // First color: black 300 (byte)0xFF,(byte)0xFF,(byte)0xFF,0 // Second color: white300 cast(byte)0xFF,cast(byte)0xFF,cast(byte)0xFF,0 // Second color: white 301 301 };*/ 302 302 … … 512 512 blue = (blueShift < 0) ? blue >>> -blueShift : blue << blueShift; 513 513 newData.data[offset++] = 514 (byte)((red+red+green+green+green+green+green+blue) >> 3);514 cast(byte)((red+red+green+green+green+green+green+blue) >> 3); 515 515 } 516 516 } … … 782 782 bmiHeader.biHeight = -height; 783 783 bmiHeader.biPlanes = 1; 784 bmiHeader.biBitCount = (short)depth;784 bmiHeader.biBitCount = cast(short)depth; 785 785 if (useBitfields) bmiHeader.biCompression = OS.BI_BITFIELDS; 786 786 else bmiHeader.biCompression = OS.BI_RGB; … … 799 799 blueMask = 0x1F; 800 800 // little endian 801 bmi[offset] = (byte)((redMask & 0xFF) >> 0);802 bmi[offset + 1] = (byte)((redMask & 0xFF00) >> 8);803 bmi[offset + 2] = (byte)((redMask & 0xFF0000) >> 16);804 bmi[offset + 3] = (byte)((redMask & 0xFF000000) >> 24);805 bmi[offset + 4] = (byte)((greenMask & 0xFF) >> 0);806 bmi[offset + 5] = (byte)((greenMask & 0xFF00) >> 8);807 bmi[offset + 6] = (byte)((greenMask & 0xFF0000) >> 16);808 bmi[offset + 7] = (byte)((greenMask & 0xFF000000) >> 24);809 bmi[offset + 8] = (byte)((blueMask & 0xFF) >> 0);810 bmi[offset + 9] = (byte)((blueMask & 0xFF00) >> 8);811 bmi[offset + 10] = (byte)((blueMask & 0xFF0000) >> 16);812 bmi[offset + 11] = (byte)((blueMask & 0xFF000000) >> 24);801 bmi[offset] = cast(byte)((redMask & 0xFF) >> 0); 802 bmi[offset + 1] = cast(byte)((redMask & 0xFF00) >> 8); 803 bmi[offset + 2] = cast(byte)((redMask & 0xFF0000) >> 16); 804 bmi[offset + 3] = cast(byte)((redMask & 0xFF000000) >> 24); 805 bmi[offset + 4] = cast(byte)((greenMask & 0xFF) >> 0); 806 bmi[offset + 5] = cast(byte)((greenMask & 0xFF00) >> 8); 807 bmi[offset + 6] = cast(byte)((greenMask & 0xFF0000) >> 16); 808 bmi[offset + 7] = cast(byte)((greenMask & 0xFF000000) >> 24); 809 bmi[offset + 8] = cast(byte)((blueMask & 0xFF) >> 0); 810 bmi[offset + 9] = cast(byte)((blueMask & 0xFF00) >> 8); 811 bmi[offset + 10] = cast(byte)((blueMask & 0xFF0000) >> 16); 812 bmi[offset + 11] = cast(byte)((blueMask & 0xFF000000) >> 24); 813 813 break; 814 814 case 32: … … 817 817 blueMask = 0xFF000000; 818 818 // big endian 819 bmi[offset] = (byte)((redMask & 0xFF000000) >> 24);820 bmi[offset + 1] = (byte)((redMask & 0xFF0000) >> 16);821 bmi[offset + 2] = (byte)((redMask & 0xFF00) >> 8);822 bmi[offset + 3] = (byte)((redMask & 0xFF) >> 0);823 bmi[offset + 4] = (byte)((greenMask & 0xFF000000) >> 24);824 bmi[offset + 5] = (byte)((greenMask & 0xFF0000) >> 16);825 bmi[offset + 6] = (byte)((greenMask & 0xFF00) >> 8);826 bmi[offset + 7] = (byte)((greenMask & 0xFF) >> 0);827 bmi[offset + 8] = (byte)((blueMask & 0xFF000000) >> 24);828 bmi[offset + 9] = (byte)((blueMask & 0xFF0000) >> 16);829 bmi[offset + 10] = (byte)((blueMask & 0xFF00) >> 8);830 bmi[offset + 11] = (byte)((blueMask & 0xFF) >> 0);819 bmi[offset] = cast(byte)((redMask & 0xFF000000) >> 24); 820 bmi[offset + 1] = cast(byte)((redMask & 0xFF0000) >> 16); 821 bmi[offset + 2] = cast(byte)((redMask & 0xFF00) >> 8); 822 bmi[offset + 3] = cast(byte)((redMask & 0xFF) >> 0); 823 bmi[offset + 4] = cast(byte)((greenMask & 0xFF000000) >> 24); 824 bmi[offset + 5] = cast(byte)((greenMask & 0xFF0000) >> 16); 825 bmi[offset + 6] = cast(byte)((greenMask & 0xFF00) >> 8); 826 bmi[offset + 7] = cast(byte)((greenMask & 0xFF) >> 0); 827 bmi[offset + 8] = cast(byte)((blueMask & 0xFF000000) >> 24); 828 bmi[offset + 9] = cast(byte)((blueMask & 0xFF0000) >> 16); 829 bmi[offset + 10] = cast(byte)((blueMask & 0xFF00) >> 8); 830 bmi[offset + 11] = cast(byte)((blueMask & 0xFF) >> 0); 831 831 break; 832 832 default: … … 836 836 } else { 837 837 for (int j = 0; j < rgbs.length; j++) { 838 bmi[offset] = (byte)rgbs[j].blue;839 bmi[offset + 1] = (byte)rgbs[j].green;840 bmi[offset + 2] = (byte)rgbs[j].red;838 bmi[offset] = cast(byte)rgbs[j].blue; 839 bmi[offset + 1] = cast(byte)rgbs[j].green; 840 bmi[offset + 2] = cast(byte)rgbs[j].red; 841 841 bmi[offset + 3] = 0; 842 842 offset += 4; … … 936 936 byte oldValue = pBits[0]; 937 937 int mask = (0xFF << (8 - bm.bmBitsPixel)) & 0x00FF; 938 pBits[0] = (byte)((transparentPixel << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask));938 pBits[0] = cast(byte)((transparentPixel << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask)); 939 939 OS.MoveMemory(bm.bmBits, pBits, 1); 940 940 int color = OS.GetPixel(hdcMem, 0, 0); … … 1139 1139 // First color black, second color white 1140 1140 int offset = BITMAPINFOHEADER.size; 1141 bmi[offset + 4] = bmi[offset + 5] = bmi[offset + 6] = (byte)0xFF;1141 bmi[offset + 4] = bmi[offset + 5] = bmi[offset + 6] = cast(byte)0xFF; 1142 1142 bmi[offset + 7] = 0; 1143 1143 … … 1550 1550 bmiHeader.biHeight = -i.height; 1551 1551 bmiHeader.biPlanes = 1; 1552 bmiHeader.biBitCount = (short)i.depth;1552 bmiHeader.biBitCount = cast(short)i.depth; 1553 1553 if (useBitfields) bmiHeader.biCompression = OS.BI_BITFIELDS; 1554 1554 else bmiHeader.biCompression = OS.BI_RGB; … … 1568 1568 */ 1569 1569 if (i.getByteOrder() == ImageData.LSB_FIRST) { 1570 bmi[offset] = (byte)((redMask & 0xFF) >> 0);1571 bmi[offset + 1] = (byte)((redMask & 0xFF00) >> 8);1572 bmi[offset + 2] = (byte)((redMask & 0xFF0000) >> 16);1573 bmi[offset + 3] = (byte)((redMask & 0xFF000000) >> 24);1574 bmi[offset + 4] = (byte)((greenMask & 0xFF) >> 0);1575 bmi[offset + 5] = (byte)((greenMask & 0xFF00) >> 8);1576 bmi[offset + 6] = (byte)((greenMask & 0xFF0000) >> 16);1577 bmi[offset + 7] = (byte)((greenMask & 0xFF000000) >> 24);1578 bmi[offset + 8] = (byte)((blueMask & 0xFF) >> 0);1579 bmi[offset + 9] = (byte)((blueMask & 0xFF00) >> 8);1580 bmi[offset + 10] = (byte)((blueMask & 0xFF0000) >> 16);1581 bmi[offset + 11] = (byte)((blueMask & 0xFF000000) >> 24);1570 bmi[offset] = cast(byte)((redMask & 0xFF) >> 0); 1571 bmi[offset + 1] = cast(byte)((redMask & 0xFF00) >> 8); 1572 bmi[offset + 2] = cast(byte)((redMask & 0xFF0000) >> 16); 1573 bmi[offset + 3] = cast(byte)((redMask & 0xFF000000) >> 24); 1574 bmi[offset + 4] = cast(byte)((greenMask & 0xFF) >> 0); 1575 bmi[offset + 5] = cast(byte)((greenMask & 0xFF00) >> 8); 1576 bmi[offset + 6] = cast(byte)((greenMask & 0xFF0000) >> 16); 1577 bmi[offset + 7] = cast(byte)((greenMask & 0xFF000000) >> 24); 1578 bmi[offset + 8] = cast(byte)((blueMask & 0xFF) >> 0); 1579 bmi[offset + 9] = cast(byte)((blueMask & 0xFF00) >> 8); 1580 bmi[offset + 10] = cast(byte)((blueMask & 0xFF0000) >> 16); 1581 bmi[offset + 11] = cast(byte)((blueMask & 0xFF000000) >> 24); 1582 1582 } else { 1583 bmi[offset] = (byte)((redMask & 0xFF000000) >> 24);1584 bmi[offset + 1] = (byte)((redMask & 0xFF0000) >> 16);1585 bmi[offset + 2] = (byte)((redMask & 0xFF00) >> 8);1586 bmi[offset + 3] = (byte)((redMask & 0xFF) >> 0);1587 bmi[offset + 4] = (byte)((greenMask & 0xFF000000) >> 24);1588 bmi[offset + 5] = (byte)((greenMask & 0xFF0000) >> 16);1589 bmi[offset + 6] = (byte)((greenMask & 0xFF00) >> 8);1590 bmi[offset + 7] = (byte)((greenMask & 0xFF) >> 0);1591 bmi[offset + 8] = (byte)((blueMask & 0xFF000000) >> 24);1592 bmi[offset + 9] = (byte)((blueMask & 0xFF0000) >> 16);1593 bmi[offset + 10] = (byte)((blueMask & 0xFF00) >> 8);1594 bmi[offset + 11] = (byte)((blueMask & 0xFF) >> 0);1583 bmi[offset] = cast(byte)((redMask & 0xFF000000) >> 24); 1584 bmi[offset + 1] = cast(byte)((redMask & 0xFF0000) >> 16); 1585 bmi[offset + 2] = cast(byte)((redMask & 0xFF00) >> 8); 1586 bmi[offset + 3] = cast(byte)((redMask & 0xFF) >> 0); 1587 bmi[offset + 4] = cast(byte)((greenMask & 0xFF000000) >> 24); 1588 bmi[offset + 5] = cast(byte)((greenMask & 0xFF0000) >> 16); 1589 bmi[offset + 6] = cast(byte)((greenMask & 0xFF00) >> 8); 1590 bmi[offset + 7] = cast(byte)((greenMask & 0xFF) >> 0); 1591 bmi[offset + 8] = cast(byte)((blueMask & 0xFF000000) >> 24); 1592 bmi[offset + 9] = cast(byte)((blueMask & 0xFF0000) >> 16); 1593 bmi[offset + 10] = cast(byte)((blueMask & 0xFF00) >> 8); 1594 bmi[offset + 11] = cast(byte)((blueMask & 0xFF) >> 0); 1595 1595 } 1596 1596 } 1597 1597 } else { 1598 1598 for (int j = 0; j < rgbs.length; j++) { 1599 bmi[offset] = (byte)rgbs[j].blue;1600 bmi[offset + 1] = (byte)rgbs[j].green;1601 bmi[offset + 2] = (byte)rgbs[j].red;1599 bmi[offset] = cast(byte)rgbs[j].blue; 1600 bmi[offset + 1] = cast(byte)rgbs[j].green; 1601 bmi[offset + 2] = cast(byte)rgbs[j].red; 1602 1602 bmi[offset + 3] = 0; 1603 1603 offset += 4; … … 1928 1928 int numColors = OS.GetDIBColorTable(hdcMem, 0, maxColors, colors); 1929 1929 int offset = transparentPixel * 4; 1930 colors[offset] = (byte)color.getBlue();1931 colors[offset + 1] = (byte)color.getGreen();1932 colors[offset + 2] = (byte)color.getRed();1930 colors[offset] = cast(byte)color.getBlue(); 1931 colors[offset + 1] = cast(byte)color.getGreen(); 1932 colors[offset + 2] = cast(byte)color.getRed(); 1933 1933 if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED); 1934 1934 OS.SetDIBColorTable(hdcMem, 0, numColors, colors); branches/0.1/src/dwt/graphics/imagedata.d
r11 r15 223 223 int inc = 0; 224 224 for (int _bit = 0x10000; (_bit >>= b) != 0;) inc |= _bit; 225 for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = (byte)(v >> 8);225 for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = cast(byte)(v >> 8); 226 226 } 227 227 … … 602 602 int endIndex = startIndex + getWidth; 603 603 for (int i = startIndex; i < endIndex; i++) { 604 alphas[i] = (byte)255;604 alphas[i] = cast(byte)255; 605 605 } 606 606 return; … … 746 746 offset = 3 - (srcX % 4); 747 747 mask = 3 << (offset * 2); 748 pixels[i] = (byte)((theByte & mask) >> (offset * 2));748 pixels[i] = cast(byte)((theByte & mask) >> (offset * 2)); 749 749 i++; 750 750 n--; … … 768 768 if ((x & 0x1) == 1) { 769 769 theByte = data[index] & 0xFF; 770 pixels[i] = (byte)(theByte & 0x0F);770 pixels[i] = cast(byte)(theByte & 0x0F); 771 771 i++; 772 772 n--; … … 782 782 while (n > 1) { 783 783 theByte = data[index] & 0xFF; 784 pixels[i] = (byte)(theByte >> 4);784 pixels[i] = cast(byte)(theByte >> 4); 785 785 i++; 786 786 n--; … … 791 791 srcX = 0; 792 792 } else { 793 pixels[i] = (byte)(theByte & 0x0F);793 pixels[i] = cast(byte)(theByte & 0x0F); 794 794 i++; 795 795 n--; … … 806 806 if (n > 0) { 807 807 theByte = data[index] & 0xFF; 808 pixels[i] = (byte)(theByte >> 4);808 pixels[i] = cast(byte)(theByte >> 4); 809 809 } 810 810 return; … … 894 894 offset = 3 - (srcX % 4); 895 895 mask = 3 << (offset * 2); 896 pixels[i] = (byte)((theByte & mask) >> (offset * 2));896 pixels[i] = cast(byte)((theByte & mask) >> (offset * 2)); 897 897 i++; 898 898 n--; … … 1155 1155 1156 1156 if (alphaData == null) alphaData = new byte[width * height]; 1157 alphaData[y * width + x] = (byte)alpha;1157 alphaData[y * width + x] = cast(byte)alpha; 1158 1158 } 1159 1159 … … 1215 1215 mask = 1 << (7 - (x & 0x7)); 1216 1216 if ((pixelValue & 0x1) == 1) { 1217 data[index] = (byte)(theByte | mask);1217 data[index] = cast(byte)(theByte | mask); 1218 1218 } else { 1219 data[index] = (byte)(theByte & (mask ^ -1));1219 data[index] = cast(byte)(theByte & (mask ^ -1)); 1220 1220 } 1221 1221 return; … … 1226 1226 int offset = 3 - (x % 4); 1227 1227 mask = 0xFF ^ (3 << (offset * 2)); 1228 data[index] = (byte)((data[index] & mask) | (pixelValue << (offset * 2)));1228 data[index] = cast(byte)((data[index] & mask) | (pixelValue << (offset * 2))); 1229 1229 return; 1230 1230 } … … 1232 1232 index = (y * bytesPerLine) + (x >> 1); 1233 1233 if ((x & 0x1) == 0) { 1234 data[index] = (byte)((data[index] & 0x0F) | ((pixelValue & 0x0F) << 4));1234 data[index] = cast(byte)((data[index] & 0x0F) | ((pixelValue & 0x0F) << 4)); 1235 1235 } else { 1236 data[index] = (byte)((data[index] & 0xF0) | (pixelValue & 0x0F));1236 data[index] = cast(byte)((data[index] & 0xF0) | (pixelValue & 0x0F)); 1237 1237 } 1238 1238 return; … … 1240 1240 if (depth == 8) { 1241 1241 index = (y * bytesPerLine) + x ; 1242 data[index] = (byte)(pixelValue & 0xFF);1242 data[index] = cast(byte)(pixelValue & 0xFF); 1243 1243 return; 1244 1244 } 1245 1245 if (depth == 16) { 1246 1246 index = (y * bytesPerLine) + (x * 2); 1247 data[index + 1] = (byte)((pixelValue >> 8) & 0xFF);1248 data[index] = (byte)(pixelValue & 0xFF);1247 data[index + 1] = cast(byte)((pixelValue >> 8) & 0xFF); 1248 data[index] = cast(byte)(pixelValue & 0xFF); 1249 1249 return; 1250 1250 } 1251 1251 if (depth == 24) { 1252 1252 index = (y * bytesPerLine) + (x * 3); 1253 data[index] = (byte)((pixelValue >> 16) & 0xFF);1254 data[index + 1] = (byte)((pixelValue >> 8) & 0xFF);1255 data[index + 2] = (byte)(pixelValue & 0xFF);1253 data[index] = cast(byte)((pixelValue >> 16) & 0xFF); 1254 data[index + 1] = cast(byte)((pixelValue >> 8) & 0xFF); 1255 data[index + 2] = cast(byte)(pixelValue & 0xFF); 1256 1256 return; 1257 1257 } 1258 1258 if (depth == 32) { 1259 1259 index = (y * bytesPerLine) + (x * 4); 1260 data[index] = (byte)((pixelValue >> 24) & 0xFF);1261 data[index + 1] = (byte)((pixelValue >> 16) & 0xFF);1262 data[index + 2] = (byte)((pixelValue >> 8) & 0xFF);1263 data[index + 3] = (byte)(pixelValue & 0xFF);1260 data[index] = cast(byte)((pixelValue >> 24) & 0xFF); 1261 data[index + 1] = cast(byte)((pixelValue >> 16) & 0xFF); 1262 data[index + 2] = cast(byte)((pixelValue >> 8) & 0xFF); 1263 data[index + 3] = cast(byte)(pixelValue & 0xFF); 1264 1264 return; 1265 1265 } … … 1305 1305 mask = 1 << (7 - (srcX & 0x7)); 1306 1306 if ((pixels[i] & 0x1) == 1) { 1307 data[index] = (byte)((data[index] & 0xFF) | mask);1307 data[index] = cast(byte)((data[index] & 0xFF) | mask); 1308 1308 } else { 1309 data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1));1309 data[index] = cast(byte)((data[index] & 0xFF) & (mask ^ -1)); 1310 1310 } 1311 1311 i++; … … 1325 1325 } 1326 1326 if (depth == 2) { 1327 static byte [] masks = [ (byte)0xFC, (byte)0xF3, (byte)0xCF,(byte)0x3F ];1327 static byte [] masks = [ cast(byte)0xFC, cast(byte)0xF3, cast(byte)0xCF, cast(byte)0x3F ]; 1328 1328 index = (y * bytesPerLine) + (x >> 2); 1329 1329 int offset = 3 - (x % 4); 1330 1330 while (n > 0) { 1331 1331 theByte = pixels[i] & 0x3; 1332 data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2)));1332 data[index] = cast(byte)((data[index] & masks[offset]) | (theByte << (offset * 2))); 1333 1333 i++; 1334 1334 n--; … … 1356 1356 theByte = pixels[i] & 0x0F; 1357 1357 if (high) { 1358 data[index] = (byte)((data[index] & 0x0F) | (theByte << 4));1358 data[index] = cast(byte)((data[index] & 0x0F) | (theByte << 4)); 1359 1359 } else { 1360 data[index] = (byte)((data[index] & 0xF0) | theByte);1360 data[index] = cast(byte)((data[index] & 0xF0) | theByte); 1361 1361 } 1362 1362 i++; … … 1378 1378 index = (y * bytesPerLine) + x; 1379 1379 for (int j = 0; j < putWidth; j++) { 1380 data[index] = (byte)(pixels[i] & 0xFF);1380 data[index] = cast(byte)(pixels[i] & 0xFF); 1381 1381 i++; 1382 1382 srcX++; … … 1432 1432 mask = 1 << (7 - (srcX & 0x7)); 1433 1433 if ((pixels[i] & 0x1) == 1) { 1434 data[index] = (byte)((data[index] & 0xFF) | mask);1434 data[index] = cast(byte)((data[index] & 0xFF) | mask); 1435 1435 } else { 1436 data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1));1436 data[index] = cast(byte)((data[index] & 0xFF) & (mask ^ -1)); 1437 1437 } 1438 1438 i++; … … 1452 1452 } 1453 1453 if (depth == 2) { 1454 static byte [] masks = [ (byte)0xFC, (byte)0xF3, (byte)0xCF,(byte)0x3F ];1454 static byte [] masks = [ cast(byte)0xFC, cast(byte)0xF3, cast(byte)0xCF, cast(byte)0x3F ]; 1455 1455 index = (y * bytesPerLine) + (x >> 2); 1456 1456 int offset = 3 - (x % 4); 1457 1457 while (n > 0) { 1458 1458 theByte = pixels[i] & 0x3; 1459 data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2)));1459 data[index] = cast(byte)((data[index] & masks[offset]) | (theByte << (offset * 2))); 1460 1460 i++; 1461 1461 n--; … … 1483 1483 theByte = pixels[i] & 0x0F; 1484 1484 if (high) { 1485 data[index] = (byte)((data[index] & 0x0F) | (theByte << 4));1485 data[index] = cast(byte)((data[index] & 0x0F) | (theByte << 4)); 1486 1486 } else { 1487 data[index] = (byte)((data[index] & 0xF0) | theByte);1487 data[index] = cast(byte)((data[index] & 0xF0) | theByte); 1488 1488 } 1489 1489 i++; … … 1505 1505 index = (y * bytesPerLine) + x; 1506 1506 for (int j = 0; j < putWidth; j++) { 1507 data[index] = (byte)(pixels[i] & 0xFF);1507 data[index] = cast(byte)(pixels[i] & 0xFF); 1508 1508 i++; 1509 1509 srcX++; … … 1523 1523 for (int j = 0; j < putWidth; j++) { 1524 1524 pixel = pixels[i]; 1525 data[index] = (byte)(pixel & 0xFF);1526 data[index + 1] = (byte)((pixel >> 8) & 0xFF);1525 data[index] = cast(byte)(pixel & 0xFF); 1526 data[index + 1] = cast(byte)((pixel >> 8) & 0xFF); 1527 1527 i++; 1528 1528 srcX++; … … 1541 1541 for (int j = 0; j < putWidth; j++) { 1542 1542 pixel = pixels[i]; 1543 data[index] = (byte)((pixel >> 16) & 0xFF);1544 data[index + 1] = (byte)((pixel >> 8) & 0xFF);1545 data[index + 2] = (byte)(pixel & 0xFF);1543 data[index] = cast(byte)((pixel >> 16) & 0xFF); 1544 data[index + 1] = cast(byte)((pixel >> 8) & 0xFF); 1545 data[index + 2] = cast(byte)(pixel & 0xFF); 1546 1546 i++; 1547 1547 srcX++; … … 1560 1560 for (int j = 0; j < putWidth; j++) { <
