Changeset 158:de2578a843a7
- Timestamp:
- 02/09/08 22:19:19 (8 months ago)
- Files:
-
- README (modified) (1 diff)
- dsss.conf (modified) (1 diff)
- dwt/DWT.d (modified) (2 diffs)
- dwt/DWTError.d (modified) (2 diffs)
- dwt/DWTException.d (modified) (4 diffs)
- dwt/accessibility/AccessibleFactory.d (modified) (2 diffs)
- dwt/accessibility/AccessibleObject.d (modified) (5 diffs)
- dwt/dnd/Clipboard.d (modified) (2 diffs)
- dwt/dnd/FileTransfer.d (modified) (2 diffs)
- dwt/dnd/TextTransfer.d (modified) (1 diff)
- dwt/dwthelper/Integer.d (modified) (3 diffs)
- dwt/dwthelper/System.d (modified) (2 diffs)
- dwt/dwthelper/utils.d (modified) (4 diffs)
- dwt/graphics/Device.d (modified) (10 diffs)
- dwt/graphics/DeviceData.d (modified) (1 diff)
- dwt/graphics/Font.d (modified) (2 diffs)
- dwt/graphics/ImageData.d (modified) (115 diffs)
- dwt/internal/image/FileFormat.d (modified) (4 diffs)
- dwt/internal/image/GIFFileFormat.d (modified) (4 diffs)
- dwt/internal/image/JPEGDecoder.d (modified) (1 diff)
- dwt/internal/image/JPEGFileFormat.d (modified) (2 diffs)
- dwt/internal/image/JPEGFixedSizeSegment.d (modified) (1 diff)
- dwt/internal/image/JPEGSegment.d (modified) (1 diff)
- dwt/internal/image/JPEGVariableSizeSegment.d (modified) (1 diff)
- dwt/internal/image/LZWCodec.d (modified) (2 diffs)
- dwt/internal/image/OS2BMPFileFormat.d (modified) (2 diffs)
- dwt/internal/image/TIFFFileFormat.d (modified) (1 diff)
- dwt/internal/image/WinBMPFileFormat.d (modified) (2 diffs)
- dwt/printing/PrintDialog.d (modified) (3 diffs)
- dwt/printing/Printer.d (modified) (1 diff)
- dwt/widgets/Combo.d (modified) (6 diffs)
- dwt/widgets/Control.d (modified) (10 diffs)
- dwt/widgets/Display.d (modified) (2 diffs)
- dwt/widgets/FileDialog.d (modified) (1 diff)
- dwt/widgets/Item.d (modified) (1 diff)
- dwt/widgets/List.d (modified) (2 diffs)
- dwt/widgets/MenuItem.d (modified) (3 diffs)
- dwt/widgets/ProgressBar.d (modified) (13 diffs)
- dwt/widgets/RunnableLock.d (modified) (1 diff)
- dwt/widgets/Scale.d (modified) (5 diffs)
- dwt/widgets/ScrollBar.d (modified) (1 diff)
- dwt/widgets/Slider.d (modified) (1 diff)
- dwt/widgets/Spinner.d (modified) (3 diffs)
- dwt/widgets/Synchronizer.d (modified) (1 diff)
- dwt/widgets/TableItem.d (modified) (1 diff)
- dwt/widgets/Text.d (modified) (3 diffs)
- dwt/widgets/Tracker.d (modified) (1 diff)
- dwt/widgets/TreeItem.d (modified) (1 diff)
- dwt/widgets/Widget.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
README
r118 r158 4 4 Runtime : Tango SVN trunk rev. 3071 5 5 DSSS : 0.73 6 Tango : svn rev 3158 6 7 7 8 Note: DSSS has by default the feature active to compile one file a time. dsss.conf
r153 r158 1 1 [dwt] 2 2 type=library 3 buildflags+=-g -gc -debug 3 4 dwt/DWT.d
r153 r158 3540 3540 * @see IllegalArgumentException 3541 3541 */ 3542 public static void error (int code, TracedException throwable) {3542 public static void error (int code, Exception throwable) { 3543 3543 error (code, throwable, null); 3544 3544 } … … 3572 3572 * @since 3.0 3573 3573 */ 3574 public static void error (int code, TracedException throwable, char[] detail) {3574 public static void error (int code, Exception throwable, char[] detail) { 3575 3575 3576 3576 /* dwt/DWTError.d
r72 r158 54 54 * or null if this information is not available. 55 55 */ 56 public TracedException throwable;56 public Exception throwable; 57 57 58 58 //static final long serialVersionUID = 3833467327105808433L; … … 143 143 public void printStackTrace () { 144 144 Stderr.formatln( "stacktrace follows (if feature compiled in)" ); 145 foreach( msg; this){145 foreach( msg; info ){ 146 146 Stderr.formatln( "{}", msg ); 147 147 } 148 148 if ( throwable !is null) { 149 149 Stderr.formatln ("*** Stack trace of contained error ***"); //$NON-NLS-1$ 150 foreach( msg; throwable ){150 foreach( msg; throwable.info ){ 151 151 Stderr.formatln( "{}", msg ); 152 152 } dwt/DWTException.d
r72 r158 35 35 */ 36 36 37 public class DWTException : TracedException {37 public class DWTException : Exception { 38 38 /** 39 39 * The DWT error code, one of DWT.ERROR_*. … … 45 45 * or null if this information is not available. 46 46 */ 47 public TracedException throwable;47 public Exception throwable; 48 48 49 49 //static final long serialVersionUID = 3257282552304842547L; … … 106 106 * @since 3.1 107 107 */ 108 public TracedException getCause() {108 public Exception getCause() { 109 109 return throwable; 110 110 } … … 133 133 public void printStackTrace () { 134 134 Stderr.formatln( "stacktrace follows (if feature compiled in)" ); 135 foreach( msg; this){135 foreach( msg; info ){ 136 136 Stderr.formatln( "{}", msg ); 137 137 } 138 138 if ( throwable !is null) { 139 139 Stderr.formatln ("*** Stack trace of contained exception ***"); //$NON-NLS-1$ 140 foreach( msg; throwable ){140 foreach( msg; throwable.info ){ 141 141 Stderr.formatln( "{}", msg ); 142 142 } dwt/accessibility/AccessibleFactory.d
r140 r158 97 97 private this (int /*long*/ widgetType) { 98 98 widgetTypeName = OS.g_type_name (widgetType); 99 char[] factoryName = FACTORY_TYPENAME ~ from Utf8z( widgetTypeName ) ~ \0;99 char[] factoryName = FACTORY_TYPENAME ~ fromStringz( widgetTypeName ) ~ \0; 100 100 if (OS.g_type_from_name (factoryName.ptr) is 0) { 101 101 /* register the factory */ … … 139 139 return accessible.accessibleObject.handle; 140 140 } 141 char[] buffer = from Utf8z( widgetTypeName ).dup;141 char[] buffer = fromStringz( widgetTypeName ).dup; 142 142 auto type = getType (buffer, accessible, objectParentType, ACC.CHILDID_SELF); 143 143 AccessibleObject object = new AccessibleObject (type, cast(GtkWidget*)widget, accessible, objectParentType, false); dwt/accessibility/AccessibleObject.d
r104 r158 102 102 event.childID = object.id; 103 103 if (parentResult !is null) { 104 char[] res = from Utf8z( parentResult );104 char[] res = fromStringz( parentResult ); 105 105 event.result = res.dup; 106 106 } … … 134 134 event.childID = object.id; 135 135 if (parentResult !is null) { 136 char[] res = from Utf8z( parentResult );136 char[] res = fromStringz( parentResult ); 137 137 event.result = res.dup; 138 138 } … … 360 360 event.childID = object.id; 361 361 if (parentResult !is null) { 362 event.result = from Utf8z( parentResult ).dup;362 event.result = fromStringz( parentResult ).dup; 363 363 } 364 364 for (int i = 0; i < listeners.length; i++) { … … 388 388 event.childID = object.id; 389 389 if (parentResult !is null) { 390 event.result = from Utf8z( parentResult ).dup;390 event.result = fromStringz( parentResult ).dup; 391 391 } 392 392 for (int i = 0; i < listeners.length; i++) { … … 1205 1205 parentResult = textIface.get_text( handle, 0, characterCount); 1206 1206 if (parentResult !is null) { 1207 parentText = from Utf8z( parentResult ).dup;1207 parentText = fromStringz( parentResult ).dup; 1208 1208 } 1209 1209 } dwt/dnd/Clipboard.d
r146 r158 564 564 continue; 565 565 } 566 char[] buffer = tango.stdc.stringz.from Utf8z( pName ).dup;566 char[] buffer = tango.stdc.stringz.fromStringz( pName ).dup; 567 567 OS.g_free (pName); 568 568 result[count++] = "GTKCLIPBOARD "~buffer; … … 573 573 continue; 574 574 } 575 char[] buffer = tango.stdc.stringz.from Utf8z( pName ).dup;575 char[] buffer = tango.stdc.stringz.fromStringz( pName ).dup; 576 576 OS.g_free (pName); 577 577 result[count++] = "GTKPRIMARYCLIPBOARD "~buffer; dwt/dnd/FileTransfer.d
r152 r158 90 90 OS.g_free(localePtr); 91 91 if (error !is null || uriPtr is null) continue; 92 char[] temp = tango.stdc.stringz.from Utf8z( uriPtr ).dup;92 char[] temp = tango.stdc.stringz.fromStringz( uriPtr ).dup; 93 93 OS.g_free(uriPtr); 94 94 int newLength = (i > 0) ? buffer.length+separator.length+temp.length : temp.length; … … 163 163 OS.g_free(localePtr); 164 164 if (error !is null || utf8Ptr is null) continue; 165 char[] buffer = tango.stdc.stringz.from Utf8z( utf8Ptr ).dup;165 char[] buffer = tango.stdc.stringz.fromStringz( utf8Ptr ).dup; 166 166 OS.g_free(utf8Ptr); 167 167 char[] name = buffer; dwt/dnd/TextTransfer.d
r152 r158 131 131 int count = OS.gdk_text_property_to_utf8_list(transferData.type, transferData.format, transferData.pValue, transferData.length, &list); 132 132 if (count is 0) return null; 133 char[] utf8 = tango.stdc.stringz.from Utf8z( list[0] ).dup;133 char[] utf8 = tango.stdc.stringz.fromStringz( list[0] ).dup; 134 134 OS.g_strfreev(list); 135 135 return new ArrayWrapperString( utf8 ); dwt/dwthelper/Integer.d
r13 r158 1 /**1 /** 2 2 * Authors: Frank Benoit <keinfarbton@googlemail.com> 3 3 */ … … 8 8 9 9 static import tango.text.convert.Integer; 10 private import tango.core.Exception; 10 11 12 public final class Byte { 13 public static byte parseByte( char[] s ){ 14 try{ 15 int res = tango.text.convert.Integer.parse( s ); 16 if( res < byte.min || res > byte.max ){ 17 throw new NumberFormatException( "out of range" ); 18 } 19 return res; 20 } 21 catch( IllegalArgumentException e ){ 22 throw new NumberFormatException( e ); 23 } 24 } 25 } 11 26 public final class Integer { 12 27 … … 56 71 57 72 public static int parseInt( char[] s, int radix ){ 58 return tango.text.convert.Integer.parse( s, cast(uint)radix ); 73 try{ 74 return tango.text.convert.Integer.parse( s, cast(uint)radix ); 75 } 76 catch( IllegalArgumentException e ){ 77 throw new NumberFormatException( e ); 78 } 59 79 } 60 80 61 81 public static int parseInt( char[] s ){ 62 return tango.text.convert.Integer.parse( s ); 82 try{ 83 return tango.text.convert.Integer.parse( s ); 84 } 85 catch( IllegalArgumentException e ){ 86 throw new NumberFormatException( e ); 87 } 63 88 } 64 89 dwt/dwthelper/System.d
r150 r158 6 6 import tango.core.Exception; 7 7 import tango.time.Clock; 8 import tango.stdc.stdlib : exit; 8 9 9 10 template SimpleType(T) { … … 125 126 } 126 127 128 static void exit( int code ){ 129 .exit(code); 130 } 131 127 132 } 128 133 dwt/dwthelper/utils.d
r109 r158 5 5 6 6 public import dwt.dwthelper.System; 7 public import Math = tango.math.Math; 7 8 8 9 import tango.io.Stdout; 10 import tango.stdc.stringz; 11 static import tango.text.Util; 9 12 import tango.text.Unicode; 13 import tango.text.convert.Utf; 14 import tango.core.Exception; 10 15 import tango.stdc.stdlib : exit; 11 16 … … 18 23 abstract class ArrayWrapper{ 19 24 } 25 abstract class ValueWrapper{ 26 } 20 27 21 28 class ArrayWrapperT(T) : ArrayWrapper { … … 26 33 } 27 34 35 class ValueWrapperT(T) : ValueWrapper { 36 public T value; 37 public this( T data ){ 38 value = data; 39 } 40 } 41 42 alias ValueWrapperT!(bool) ValueWrapperBool; 28 43 alias ArrayWrapperT!(byte) ArrayWrapperByte; 29 44 alias ArrayWrapperT!(int) ArrayWrapperInt; … … 45 60 return r[0]; 46 61 } 62 bool CharacterIsWhitespace( dchar c ){ 63 return tango.text.Unicode.isWhitespace( c ); 64 } 65 bool CharacterIsDigit( dchar c ){ 66 return tango.text.Unicode.isDigit( c ); 67 } 47 68 69 public int indexOf( char[] str, char searched ){ 70 int res = tango.text.Util.locate( str, searched ); 71 if( res is str.length ) res = -1; 72 return res; 73 } 74 75 public int indexOf( char[] str, char searched, int startpos ){ 76 int res = tango.text.Util.locate( str, searched, startpos ); 77 if( res is str.length ) res = -1; 78 return res; 79 } 80 81 public int indexOf(char[] str, char[] ch){ 82 return indexOf( str, ch, 0 ); 83 } 84 85 public int indexOf(char[] str, char[] ch, int start){ 86 int res = tango.text.Util.locatePattern( str, ch, start ); 87 if( res is str.length ) res = -1; 88 return res; 89 } 90 91 public char[] substring( char[] str, int start ){ 92 return str[ start .. $ ].dup; 93 } 94 95 public char[] substring( char[] str, int start, int end ){ 96 return str[ start .. end ].dup; 97 } 98 99 public wchar[] substring( wchar[] str, int start ){ 100 return str[ start .. $ ].dup; 101 } 102 103 public wchar[] substring( wchar[] str, int start, int end ){ 104 return str[ start .. end ].dup; 105 } 106 107 public char charAt( char[] str, int pos ){ 108 return str[ pos ]; 109 } 110 111 public void getChars( char[] src, int srcBegin, int srcEnd, char[] dst, int dstBegin){ 112 dst[ dstBegin .. dstBegin + srcEnd - srcBegin ] = src[ srcBegin .. srcEnd ]; 113 } 114 115 public wchar[] toCharArray( char[] str ){ 116 return toString16( str ); 117 } 118 119 public bool endsWith( char[] src, char[] pattern ){ 120 if( src.length < pattern.length ){ 121 return false; 122 } 123 return src[ $-pattern.length .. $ ] == pattern; 124 } 125 126 public bool equals( char[] src, char[] other ){ 127 return src == other; 128 } 129 130 public char[] toLowerCase( char[] src ){ 131 return tango.text.Unicode.toLower( src ); 132 } 133 134 static char[] toHex(uint value, bool prefix = true, int radix = 8){ 135 return tango.text.convert.Integer.toString( 136 value, 137 radix is 10 ? tango.text.convert.Integer.Style.Signed : 138 radix is 8 ? tango.text.convert.Integer.Style.Octal : 139 radix is 16 ? tango.text.convert.Integer.Style.Hex : 140 tango.text.convert.Integer.Style.Signed, 141 prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None 142 ); 143 } 144 145 class NumberFormatException : IllegalArgumentException { 146 this( char[] e ){ 147 super(e); 148 } 149 this( Exception e ){ 150 super(e.toString); 151 } 152 } 153 154 private struct GCStats { 155 size_t poolsize; // total size of pool 156 size_t usedsize; // bytes allocated 157 size_t freeblocks; // number of blocks marked FREE 158 size_t freelistsize; // total of memory on free lists 159 size_t pageblocks; // number of blocks marked PAGE 160 } 161 private extern(C) GCStats gc_stats(); 162 163 size_t RuntimeTotalMemory(){ 164 GCStats s;// = gc_stats(); 165 return s.poolsize; 166 } 167 168 169 170 dwt/graphics/Device.d
r104 r158 55 55 bool debugging; 56 56 bool tracking; 57 TracedException [] errors;57 Exception [] errors; 58 58 Object [] objects; 59 59 … … 169 169 } 170 170 if (tracking) { 171 errors = new TracedException [128];171 errors = new Exception [128]; 172 172 objects = new Object [128]; 173 173 } … … 331 331 int index = 0; 332 332 data.objects = new Object [count]; 333 data.errors = new TracedException [count];333 data.errors = new Exception [count]; 334 334 for (int i=0; i<length; i++) { 335 335 if (objects [i] !is null) { … … 423 423 if (faceName !is null) { 424 424 auto familyName = OS.pango_font_family_get_name(family); 425 match = Compatibility.equalsIgnoreCase(faceName, from Utf8z( familyName ));425 match = Compatibility.equalsIgnoreCase(faceName, fromStringz( familyName )); 426 426 } 427 427 if (match) { … … 683 683 if (dev.warningLevel is 0) { 684 684 if (DEBUG || dev.debugging) { 685 foreach( msg; new TracedException ("")){685 foreach( msg; (new Exception ("")).info ){ 686 686 Stderr.formatln( "trc {}", msg ); 687 687 } … … 696 696 if (objects [i] is null) { 697 697 objects [i] = object; 698 errors [i] = new TracedException ("");698 errors [i] = new Exception (""); 699 699 return; 700 700 } … … 704 704 newObjects [objects.length] = object; 705 705 objects = newObjects; 706 TracedException [] newErrors = new TracedException [errors.length + 128];706 Exception [] newErrors = new Exception [errors.length + 128]; 707 707 System.arraycopy (errors, 0, newErrors, 0, errors.length); 708 newErrors [errors.length] = new TracedException ("");708 newErrors [errors.length] = new Exception (""); 709 709 errors = newErrors; 710 710 } … … 825 825 if (device.warningLevel is 0) { 826 826 if (DEBUG || device.debugging) { 827 foreach( msg; new TracedException ("")){827 foreach( msg; (new Exception ("")).info ){ 828 828 Stderr.formatln( "trc {}", msg ); 829 829 } … … 844 844 if (device !is null) { 845 845 if (DEBUG || device.debugging) { 846 foreach( msg; new TracedException ("")){846 foreach( msg; (new Exception ("")).info ){ 847 847 Stderr.formatln( "trc {}", msg ); 848 848 } … … 850 850 } else { 851 851 if (DEBUG) { 852 foreach( msg; new TracedException ("")){852 foreach( msg; (new Exception ("")).info ){ 853 853 Stderr.formatln( "trc {}", msg ); 854 854 } dwt/graphics/DeviceData.d
r72 r158 35 35 public bool debugging; 36 36 public bool tracking; 37 public TracedException [] errors;37 public Exception [] errors; 38 38 public Object [] objects; 39 39 } dwt/graphics/Font.d
r150 r158 200 200 201 201 auto family = OS.pango_font_description_get_family(handle); 202 char[] name = from Utf8z( family );202 char[] name = fromStringz( family ); 203 203 float height = cast(float)OS.pango_font_description_get_size(handle) / OS.PANGO_SCALE; 204 204 int pangoStyle = OS.pango_font_description_get_style(handle); … … 209 209 if (pangoWeight >= OS.PANGO_WEIGHT_BOLD) style |= DWT.BOLD; 210 210 auto fontString = OS.pango_font_description_to_string (handle); 211 auto buffer = from Utf8z( fontString ).dup;211 auto buffer = fromStringz( fontString ).dup; 212 212 FontData data = new FontData( buffer , height, style); 213 213 OS.g_free (fontString); dwt/graphics/ImageData.d
r104 r158 229 229 for (int b = 0; b < 9; ++b) { 230 230 byte[] data = ANY_TO_EIGHT[b] = new byte[1 << b]; 231 if (b ==0) continue;231 if (b is 0) continue; 232 232 int inc = 0; 233 for (int bit = 0x10000; (bit >>= b) ! =0;) inc |= bit;233 for (int bit = 0x10000; (bit >>= b) !is 0;) inc |= bit; 234 234 for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = cast(byte)(v >> 8); 235 235 } … … 317 317 * static ImageData loadImageData (Class clazz, String string) { 318 318 * InputStream stream = clazz.getResourceAsStream (string); 319 * if (stream ==null) return null;319 * if (stream is null) return null; 320 320 * ImageData imageData = null; 321 321 * try { … … 432 432 int x, int y, int disposalMethod, int delayTime) 433 433 { 434 if (palette ==null) DWT.error(DWT.ERROR_NULL_ARGUMENT);435 if (!(depth == 1 || depth == 2 || depth == 4 || depth ==8436 || depth == 16 || depth == 24 || depth ==32)) {434 if (palette is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 435 if (!(depth is 1 || depth is 2 || depth is 4 || depth is 8 436 || depth is 16 || depth is 24 || depth is 32)) { 437 437 DWT.error(DWT.ERROR_INVALID_ARGUMENT); 438 438 } … … 440 440 DWT.error(DWT.ERROR_INVALID_ARGUMENT); 441 441 } 442 if (scanlinePad ==0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO);442 if (scanlinePad is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); 443 443 444 444 int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) … … 450 450 scanlinePad, 451 451 bytesPerLine, 452 data ! =null ? data : new byte[bytesPerLine * height],452 data !is null ? data : new byte[bytesPerLine * height], 453 453 palette, 454 454 transparentPixel, … … 530 530 getPixels(0, y, width, row, 0); 531 531 for (int i = 0; i < width; i++) { 532 if (pixel ! = -1 && row[i] ==pixel) {532 if (pixel !is -1 && row[i] is pixel) { 533 533 row[i] = 0; 534 534 } else { … … 542 542 543 543 static byte[] checkData(byte [] data) { 544 if (data ==null) DWT.error(DWT.ERROR_NULL_ARGUMENT);544 if (data is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 545 545 return data; 546 546 } … … 558 558 System.arraycopy(data, 0, cloneData, 0, data.length); 559 559 byte[] cloneMaskData = null; 560 if (maskData ! =null) {560 if (maskData !is null) { 561 561 cloneMaskData = new byte[maskData.length]; 562 562 System.arraycopy(maskData, 0, cloneMaskData, 0, maskData.length); 563 563 } 564 564 byte[] cloneAlphaData = null; 565 if (alphaData ! =null) {565 if (alphaData !is null) { 566 566 cloneAlphaData = new byte[alphaData.length]; 567 567 System.arraycopy(alphaData, 0, cloneAlphaData, 0, alphaData.length); … … 601 601 if (x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 602 602 603 if (alphaData ==null) return 255;603 if (alphaData is null) return 255; 604 604 return alphaData[y * width + x] & 0xFF; 605 605 } … … 624 624 */ 625 625 public void getAlphas(int x, int y, int getWidth, byte[] alphas, int startIndex) { 626 if (alphas ==null) DWT.error(DWT.ERROR_NULL_ARGUMENT);626 if (alphas is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 627 627 if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 628 if (getWidth ==0) return;629 630 if (alphaData ==null) {628 if (getWidth is 0) return; 629 630 if (alphaData is null) { 631 631 int endIndex = startIndex + getWidth; 632 632 for (int i = startIndex; i < endIndex; i++) { … … 677 677 index = (y * bytesPerLine) + (x >> 1); 678 678 theByte = data[index] & 0xFF; 679 if ((x & 0x1) ==0) {679 if ((x & 0x1) is 0) { 680 680 return theByte >> 4; 681 681 } else { … … 692 692 theByte = data[index] & 0xFF; 693 693 mask = 1 << (7 - (x & 0x7)); 694 if ((theByte & mask) ==0) {694 if ((theByte & mask) is 0) { 695 695 return 0; 696 696 } else { … … 726 726 */ 727 727 public void getPixels(int x, int y, int getWidth, byte[] pixels, int startIndex) { 728 if (pixels ==null) DWT.error(DWT.ERROR_NULL_ARGUMENT);728 if (pixels is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 729 729 if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 730 if (getWidth ==0) return;730 if (getWidth is 0) return; 731 731 int index; 732 732 int theByte; … … 753 753 case 4: 754 754 index = (y * bytesPerLine) + (x >> 1); 755 if ((x & 0x1) ==1) {755 if ((x & 0x1) is 1) { 756 756 theByte = data[index] & 0xFF; 757 757 pixels[i] = cast(byte)(theByte & 0x0F); … … 813 813 srcX = 0; 814 814 } else { 815 if (offset ==0) {815 if (offset is 0) { 816 816 index++; 817 817 theByte = data[index] & 0xFF; … … 825 825 while (n > 0) { 826 826 mask = 1 << (7 - (srcX & 0x7)); 827 if ((theByte & mask) ==0) {827 if ((theByte & mask) is 0) { 828 828 pixels[i] = 0; 829 829 } else { … … 839 839 srcX = 0; 840 840 } else { 841 if (mask ==1) {841 if (mask is 1) { 842 842 index++; 843 843 if (n > 0) theByte = data[index] & 0xFF; … … 873 873 */ 874 874 public void getPixels(int x, int y, int getWidth, int[] pixels, int startIndex) { 875 if (pixels ==null) DWT.error(DWT.ERROR_NULL_ARGUMENT);875 if (pixels is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 876 876 if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 877 if (getWidth ==0) return;877 if (getWidth is 0) return; 878 878 int index; 879 879 int theByte; … … 948 948 case 4: 949 949 index = (y * bytesPerLine) + (x >> 1); 950 if ((x & 0x1) ==1) {950 if ((x & 0x1) is 1) { 951 951 theByte = data[index] & 0xFF; 952 952 pixels[i] = theByte & 0x0F; … … 1008 1008 srcX = 0; 1009 1009 } else { 1010 if (offset ==0) {1010 if (offset is 0) { 1011 1011 index++; 1012 1012 theByte = data[index] & 0xFF; … … 1020 1020 while (n > 0) { 1021 1021 mask = 1 << (7 - (srcX & 0x7)); 1022 if ((theByte & mask) ==0) {1022 if ((theByte & mask) is 0) { 1023 1023 pixels[i] = 0; 1024 1024 } else { … … 1034 1034 srcX = 0; 1035 1035 } else { 1036 if (mask ==1) {1036 if (mask is 1) { 1037 1037 index++; 1038 1038 if (n > 0) theByte = data[index] & 0xFF; … … 1068 1068 */ 1069 1069 public ImageData getTransparencyMask() { 1070 if (getTransparencyType() ==DWT.TRANSPARENCY_MASK) {1070 if (getTransparencyType() is DWT.TRANSPARENCY_MASK) { 1071 1071 return new ImageData(width, height, 1, bwPalette(), maskPad, maskData); 1072 1072 } else { … … 1083 1083 */ 1084 1084 public int getTransparencyType() { 1085 if (maskData ! =null) return DWT.TRANSPARENCY_MASK;1086 if (transparentPixel ! =-1) return DWT.TRANSPARENCY_PIXEL;1087 if (alphaData ! =null) return DWT.TRANSPARENCY_ALPHA;1085 if (maskData !is null) return DWT.TRANSPARENCY_MASK; 1086 if (transparentPixel !is -1) return DWT.TRANSPARENCY_PIXEL; 1087 if (alphaData !is null) return DWT.TRANSPARENCY_ALPHA; 1088 1088 return DWT.TRANSPARENCY_NONE; 1089 1089 } … … 1095 1095 */ 1096 1096 int getByteOrder() { 1097 return depth ! =16 ? MSB_FIRST : LSB_FIRST;1097 return depth !is 16 ? MSB_FIRST : LSB_FIRST; 1098 1098 } 1099 1099 … … 1134 1134 1135 1135 /* Scale the image mask or alpha */ 1136 if (maskData ! =null) {1136 if (maskData !is null) { 1137 1137 dest.maskPad = this.maskPad; 1138 1138 int destBpl = (dest.width + 7) / 8; … … 1146 1146 dest.maskData, 1, destBpl, MSB_FIRST, 0, 0, dest.width, dest.height, null, null, null, 1147 1147 flipX, flipY); 1148 } else if (alpha ! =-1) {1148 } else if (alpha !is -1) { 1149 1149 dest.alpha = this.alpha; 1150 } else if (alphaData ! =null) {1150 } else if (alphaData !is null) { 1151 1151 dest.alphaData = new byte[dest.width * dest.height]; 1152 1152 blit(BLIT_SRC, … … 1175 1175 DWT.error(DWT.ERROR_INVALID_ARGUMENT); 1176 1176 1177 if (alphaData ==null) alphaData = new byte[width * height];1177 if (alphaData is null) alphaData = new byte[width * height]; 1178 1178 alphaData[y * width + x] = cast(byte)alpha; 1179 1179 } … … 1199 1199 */ 1200 1200 public void setAlphas(int x, int y, int putWidth, byte[] alphas, int startIndex) { 1201 if (alphas ==null) DWT.error(DWT.ERROR_NULL_ARGUMENT);1201 if (alphas is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 1202 1202 if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 1203 if (putWidth ==0) return;1204 1205 if (alphaData ==null) alphaData = new byte[width * height];1203 if (putWidth is 0) return; 1204 1205 if (alphaData is null) alphaData = new byte[width * height]; 1206 1206 // may throw an IndexOutOfBoundsException 1207 1207 System.arraycopy(alphas, startIndex, alphaData, y * width + x, putWidth); … … 1253 1253 case 4: 1254 1254 index = (y * bytesPerLine) + (x >> 1); 1255 if ((x & 0x1) ==0) {1255 if ((x & 0x1) is 0) { 1256 1256 data[index] = cast(byte)((data[index] & 0x0F) | ((pixelValue & 0x0F) << 4)); 1257 1257 } else { … … 1270 1270 theByte = data[index]; 1271 1271 mask = 1 << (7 - (x & 0x7)); 1272 if ((pixelValue & 0x1) ==1) {1272 if ((pixelValue & 0x1) is 1) { 1273 1273 data[index] = cast(byte)(theByte | mask); 1274 1274 } else { … … 1305 1305 */ 1306 1306 public void setPixels(int x, int y, int putWidth, byte[] pixels, int startIndex) { 1307 if (pixels ==null) DWT.error(DWT.ERROR_NULL_ARGUMENT);1307 if (pixels is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 1308 1308 if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 1309 if (putWidth ==0) return;1309 if (putWidth is 0) return; 1310 1310 int index; 1311 1311 int theByte; … … 1332 1332 case 4: 1333 1333 index = (y * bytesPerLine) + (x >> 1); 1334 bool high = (x & 0x1) ==0;1334 bool high = (x & 0x1) is 0; 1335 1335 while (n > 0) { 1336 1336 theByte = pix
