# HG changeset patch # User Jacob Carlborg # Date 1221220401 -7200 # Node ID 965ac0a7726784e63c03673611f4376fa9cd7b19 # Parent b9226997409c8446024abba6f995bdea86dae22b Ported a couple of modules in dwt.graphics diff -r b9226997409c -r 965ac0a77267 dwt/graphics/LineAttributes.d --- a/dwt/graphics/LineAttributes.d Fri Sep 12 13:44:30 2008 +0200 +++ b/dwt/graphics/LineAttributes.d Fri Sep 12 13:53:21 2008 +0200 @@ -7,12 +7,15 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg *******************************************************************************/ module dwt.graphics.LineAttributes; -import dwt.dwthelper.utils; +import dwt.DWT; -import dwt.DWT; +import dwt.dwthelper.utils; /** * LineAttributes defines a set of line attributes that diff -r b9226997409c -r 965ac0a77267 dwt/graphics/PaletteData.d --- a/dwt/graphics/PaletteData.d Fri Sep 12 13:44:30 2008 +0200 +++ b/dwt/graphics/PaletteData.d Fri Sep 12 13:53:21 2008 +0200 @@ -7,14 +7,18 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg *******************************************************************************/ module dwt.graphics.PaletteData; -import dwt.dwthelper.utils; - import dwt.DWT; +import dwt.dwthelper.utils; +import dwt.graphics.RGB; + /** * Instances of this class describe the color data used by an image. *

diff -r b9226997409c -r 965ac0a77267 dwt/graphics/PathData.d --- a/dwt/graphics/PathData.d Fri Sep 12 13:44:30 2008 +0200 +++ b/dwt/graphics/PathData.d Fri Sep 12 13:53:21 2008 +0200 @@ -7,11 +7,12 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg *******************************************************************************/ module dwt.graphics.PathData; -import dwt.dwthelper.utils; - /** * Instances of this class describe device-independent paths. diff -r b9226997409c -r 965ac0a77267 dwt/graphics/Point.d --- a/dwt/graphics/Point.d Fri Sep 12 13:44:30 2008 +0200 +++ b/dwt/graphics/Point.d Fri Sep 12 13:53:21 2008 +0200 @@ -7,12 +7,17 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg *******************************************************************************/ module dwt.graphics.Point; -import dwt.dwthelper.utils; +import dwt.internal.SerializableCompatibility; -import dwt.internal.SerializableCompatibility; +import tango.text.convert.Format; + +import dwt.dwthelper.utils; /** * Instances of this class represent places on the (x, y) @@ -50,7 +55,7 @@ */ public int y; - static final long serialVersionUID = 3257002163938146354L; + static const long serialVersionUID = 3257002163938146354L; /** * Constructs a new point with the given x and y coordinates. @@ -73,13 +78,15 @@ * * @see #hashCode() */ -public bool equals (Object object) { +public bool opEquals (Object object) { if (object is this) return true; if (!( null !is cast(Point)object )) return false; Point p = cast(Point)object; return (p.x is this.x) && (p.y is this.y); } +alias opEquals equals; + /** * Returns an integer hash code for the receiver. Any two * objects that return true when passed to @@ -90,10 +97,12 @@ * * @see #equals(Object) */ -public int hashCode () { +public hash_t toHash () { return x ^ y; } +alias toHash hashCode; + /** * Returns a string containing a concise, human-readable * description of the receiver. @@ -101,7 +110,7 @@ * @return a string representation of the point */ public String toString () { - return "Point {" + x + ", " + y + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + return Format("Point {{}{}{}{}" , x , ", " , y , "}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff -r b9226997409c -r 965ac0a77267 dwt/graphics/TextStyle.d --- a/dwt/graphics/TextStyle.d Fri Sep 12 13:44:30 2008 +0200 +++ b/dwt/graphics/TextStyle.d Fri Sep 12 13:53:21 2008 +0200 @@ -7,12 +7,17 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg *******************************************************************************/ module dwt.graphics.TextStyle; -import dwt.dwthelper.utils; +import dwt.DWT; -import dwt.DWT; +import dwt.dwthelper.utils; +import dwt.graphics.Color; +import dwt.graphics.Font; /** * TextStyle defines a set of styles that can be applied @@ -197,7 +202,7 @@ * * @see #hashCode() */ -public bool equals(Object object) { +public bool opEquals(Object object) { if (object is this) return true; if (object is null) return false; if (!( null !is cast(TextStyle)object )) return false; @@ -230,6 +235,8 @@ return true; } +alias opEquals equals; + /** * Returns an integer hash code for the receiver. Any two * objects that return true when passed to @@ -240,8 +247,8 @@ * * @see #equals(Object) */ -public int hashCode() { - int hash = 0; +public hash_t toHash() { + hash_t hash = 0; if (foreground !is null) hash ^= foreground.hashCode(); if (background !is null) hash ^= background.hashCode(); if (font !is null) hash ^= font.hashCode(); @@ -256,6 +263,8 @@ return hash; } +alias toHash hashCode; + bool isAdherentBorder(TextStyle style) { if (this is style) return true; if (style is null) return false;