Mercurial > projects > dwt-win
comparison dwt/graphics/GC.d @ 197:184ab53b7785
Changes and fixes for jface
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 10 Apr 2008 11:19:49 +0200 |
parents | 3afcd4ddcf90 |
children | ab60f3309436 |
comparison
equal
deleted
inserted
replaced
196:1e7701c27c03 | 197:184ab53b7785 |
---|---|
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * Port to the D programming language: | 10 * Port to the D programming language: |
11 * Frank Benoit <benoit@tionex.de> | 11 * Frank Benoit <benoit@tionex.de> |
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module dwt.graphics.GC; | 13 module dwt.graphics.GC; |
14 | |
15 | |
16 | |
17 /+ | |
18 //PORTING_TYPE | |
19 class GC{ | |
20 void dispose(); | |
21 bool isDisposed(); | |
22 void flush (); | |
23 GCData data; | |
24 HDC handle; | |
25 public void drawImage(Image image, int x, int y) ; | |
26 public void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) ; | |
27 void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, bool simple) ; | |
28 } | |
29 +/ | |
30 | 14 |
31 import dwt.DWT; | 15 import dwt.DWT; |
32 import dwt.DWTError; | 16 import dwt.DWTError; |
33 import dwt.DWTException; | 17 import dwt.DWTException; |
34 import dwt.internal.Compatibility; | 18 import dwt.internal.Compatibility; |
194 auto hDC = drawable.internal_new_GC(data); | 178 auto hDC = drawable.internal_new_GC(data); |
195 Device device = data.device; | 179 Device device = data.device; |
196 if (device is null) device = Device.getDevice(); | 180 if (device is null) device = Device.getDevice(); |
197 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 181 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
198 this.device = data.device = device; | 182 this.device = data.device = device; |
199 init (drawable, data, hDC); | 183 init_ (drawable, data, hDC); |
200 if (device.tracking) device.new_Object(this); | 184 if (device.tracking) device.new_Object(this); |
201 } | 185 } |
202 | 186 |
203 static int checkStyle(int style) { | 187 static int checkStyle(int style) { |
204 if ((style & DWT.LEFT_TO_RIGHT) !is 0) style &= ~DWT.RIGHT_TO_LEFT; | 188 if ((style & DWT.LEFT_TO_RIGHT) !is 0) style &= ~DWT.RIGHT_TO_LEFT; |
3697 return Gdip.Matrix_new(-1, 0, 0, 1, width + 2 * pt.x, 0); | 3681 return Gdip.Matrix_new(-1, 0, 0, 1, width + 2 * pt.x, 0); |
3698 } | 3682 } |
3699 return Gdip.Matrix_new(1, 0, 0, 1, 0, 0); | 3683 return Gdip.Matrix_new(1, 0, 0, 1, 0, 0); |
3700 } | 3684 } |
3701 | 3685 |
3702 void init(Drawable drawable, GCData data, HDC hDC) { | 3686 void init_(Drawable drawable, GCData data, HDC hDC) { |
3703 auto foreground = data.foreground; | 3687 auto foreground = data.foreground; |
3704 if (foreground !is -1) { | 3688 if (foreground !is -1) { |
3705 data.state &= ~(FOREGROUND | FOREGROUND_TEXT | PEN); | 3689 data.state &= ~(FOREGROUND | FOREGROUND_TEXT | PEN); |
3706 } else { | 3690 } else { |
3707 data.foreground = OS.GetTextColor(hDC); | 3691 data.foreground = OS.GetTextColor(hDC); |
4868 */ | 4852 */ |
4869 public static GC win32_new(Drawable drawable, GCData data) { | 4853 public static GC win32_new(Drawable drawable, GCData data) { |
4870 GC gc = new GC(); | 4854 GC gc = new GC(); |
4871 auto hDC = drawable.internal_new_GC(data); | 4855 auto hDC = drawable.internal_new_GC(data); |
4872 gc.device = data.device; | 4856 gc.device = data.device; |
4873 gc.init(drawable, data, hDC); | 4857 gc.init_(drawable, data, hDC); |
4874 return gc; | 4858 return gc; |
4875 } | 4859 } |
4876 | 4860 |
4877 /** | 4861 /** |
4878 * Invokes platform specific functionality to wrap a graphics context. | 4862 * Invokes platform specific functionality to wrap a graphics context. |
4890 * @return a new <code>GC</code> | 4874 * @return a new <code>GC</code> |
4891 */ | 4875 */ |
4892 public static GC win32_new(HDC hDC, GCData data) { | 4876 public static GC win32_new(HDC hDC, GCData data) { |
4893 GC gc = new GC(); | 4877 GC gc = new GC(); |
4894 gc.device = data.device; | 4878 gc.device = data.device; |
4895 gc.init(null, data, hDC); | 4879 gc.init_(null, data, hDC); |
4896 return gc; | 4880 return gc; |
4897 } | 4881 } |
4898 | 4882 |
4899 } | 4883 } |