diff dwt/graphics/GC.d @ 239:43b41c7fe84a

work on allow null strings and arrays
author Frank Benoit <benoit@tionex.de>
date Fri, 20 Jun 2008 16:27:36 +0200
parents f54496748313
children fd9c62a2998e
line wrap: on
line diff
--- a/dwt/graphics/GC.d	Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/graphics/GC.d	Fri Jun 20 16:27:36 2008 +0200
@@ -1798,16 +1798,14 @@
  *
  * @param pointArray an array of alternating x and y values which are the vertices of the polygon
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
 public void drawPolygon( int[] pointArray) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null array
+    //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     checkGC(DRAW);
     auto gdipGraphics = data.gdipGraphics;
     if (gdipGraphics !is null) {
@@ -1843,16 +1841,14 @@
  *
  * @param pointArray an array of alternating x and y values which are the corners of the polyline
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the point array is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
 public void drawPolyline(int[] pointArray) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    // DWT externsion: allow null array
+    //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     checkGC(DRAW);
     auto gdipGraphics = data.gdipGraphics;
     if (gdipGraphics !is null) {
@@ -2091,9 +2087,6 @@
  * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
  * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
@@ -2115,16 +2108,14 @@
  * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
  * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
 public void drawString (String string, int x, int y, bool isTransparent) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
 //  TCHAR buffer = new TCHAR (getCodePage(), string, false);
     wchar[] wstr = StrToWCHARs( string );
     int length_ = wstr.length;
@@ -2247,9 +2238,6 @@
  * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
  * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
@@ -2271,9 +2259,6 @@
  * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
  * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
@@ -2311,16 +2296,14 @@
  * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
  * @param flags the flags specifying how to process the text
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
 public void drawText (String string, int x, int y, int flags) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     if (string.length is 0) return;
     auto gdipGraphics = data.gdipGraphics;
     if (gdipGraphics !is null) {
@@ -2771,9 +2754,6 @@
  *
  * @param pointArray an array of alternating x and y values which are the vertices of the polygon
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
@@ -2782,7 +2762,8 @@
  */
 public void fillPolygon(int[] pointArray) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    // DWT externsion: allow null array
+    //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     checkGC(FILL);
     if (data.gdipGraphics !is null) {
         int mode = OS.GetPolyFillMode(handle) is OS.WINDING ? Gdip.FillModeWinding : Gdip.FillModeAlternate;
@@ -4736,16 +4717,14 @@
  * @param string the string to measure
  * @return a point containing the extent of the string
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
 public Point stringExtent(String string) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT externsion: allow null string
+    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     checkGC(FONT);
     int length_ = string.length;
     if (data.gdipGraphics !is null) {