Naveen Neel / shedskin
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gdiplusgraphics.h Source File

gdiplusgraphics.h

00001 /*
00002  * gdiplusgraphics.h
00003  *
00004  * GDI+ Graphics class
00005  *
00006  * This file is part of the w32api package.
00007  *
00008  * Contributors:
00009  *   Created by Markus Koenig <markus@stber-koenig.de>
00010  *
00011  * THIS SOFTWARE IS NOT COPYRIGHTED
00012  *
00013  * This source code is offered for use in the public domain. You may
00014  * use, modify or distribute it freely.
00015  *
00016  * This code is distributed in the hope that it will be useful but
00017  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00018  * DISCLAIMED. This includes but is not limited to warranties of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00020  *
00021  */
00022 
00023 #ifndef __GDIPLUS_GRAPHICS_H
00024 #define __GDIPLUS_GRAPHICS_H
00025 #if __GNUC__ >=3
00026 #pragma GCC system_header
00027 #endif
00028 
00029 #ifndef __cplusplus
00030 #error "A C++ compiler is required to include gdiplusgraphics.h."
00031 #endif
00032 
00033 class Graphics: public GdiplusBase
00034 {
00035     friend class Bitmap;
00036     friend class CachedBitmap;
00037     friend class Font;
00038     friend class GraphicsPath;
00039     friend class Metafile;
00040     friend class Region;
00041 
00042 public:
00043     static Graphics* FromHDC(HDC hdc)
00044     {
00045         return new Graphics(hdc);
00046     }
00047     static Graphics* FromHDC(HDC hdc, HANDLE hdevice)
00048     {
00049         return new Graphics(hdc, hdevice);
00050     }
00051     static Graphics* FromHWND(HWND hwnd, BOOL icm = FALSE)
00052     {
00053         return new Graphics(hwnd, icm);
00054     }
00055     static Graphics* FromImage(Image *image)
00056     {
00057         return new Graphics(image);
00058     }
00059     static HPALETTE GetHalftonePalette()
00060     {
00061         return DllExports::GdipCreateHalftonePalette();
00062     }
00063 
00064     Graphics(Image *image): nativeGraphics(NULL), lastStatus(Ok)
00065     {
00066         lastStatus = DllExports::GdipGetImageGraphicsContext(
00067                 image ? image->nativeImage : NULL,
00068                 &nativeGraphics);
00069     }
00070     Graphics(HDC hdc): nativeGraphics(NULL), lastStatus(Ok)
00071     {
00072         lastStatus = DllExports::GdipCreateFromHDC(
00073                 hdc, &nativeGraphics);
00074     }
00075     Graphics(HDC hdc, HANDLE hdevice): nativeGraphics(NULL), lastStatus(Ok)
00076     {
00077         lastStatus = DllExports::GdipCreateFromHDC2(
00078                 hdc, hdevice, &nativeGraphics);
00079     }
00080     Graphics(HWND hwnd, BOOL icm = FALSE):
00081         nativeGraphics(NULL), lastStatus(Ok)
00082     {
00083         if (icm) {
00084             lastStatus = DllExports::GdipCreateFromHWNDICM(
00085                     hwnd, &nativeGraphics);
00086         } else {
00087             lastStatus = DllExports::GdipCreateFromHWND(
00088                     hwnd, &nativeGraphics);
00089         }
00090     }
00091     ~Graphics()
00092     {
00093         DllExports::GdipDeleteGraphics(nativeGraphics);
00094     }
00095 
00096     Status AddMetafileComment(const BYTE *data, UINT sizeData)
00097     {
00098         return updateStatus(DllExports::GdipComment(
00099                 nativeGraphics, sizeData, data));
00100     }
00101     GraphicsContainer BeginContainer()
00102     {
00103         GraphicsContainer result = 0;
00104         updateStatus(DllExports::GdipBeginContainer2(
00105                 nativeGraphics, &result));
00106         return result;
00107     }
00108     GraphicsContainer BeginContainer(const RectF& dstrect,
00109             const RectF& srcrect, Unit unit)
00110     {
00111         GraphicsContainer result = 0;
00112         updateStatus(DllExports::GdipBeginContainer(
00113                 nativeGraphics, &dstrect, &srcrect, unit,
00114                 &result));
00115         return result;
00116     }
00117     GraphicsContainer BeginContainer(const Rect& dstrect,
00118             const Rect& srcrect, Unit unit)
00119     {
00120         GraphicsContainer result = 0;
00121         updateStatus(DllExports::GdipBeginContainerI(
00122                 nativeGraphics, &dstrect, &srcrect, unit,
00123                 &result));
00124         return result;
00125     }
00126     Status Clear(const Color& color)
00127     {
00128         return updateStatus(DllExports::GdipGraphicsClear(
00129                 nativeGraphics, color.GetValue()));
00130     }
00131     Status DrawArc(const Pen *pen, REAL x, REAL y, REAL width, REAL height,
00132             REAL startAngle, REAL sweepAngle)
00133     {
00134         return updateStatus(DllExports::GdipDrawArc(
00135                 nativeGraphics, pen ? pen->nativePen : NULL,
00136                 x, y, width, height, startAngle, sweepAngle));
00137     }
00138     Status DrawArc(const Pen *pen, INT x, INT y, INT width, INT height,
00139             REAL startAngle, REAL sweepAngle)
00140     {
00141         return updateStatus(DllExports::GdipDrawArcI(
00142                 nativeGraphics, pen ? pen->nativePen : NULL,
00143                 x, y, width, height, startAngle, sweepAngle));
00144     }
00145     Status DrawArc(const Pen *pen, const RectF& rect,
00146             REAL startAngle, REAL sweepAngle)
00147     {
00148         return updateStatus(DllExports::GdipDrawArc(
00149                 nativeGraphics, pen ? pen->nativePen : NULL,
00150                 rect.X, rect.Y, rect.Width, rect.Height,
00151                 startAngle, sweepAngle));
00152     }
00153     Status DrawArc(const Pen *pen, const Rect& rect,
00154             REAL startAngle, REAL sweepAngle)
00155     {
00156         return updateStatus(DllExports::GdipDrawArcI(
00157                 nativeGraphics, pen ? pen->nativePen : NULL,
00158                 rect.X, rect.Y, rect.Width, rect.Height,
00159                 startAngle, sweepAngle));
00160     }
00161     Status DrawBezier(const Pen *pen,
00162             REAL x1, REAL y1, REAL x2, REAL y2,
00163             REAL x3, REAL y3, REAL x4, REAL y4)
00164     {
00165         return updateStatus(DllExports::GdipDrawBezier(
00166                 nativeGraphics, pen ? pen->nativePen : NULL,
00167                 x1, y1, x2, y2, x3, y3, x4, y4));
00168     }
00169     Status DrawBezier(const Pen *pen,
00170             INT x1, INT y1, INT x2, INT y2,
00171             INT x3, INT y3, INT x4, INT y4)
00172     {
00173         return updateStatus(DllExports::GdipDrawBezierI(
00174                 nativeGraphics, pen ? pen->nativePen : NULL,
00175                 x1, y1, x2, y2, x3, y3, x4, y4));
00176     }
00177     Status DrawBezier(const Pen *pen,
00178             const PointF& pt1, const PointF& pt2,
00179             const PointF& pt3, const PointF& pt4)
00180     {
00181         return updateStatus(DllExports::GdipDrawBezier(
00182                 nativeGraphics, pen ? pen->nativePen : NULL,
00183                 pt1.X, pt1.Y, pt2.X, pt2.Y,
00184                 pt3.X, pt3.Y, pt4.X, pt4.Y));
00185     }
00186     Status DrawBezier(const Pen *pen,
00187             const Point& pt1, const Point& pt2,
00188             const Point& pt3, const Point& pt4)
00189     {
00190         return updateStatus(DllExports::GdipDrawBezierI(
00191                 nativeGraphics, pen ? pen->nativePen : NULL,
00192                 pt1.X, pt1.Y, pt2.X, pt2.Y,
00193                 pt3.X, pt3.Y, pt4.X, pt4.Y));
00194     }
00195     Status DrawBeziers(const Pen *pen, const PointF *points, INT count)
00196     {
00197         return updateStatus(DllExports::GdipDrawBeziers(
00198                 nativeGraphics, pen ? pen->nativePen : NULL,
00199                 points, count));
00200     }
00201     Status DrawBeziers(const Pen *pen, const Point *points, INT count)
00202     {
00203         return updateStatus(DllExports::GdipDrawBeziersI(
00204                 nativeGraphics, pen ? pen->nativePen : NULL,
00205                 points, count));
00206     }
00207     Status DrawCachedBitmap(CachedBitmap *cb, INT x, INT y)
00208     {
00209         return updateStatus(DllExports::GdipDrawCachedBitmap(
00210                 nativeGraphics,
00211                 cb ? cb->nativeCachedBitmap : NULL,
00212                 x, y));
00213     }
00214     Status DrawClosedCurve(const Pen *pen, const PointF *points, INT count)
00215     {
00216         return updateStatus(DllExports::GdipDrawClosedCurve(
00217                 nativeGraphics, pen ? pen->nativePen : NULL,
00218                 points, count));
00219     }
00220     Status DrawClosedCurve(const Pen *pen, const Point *points, INT count)
00221     {
00222         return updateStatus(DllExports::GdipDrawClosedCurveI(
00223                 nativeGraphics, pen ? pen->nativePen : NULL,
00224                 points, count));
00225     }
00226     Status DrawClosedCurve(const Pen *pen, const PointF *points, INT count,
00227             REAL tension)
00228     {
00229         return updateStatus(DllExports::GdipDrawClosedCurve2(
00230                 nativeGraphics, pen ? pen->nativePen : NULL,
00231                 points, count, tension));
00232     }
00233     Status DrawClosedCurve(const Pen *pen, const Point *points, INT count,
00234             REAL tension)
00235     {
00236         return updateStatus(DllExports::GdipDrawClosedCurve2I(
00237                 nativeGraphics, pen ? pen->nativePen : NULL,
00238                 points, count, tension));
00239     }
00240     Status DrawCurve(const Pen *pen, const PointF *points, INT count)
00241     {
00242         return updateStatus(DllExports::GdipDrawCurve(
00243                 nativeGraphics, pen ? pen->nativePen : NULL,
00244                 points, count));
00245     }
00246     Status DrawCurve(const Pen *pen, const Point *points, INT count)
00247     {
00248         return updateStatus(DllExports::GdipDrawCurveI(
00249                 nativeGraphics, pen ? pen->nativePen : NULL,
00250                 points, count));
00251     }
00252     Status DrawCurve(const Pen *pen, const PointF *points, INT count,
00253             REAL tension)
00254     {
00255         return updateStatus(DllExports::GdipDrawCurve2(
00256                 nativeGraphics, pen ? pen->nativePen : NULL,
00257                 points, count, tension));
00258     }
00259     Status DrawCurve(const Pen *pen, const Point *points, INT count,
00260             REAL tension)
00261     {
00262         return updateStatus(DllExports::GdipDrawCurve2I(
00263                 nativeGraphics, pen ? pen->nativePen : NULL,
00264                 points, count, tension));
00265     }
00266     Status DrawCurve(const Pen *pen, const PointF *points, INT count,
00267             INT offset, INT numberOfSegments, REAL tension)
00268     {
00269         return updateStatus(DllExports::GdipDrawCurve3(
00270                 nativeGraphics, pen ? pen->nativePen : NULL,
00271                 points, count, offset,
00272                 numberOfSegments, tension));
00273     }
00274     Status DrawCurve(const Pen *pen, const Point *points, INT count,
00275             INT offset, INT numberOfSegments, REAL tension)
00276     {
00277         return updateStatus(DllExports::GdipDrawCurve3I(
00278                 nativeGraphics, pen ? pen->nativePen : NULL,
00279                 points, count, offset,
00280                 numberOfSegments, tension));
00281     }
00282     Status DrawDriverString(const UINT16 *text, INT length,
00283             const Font *font, const Brush *brush,
00284             const PointF *positions, INT flags,
00285             const Matrix *matrix)
00286     {
00287         return updateStatus(DllExports::GdipDrawDriverString(
00288                 nativeGraphics, text, length,
00289                 font ? font->nativeFont : NULL,
00290                 brush ? brush->nativeBrush : NULL,
00291                 positions, flags,
00292                 matrix ? matrix->nativeMatrix : NULL));
00293     }
00294     Status DrawEllipse(const Pen *pen,
00295             REAL x, REAL y, REAL width, REAL height)
00296     {
00297         return updateStatus(DllExports::GdipDrawEllipse(
00298                 nativeGraphics, pen ? pen->nativePen : NULL,
00299                 x, y, width, height));
00300     }
00301     Status DrawEllipse(const Pen *pen, INT x, INT y, INT width, INT height)
00302     {
00303         return updateStatus(DllExports::GdipDrawEllipseI(
00304                 nativeGraphics, pen ? pen->nativePen : NULL,
00305                 x, y, width, height));
00306     }
00307     Status DrawEllipse(const Pen *pen, const RectF& rect)
00308     {
00309         return updateStatus(DllExports::GdipDrawEllipse(
00310                 nativeGraphics, pen ? pen->nativePen : NULL,
00311                 rect.X, rect.Y, rect.Width, rect.Height));
00312     }
00313     Status DrawEllipse(const Pen *pen, const Rect& rect)
00314     {
00315         return updateStatus(DllExports::GdipDrawEllipseI(
00316                 nativeGraphics, pen ? pen->nativePen : NULL,
00317                 rect.X, rect.Y, rect.Width, rect.Height));
00318     }
00319     Status DrawImage(Image *image, REAL x, REAL y)
00320     {
00321         return updateStatus(DllExports::GdipDrawImage(
00322                 nativeGraphics,
00323                 image ? image->nativeImage : NULL,
00324                 x, y));
00325     }
00326     Status DrawImage(Image *image, INT x, INT y)
00327     {
00328         return updateStatus(DllExports::GdipDrawImageI(
00329                 nativeGraphics,
00330                 image ? image->nativeImage : NULL,
00331                 x, y));
00332     }
00333     Status DrawImage(Image *image, const PointF& point)
00334     {
00335         return updateStatus(DllExports::GdipDrawImage(
00336                 nativeGraphics,
00337                 image ? image->nativeImage : NULL,
00338                 point.X, point.Y));
00339     }
00340     Status DrawImage(Image *image, const Point& point)
00341     {
00342         return updateStatus(DllExports::GdipDrawImageI(
00343                 nativeGraphics,
00344                 image ? image->nativeImage : NULL,
00345                 point.X, point.Y));
00346     }
00347     Status DrawImage(Image *image, REAL x, REAL y, REAL width, REAL height)
00348     {
00349         return updateStatus(DllExports::GdipDrawImageRect(
00350                 nativeGraphics,
00351                 image ? image->nativeImage : NULL,
00352                 x, y, width, height));
00353     }
00354     Status DrawImage(Image *image, INT x, INT y, INT width, INT height)
00355     {
00356         return updateStatus(DllExports::GdipDrawImageRectI(
00357                 nativeGraphics,
00358                 image ? image->nativeImage : NULL,
00359                 x, y, width, height));
00360     }
00361     Status DrawImage(Image *image, const RectF& rect)
00362     {
00363         return updateStatus(DllExports::GdipDrawImageRect(
00364                 nativeGraphics,
00365                 image ? image->nativeImage : NULL,
00366                 rect.X, rect.Y, rect.Width, rect.Height));
00367     }
00368     Status DrawImage(Image *image, const Rect& rect)
00369     {
00370         return updateStatus(DllExports::GdipDrawImageRectI(
00371                 nativeGraphics,
00372                 image ? image->nativeImage : NULL,
00373                 rect.X, rect.Y, rect.Width, rect.Height));
00374     }
00375     Status DrawImage(Image *image, const PointF *destPoints, INT count)
00376     {
00377         return updateStatus(DllExports::GdipDrawImagePoints(
00378                 nativeGraphics,
00379                 image ? image->nativeImage : NULL,
00380                 destPoints, count));
00381     }
00382     Status DrawImage(Image *image, const Point *destPoints, INT count)
00383     {
00384         return updateStatus(DllExports::GdipDrawImagePointsI(
00385                 nativeGraphics,
00386                 image ? image->nativeImage : NULL,
00387                 destPoints, count));
00388     }
00389     Status DrawImage(Image *image, REAL x, REAL y, REAL srcx, REAL srcy,
00390             REAL srcwidth, REAL srcheight, Unit srcUnit)
00391     {
00392         return updateStatus(DllExports::GdipDrawImagePointRect(
00393                 nativeGraphics,
00394                 image ? image->nativeImage : NULL,
00395                 x, y, srcx, srcy, srcwidth, srcheight,
00396                 srcUnit));
00397     }
00398     Status DrawImage(Image *image, INT x, INT y, INT srcx, INT srcy,
00399             INT srcwidth, INT srcheight, Unit srcUnit)
00400     {
00401         return updateStatus(DllExports::GdipDrawImagePointRectI(
00402                 nativeGraphics,
00403                 image ? image->nativeImage : NULL,
00404                 x, y, srcx, srcy, srcwidth, srcheight,
00405                 srcUnit));
00406     }
00407     Status DrawImage(Image *image, const RectF& destRect,
00408             REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight,
00409             Unit srcUnit,
00410             const ImageAttributes *imageAttributes = NULL,
00411             DrawImageAbort callback = NULL,
00412             VOID *callbackData = NULL)
00413     {
00414         return updateStatus(DllExports::GdipDrawImageRectRect(
00415                 nativeGraphics,
00416                 image ? image->nativeImage : NULL,
00417                 destRect.X, destRect.Y,
00418                 destRect.Width, destRect.Height,
00419                 srcx, srcy, srcwidth, srcheight, srcUnit,
00420                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL,
00421                 callback, callbackData));
00422     }
00423     Status DrawImage(Image *image, const Rect& destRect,
00424             INT srcx, INT srcy, INT srcwidth, INT srcheight,
00425             Unit srcUnit,
00426             const ImageAttributes *imageAttributes = NULL,
00427             DrawImageAbort callback = NULL,
00428             VOID *callbackData = NULL)
00429     {
00430         return updateStatus(DllExports::GdipDrawImageRectRectI(
00431                 nativeGraphics,
00432                 image ? image->nativeImage : NULL,
00433                 destRect.X, destRect.Y,
00434                 destRect.Width, destRect.Height,
00435                 srcx, srcy, srcwidth, srcheight, srcUnit,
00436                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL,
00437                 callback, callbackData));
00438     }
00439     Status DrawImage(Image *image, const RectF& destRect,
00440             const RectF& sourceRect, Unit srcUnit,
00441             const ImageAttributes *imageAttributes = NULL)
00442     {
00443         return updateStatus(DllExports::GdipDrawImageRectRectI(
00444                 nativeGraphics,
00445                 image ? image->nativeImage : NULL,
00446                 destRect.X, destRect.Y,
00447                 destRect.Width, destRect.Height,
00448                 sourceRect.X, sourceRect.Y,
00449                 sourceRect.Width, sourceRect.Height, srcUnit,
00450                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL,
00451                 NULL, NULL));
00452     }
00453     Status DrawImage(Image *image, const PointF *destPoints, INT count,
00454             REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight,
00455             Unit srcUnit,
00456             const ImageAttributes *imageAttributes = NULL,
00457             DrawImageAbort callback = NULL,
00458             VOID *callbackData = NULL)
00459     {
00460         return updateStatus(DllExports::GdipDrawImagePointsRect(
00461                 nativeGraphics,
00462                 image ? image->nativeImage : NULL,
00463                 destPoints, count,
00464                 srcx, srcy, srcwidth, srcheight, srcUnit,
00465                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL,
00466                 callback, callbackData));
00467     }
00468     Status DrawImage(Image *image, const Point *destPoints, INT count,
00469             INT srcx, INT srcy, INT srcwidth, INT srcheight,
00470             Unit srcUnit,
00471             const ImageAttributes *imageAttributes = NULL,
00472             DrawImageAbort callback = NULL,
00473             VOID *callbackData = NULL)
00474     {
00475         return updateStatus(DllExports::GdipDrawImagePointsRectI(
00476                 nativeGraphics,
00477                 image ? image->nativeImage : NULL,
00478                 destPoints, count,
00479                 srcx, srcy, srcwidth, srcheight, srcUnit,
00480                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL,
00481                 callback, callbackData));
00482     }
00483     // TODO: [GDI+ 1.1] Graphics::DrawImage(..Effect..)
00484     //Status DrawImage(Image *image, RectF *sourceRect, Matrix *matrix,
00485     //      Effect *effect, ImageAttributes *imageAttributes,
00486     //      Unit srcUnit)
00487     //{
00488     //  return updateStatus(DllExports::GdipDrawImageFX(
00489     //          nativeGraphics,
00490     //          image ? image->nativeImage : NULL,
00491     //          sourceRect,
00492     //          matrix ? matrix->nativeMatrix : NULL,
00493     //          effect ? effect->nativeEffect : NULL,
00494     //          imageAttributes ? imageAttributes->nativeImageAttributes : NULL,
00495     //          srcUnit));
00496     //}
00497     Status DrawLine(const Pen *pen, REAL x1, REAL y1, REAL x2, REAL y2)
00498     {
00499         return updateStatus(DllExports::GdipDrawLine(
00500                 nativeGraphics, pen ? pen->nativePen : NULL,
00501                 x1, y1, x2, y2));
00502     }
00503     Status DrawLine(const Pen *pen, INT x1, INT y1, INT x2, INT y2)
00504     {
00505         return updateStatus(DllExports::GdipDrawLineI(
00506                 nativeGraphics, pen ? pen->nativePen : NULL,
00507                 x1, y1, x2, y2));
00508     }
00509     Status DrawLine(const Pen *pen, const PointF& pt1, const PointF& pt2)
00510     {
00511         return updateStatus(DllExports::GdipDrawLine(
00512                 nativeGraphics, pen ? pen->nativePen : NULL,
00513                 pt1.X, pt1.Y, pt2.X, pt2.Y));
00514     }
00515     Status DrawLine(const Pen *pen, const Point& pt1, const Point& pt2)
00516     {
00517         return updateStatus(DllExports::GdipDrawLineI(
00518                 nativeGraphics, pen ? pen->nativePen : NULL,
00519                 pt1.X, pt1.Y, pt2.X, pt2.Y));
00520     }
00521     Status DrawLines(const Pen *pen, const PointF *points, INT count)
00522     {
00523         return updateStatus(DllExports::GdipDrawLines(
00524                 nativeGraphics, pen ? pen->nativePen : NULL,
00525                 points, count));
00526     }
00527     Status DrawLines(const Pen *pen, const Point *points, INT count)
00528     {
00529         return updateStatus(DllExports::GdipDrawLinesI(
00530                 nativeGraphics, pen ? pen->nativePen : NULL,
00531                 points, count));
00532     }
00533     Status DrawPath(const Pen *pen, const GraphicsPath *path)
00534     {
00535         return updateStatus(DllExports::GdipDrawPath(
00536                 nativeGraphics, pen ? pen->nativePen : NULL,
00537                 path ? path->nativePath : NULL));
00538     }
00539     Status DrawPie(const Pen *pen, REAL x, REAL y, REAL width, REAL height,
00540             REAL startAngle, REAL sweepAngle)
00541     {
00542         return updateStatus(DllExports::GdipDrawPie(
00543                 nativeGraphics, pen ? pen->nativePen : NULL,
00544                 x, y, width, height, startAngle, sweepAngle));
00545     }
00546     Status DrawPie(const Pen *pen, INT x, INT y, INT width, INT height,
00547             REAL startAngle, REAL sweepAngle)
00548     {
00549         return updateStatus(DllExports::GdipDrawPieI(
00550                 nativeGraphics, pen ? pen->nativePen : NULL,
00551                 x, y, width, height, startAngle, sweepAngle));
00552     }
00553     Status DrawPie(const Pen *pen, const RectF& rect,
00554             REAL startAngle, REAL sweepAngle)
00555     {
00556         return updateStatus(DllExports::GdipDrawPie(
00557                 nativeGraphics, pen ? pen->nativePen : NULL,
00558                 rect.X, rect.Y, rect.Width, rect.Height,
00559                 startAngle, sweepAngle));
00560     }
00561     Status DrawPie(const Pen *pen, const Rect& rect,
00562             REAL startAngle, REAL sweepAngle)
00563     {
00564         return updateStatus(DllExports::GdipDrawPieI(
00565                 nativeGraphics, pen ? pen->nativePen : NULL,
00566                 rect.X, rect.Y, rect.Width, rect.Height,
00567                 startAngle, sweepAngle));
00568     }
00569     Status DrawPolygon(const Pen *pen, const PointF *points, INT count)
00570     {
00571         return updateStatus(DllExports::GdipDrawPolygon(
00572                 nativeGraphics, pen ? pen->nativePen : NULL,
00573                 points, count));
00574     }
00575     Status DrawPolygon(const Pen *pen, const Point *points, INT count)
00576     {
00577         return updateStatus(DllExports::GdipDrawPolygonI(
00578                 nativeGraphics, pen ? pen->nativePen : NULL,
00579                 points, count));
00580     }
00581     Status DrawRectangle(const Pen *pen,
00582             REAL x, REAL y, REAL width, REAL height)
00583     {
00584         return updateStatus(DllExports::GdipDrawRectangle(
00585                 nativeGraphics, pen ? pen->nativePen : NULL,
00586                 x, y, width, height));
00587     }
00588     Status DrawRectangle(const Pen *pen,
00589             INT x, INT y, INT width, INT height)
00590     {
00591         return updateStatus(DllExports::GdipDrawRectangleI(
00592                 nativeGraphics, pen ? pen->nativePen : NULL,
00593                 x, y, width, height));
00594     }
00595     Status DrawRectangle(const Pen *pen, const RectF& rect)
00596     {
00597         return updateStatus(DllExports::GdipDrawRectangle(
00598                 nativeGraphics, pen ? pen->nativePen : NULL,
00599                 rect.X, rect.Y, rect.Width, rect.Height));
00600     }
00601     Status DrawRectangle(const Pen *pen, const Rect& rect)
00602     {
00603         return updateStatus(DllExports::GdipDrawRectangleI(
00604                 nativeGraphics, pen ? pen->nativePen : NULL,
00605                 rect.X, rect.Y, rect.Width, rect.Height));
00606     }
00607     Status DrawRectangles(const Pen *pen, const RectF *rects, INT count)
00608     {
00609         return updateStatus(DllExports::GdipDrawRectangles(
00610                 nativeGraphics, pen ? pen->nativePen : NULL,
00611                 rects, count));
00612     }
00613     Status DrawRectangles(const Pen *pen, const Rect *rects, INT count)
00614     {
00615         return updateStatus(DllExports::GdipDrawRectanglesI(
00616                 nativeGraphics, pen ? pen->nativePen : NULL,
00617                 rects, count));
00618     }
00619     Status DrawString(const WCHAR *string, INT length, const Font *font,
00620             const PointF& origin, const Brush *brush)
00621     {
00622         RectF layoutRect(origin.X, origin.Y, 0.0f, 0.0f);
00623         return updateStatus(DllExports::GdipDrawString(
00624                 nativeGraphics, string, length,
00625                 font ? font->nativeFont : NULL,
00626                 &layoutRect, NULL,
00627                 brush ? brush->nativeBrush : NULL));
00628     }
00629     Status DrawString(const WCHAR *string, INT length,
00630             const Font *font, const PointF& origin,
00631             const StringFormat *stringFormat, const Brush *brush)
00632     {
00633         RectF layoutRect(origin.X, origin.Y, 0.0f, 0.0f);
00634         return updateStatus(DllExports::GdipDrawString(
00635                 nativeGraphics, string, length,
00636                 font ? font->nativeFont : NULL,
00637                 &layoutRect,
00638                 stringFormat ? stringFormat->nativeStringFormat : NULL,
00639                 brush ? brush->nativeBrush : NULL));
00640     }
00641     Status DrawString(const WCHAR *string, INT length,
00642             const Font *font, const RectF& layoutRect,
00643             const StringFormat *stringFormat, const Brush *brush)
00644     {
00645         return updateStatus(DllExports::GdipDrawString(
00646                 nativeGraphics, string, length,
00647                 font ? font->nativeFont : NULL,
00648                 &layoutRect,
00649                 stringFormat ? stringFormat->nativeStringFormat : NULL,
00650                 brush ? brush->nativeBrush : NULL));
00651     }
00652     Status EndContainer(GraphicsContainer state)
00653     {
00654         return updateStatus(DllExports::GdipEndContainer(
00655                 nativeGraphics, state));
00656     }
00657     Status EnumerateMetafile(const Metafile *metafile,
00658             const PointF& destPoint,
00659             EnumerateMetafileProc callback,
00660             VOID *callbackData = NULL,
00661             ImageAttributes *imageAttributes = NULL)
00662     {
00663         return updateStatus(DllExports::GdipEnumerateMetafileDestPoint(
00664                 nativeGraphics,
00665                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00666                 destPoint, callback, callbackData,
00667                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00668     }
00669     Status EnumerateMetafile(const Metafile *metafile,
00670             const Point& destPoint,
00671             EnumerateMetafileProc callback,
00672             VOID *callbackData = NULL,
00673             ImageAttributes *imageAttributes = NULL)
00674     {
00675         return updateStatus(DllExports::GdipEnumerateMetafileDestPointI(
00676                 nativeGraphics,
00677                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00678                 destPoint, callback, callbackData,
00679                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00680     }
00681     Status EnumerateMetafile(const Metafile *metafile,
00682             const RectF& destRect,
00683             EnumerateMetafileProc callback,
00684             VOID *callbackData = NULL,
00685             ImageAttributes *imageAttributes = NULL)
00686     {
00687         return updateStatus(DllExports::GdipEnumerateMetafileDestRect(
00688                 nativeGraphics,
00689                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00690                 destRect, callback, callbackData,
00691                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00692     }
00693     Status EnumerateMetafile(const Metafile *metafile,
00694             const Rect& destRect,
00695             EnumerateMetafileProc callback,
00696             VOID *callbackData = NULL,
00697             ImageAttributes *imageAttributes = NULL)
00698     {
00699         return updateStatus(DllExports::GdipEnumerateMetafileDestRectI(
00700                 nativeGraphics,
00701                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00702                 destRect, callback, callbackData,
00703                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00704     }
00705     Status EnumerateMetafile(const Metafile *metafile,
00706             const PointF *destPoints, INT count,
00707             EnumerateMetafileProc callback,
00708             VOID *callbackData = NULL,
00709             ImageAttributes *imageAttributes = NULL)
00710     {
00711         return updateStatus(DllExports::GdipEnumerateMetafileDestPoints(
00712                 nativeGraphics,
00713                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00714                 destPoints, count, callback, callbackData,
00715                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00716     }
00717     Status EnumerateMetafile(const Metafile *metafile,
00718             const Point *destPoints, INT count,
00719             EnumerateMetafileProc callback,
00720             VOID *callbackData = NULL,
00721             ImageAttributes *imageAttributes = NULL)
00722     {
00723         return updateStatus(DllExports::GdipEnumerateMetafileDestPointsI(
00724                 nativeGraphics,
00725                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00726                 destPoints, count, callback, callbackData,
00727                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00728     }
00729     Status EnumerateMetafile(const Metafile *metafile,
00730             const PointF& destPoint,
00731             const RectF& srcRect, Unit srcUnit,
00732             EnumerateMetafileProc callback,
00733             VOID *callbackData = NULL,
00734             ImageAttributes *imageAttributes = NULL)
00735     {
00736         return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoint(
00737                 nativeGraphics,
00738                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00739                 destPoint, srcRect, srcUnit,
00740                 callback, callbackData,
00741                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00742     }
00743     Status EnumerateMetafile(const Metafile *metafile,
00744             const Point& destPoint,
00745             const Rect& srcRect, Unit srcUnit,
00746             EnumerateMetafileProc callback,
00747             VOID *callbackData = NULL,
00748             ImageAttributes *imageAttributes = NULL)
00749     {
00750         return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointI(
00751                 nativeGraphics,
00752                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00753                 destPoint, srcRect, srcUnit,
00754                 callback, callbackData,
00755                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00756     }
00757     Status EnumerateMetafile(const Metafile *metafile,
00758             const RectF& destRect,
00759             const RectF& srcRect, Unit srcUnit,
00760             EnumerateMetafileProc callback,
00761             VOID *callbackData = NULL,
00762             ImageAttributes *imageAttributes = NULL)
00763     {
00764         return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestRect(
00765                 nativeGraphics,
00766                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00767                 destRect, srcRect, srcUnit,
00768                 callback, callbackData,
00769                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00770     }
00771     Status EnumerateMetafile(const Metafile *metafile,
00772             const Rect& destRect,
00773             const Rect& srcRect, Unit srcUnit,
00774             EnumerateMetafileProc callback,
00775             VOID *callbackData = NULL,
00776             ImageAttributes *imageAttributes = NULL)
00777     {
00778         return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestRectI(
00779                 nativeGraphics,
00780                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00781                 destRect, srcRect, srcUnit,
00782                 callback, callbackData,
00783                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00784     }
00785     Status EnumerateMetafile(const Metafile *metafile,
00786             const PointF* destPoints, INT count,
00787             const RectF& srcRect, Unit srcUnit,
00788             EnumerateMetafileProc callback,
00789             VOID *callbackData = NULL,
00790             ImageAttributes *imageAttributes = NULL)
00791     {
00792         return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoints(
00793                 nativeGraphics,
00794                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00795                 destPoints, count, srcRect, srcUnit,
00796                 callback, callbackData,
00797                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00798     }
00799     Status EnumerateMetafile(const Metafile *metafile,
00800             const Point* destPoints, INT count,
00801             const Rect& srcRect, Unit srcUnit,
00802             EnumerateMetafileProc callback,
00803             VOID *callbackData = NULL,
00804             ImageAttributes *imageAttributes = NULL)
00805     {
00806         return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointsI(
00807                 nativeGraphics,
00808                 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL,
00809                 destPoints, count, srcRect, srcUnit,
00810                 callback, callbackData,
00811                 imageAttributes ? imageAttributes->nativeImageAttributes : NULL));
00812     }
00813     Status ExcludeClip(const RectF& rect)
00814     {
00815         return updateStatus(DllExports::GdipSetClipRect(
00816                 nativeGraphics,
00817                 rect.X, rect.Y, rect.Width, rect.Height,
00818                 CombineModeExclude));
00819     }
00820     Status ExcludeClip(const Rect& rect)
00821     {
00822         return updateStatus(DllExports::GdipSetClipRectI(
00823                 nativeGraphics,
00824                 rect.X, rect.Y, rect.Width, rect.Height,
00825                 CombineModeExclude));
00826     }
00827     Status ExcludeClip(const Region *region)
00828     {
00829         return updateStatus(DllExports::GdipSetClipRegion(
00830                 nativeGraphics,
00831                 region ? region->nativeRegion : NULL,
00832                 CombineModeExclude));
00833     }
00834     Status FillClosedCurve(const Brush *brush,
00835             const PointF *points, INT count)
00836     {
00837         return updateStatus(DllExports::GdipFillClosedCurve(
00838                 nativeGraphics,
00839                 brush ? brush->nativeBrush : NULL,
00840                 points, count));
00841     }
00842     Status FillClosedCurve(const Brush *brush,
00843             const Point *points, INT count)
00844     {
00845         return updateStatus(DllExports::GdipFillClosedCurveI(
00846                 nativeGraphics,
00847                 brush ? brush->nativeBrush : NULL,
00848                 points, count));
00849     }
00850     Status FillClosedCurve(const Brush *brush,
00851             const PointF *points, INT count,
00852             FillMode fillMode, REAL tension = 0.5f)
00853     {
00854         return updateStatus(DllExports::GdipFillClosedCurve2(
00855                 nativeGraphics,
00856                 brush ? brush->nativeBrush : NULL,
00857                 points, count, tension, fillMode));
00858     }
00859     Status FillClosedCurve(const Brush *brush,
00860             const Point *points, INT count,
00861             FillMode fillMode, REAL tension = 0.5f)
00862     {
00863         return updateStatus(DllExports::GdipFillClosedCurve2I(
00864                 nativeGraphics,
00865                 brush ? brush->nativeBrush : NULL,
00866                 points, count, tension, fillMode));
00867     }
00868     Status FillEllipse(const Brush *brush,
00869             REAL x, REAL y, REAL width, REAL height)
00870     {
00871         return updateStatus(DllExports::GdipFillEllipse(
00872                 nativeGraphics,
00873                 brush ? brush->nativeBrush : NULL,
00874                 x, y, width, height));
00875     }
00876     Status FillEllipse(const Brush *brush,
00877             INT x, INT y, INT width, INT height)
00878     {
00879         return updateStatus(DllExports::GdipFillEllipseI(
00880                 nativeGraphics,
00881                 brush ? brush->nativeBrush : NULL,
00882                 x, y, width, height));
00883     }
00884     Status FillEllipse(const Brush *brush, const RectF& rect)
00885     {
00886         return updateStatus(DllExports::GdipFillEllipse(
00887                 nativeGraphics,
00888                 brush ? brush->nativeBrush : NULL,
00889                 rect.X, rect.Y, rect.Width, rect.Height));
00890     }
00891     Status FillEllipse(const Brush *brush, const Rect& rect)
00892     {
00893         return updateStatus(DllExports::GdipFillEllipseI(
00894                 nativeGraphics,
00895                 brush ? brush->nativeBrush : NULL,
00896                 rect.X, rect.Y, rect.Width, rect.Height));
00897     }
00898     Status FillPath(const Brush *brush, const GraphicsPath *path)
00899     {
00900         return updateStatus(DllExports::GdipFillPath(
00901                 nativeGraphics,
00902                 brush ? brush->nativeBrush : NULL,
00903                 path ? path->nativePath : NULL));
00904     }
00905     Status FillPie(const Brush *brush,
00906             REAL x, REAL y, REAL width, REAL height,
00907             REAL startAngle, REAL sweepAngle)
00908     {
00909         return updateStatus(DllExports::GdipFillPie(
00910                 nativeGraphics,
00911                 brush ? brush->nativeBrush : NULL,
00912                 x, y, width, height, startAngle, sweepAngle));
00913     }
00914     Status FillPie(const Brush *brush, INT x, INT y, INT width, INT height,
00915             REAL startAngle, REAL sweepAngle)
00916     {
00917         return updateStatus(DllExports::GdipFillPieI(
00918                 nativeGraphics,
00919                 brush ? brush->nativeBrush : NULL,
00920                 x, y, width, height, startAngle, sweepAngle));
00921     }
00922     Status FillPie(const Brush *brush, const RectF& rect,
00923             REAL startAngle, REAL sweepAngle)
00924     {
00925         return updateStatus(DllExports::GdipFillPie(
00926                 nativeGraphics,
00927                 brush ? brush->nativeBrush : NULL,
00928                 rect.X, rect.Y, rect.Width, rect.Height,
00929                 startAngle, sweepAngle));
00930     }
00931     Status FillPie(const Brush *brush, const Rect& rect,
00932             REAL startAngle, REAL sweepAngle)
00933     {
00934         return updateStatus(DllExports::GdipFillPieI(
00935                 nativeGraphics,
00936                 brush ? brush->nativeBrush : NULL,
00937                 rect.X, rect.Y, rect.Width, rect.Height,
00938                 startAngle, sweepAngle));
00939     }
00940     Status FillPolygon(const Brush *brush, const PointF *points, INT count)
00941     {
00942         return updateStatus(DllExports::GdipFillPolygon(
00943                 nativeGraphics,
00944                 brush ? brush->nativeBrush : NULL,
00945                 points, count, FillModeAlternate));
00946     }
00947     Status FillPolygon(const Brush *brush, const Point *points, INT count)
00948     {
00949         return updateStatus(DllExports::GdipFillPolygonI(
00950                 nativeGraphics,
00951                 brush ? brush->nativeBrush : NULL,
00952                 points, count, FillModeAlternate));
00953     }
00954     Status FillPolygon(const Brush *brush, const PointF *points, INT count,
00955             FillMode fillMode)
00956     {
00957         return updateStatus(DllExports::GdipFillPolygon(
00958                 nativeGraphics,
00959                 brush ? brush->nativeBrush : NULL,
00960                 points, count, fillMode));
00961     }
00962     Status FillPolygon(const Brush *brush, const Point *points, INT count,
00963             FillMode fillMode)
00964     {
00965         return updateStatus(DllExports::GdipFillPolygonI(
00966                 nativeGraphics,
00967                 brush ? brush->nativeBrush : NULL,
00968                 points, count, fillMode));
00969     }
00970     Status FillRectangle(const Brush *brush,
00971             REAL x, REAL y, REAL width, REAL height)
00972     {
00973         return updateStatus(DllExports::GdipFillRectangle(
00974                 nativeGraphics,
00975                 brush ? brush->nativeBrush : NULL,
00976                 x, y, width, height));
00977     }
00978     Status FillRectangle(const Brush *brush,
00979             INT x, INT y, INT width, INT height)
00980     {
00981         return updateStatus(DllExports::GdipFillRectangleI(
00982                 nativeGraphics,
00983                 brush ? brush->nativeBrush : NULL,
00984                 x, y, width, height));
00985     }
00986     Status FillRectangle(const Brush *brush, const RectF& rect)
00987     {
00988         return updateStatus(DllExports::GdipFillRectangle(
00989                 nativeGraphics,
00990                 brush ? brush->nativeBrush : NULL,
00991                 rect.X, rect.Y, rect.Width, rect.Height));
00992     }
00993     Status FillRectangle(const Brush *brush, const Rect& rect)
00994     {
00995         return updateStatus(DllExports::GdipFillRectangleI(
00996                 nativeGraphics,
00997                 brush ? brush->nativeBrush : NULL,
00998                 rect.X, rect.Y, rect.Width, rect.Height));
00999     }
01000     Status FillRectangles(const Brush *brush, const RectF *rects, INT count)
01001     {
01002         return updateStatus(DllExports::GdipFillRectangles(
01003                 nativeGraphics,
01004                 brush ? brush->nativeBrush : NULL,
01005                 rects, count));
01006     }
01007     Status FillRectangles(const Brush *brush, const Rect *rects, INT count)
01008     {
01009         return updateStatus(DllExports::GdipFillRectanglesI(
01010                 nativeGraphics,
01011                 brush ? brush->nativeBrush : NULL,
01012                 rects, count));
01013     }
01014     Status FillRegion(const Brush *brush, const Region *region)
01015     {
01016         return updateStatus(DllExports::GdipFillRegion(
01017                 nativeGraphics,
01018                 brush ? brush->nativeBrush : NULL,
01019                 region ? region->nativeRegion : NULL));
01020     }
01021     VOID Flush(FlushIntention intention = FlushIntentionFlush)
01022     {
01023         updateStatus(DllExports::GdipFlush(nativeGraphics, intention));
01024     }
01025     Status GetClip(Region *region) const
01026     {
01027         return updateStatus(DllExports::GdipGetClip(
01028                 nativeGraphics,
01029                 region ? region->nativeRegion : NULL));
01030     }
01031     Status GetClipBounds(RectF *rect) const
01032     {
01033         return updateStatus(DllExports::GdipGetClipBounds(
01034                 nativeGraphics, rect));
01035     }
01036     Status GetClipBounds(Rect *rect) const
01037     {
01038         return updateStatus(DllExports::GdipGetClipBoundsI(
01039                 nativeGraphics, rect));
01040     }
01041     CompositingMode GetCompositingMode() const
01042     {
01043         CompositingMode result = CompositingModeSourceOver;
01044         updateStatus(DllExports::GdipGetCompositingMode(
01045                 nativeGraphics, &result));
01046         return result;
01047     }
01048     CompositingQuality GetCompositingQuality() const
01049     {
01050         CompositingQuality result = CompositingQualityDefault;
01051         updateStatus(DllExports::GdipGetCompositingQuality(
01052                 nativeGraphics, &result));
01053         return result;
01054     }
01055     REAL GetDpiX() const
01056     {
01057         REAL result = 0.0f;
01058         updateStatus(DllExports::GdipGetDpiX(nativeGraphics, &result));
01059         return result;
01060     }
01061     REAL GetDpiY() const
01062     {
01063         REAL result = 0.0f;
01064         updateStatus(DllExports::GdipGetDpiY(nativeGraphics, &result));
01065         return result;
01066     }
01067     HDC GetHDC()
01068     {
01069         HDC result = NULL;
01070         updateStatus(DllExports::GdipGetDC(nativeGraphics, &result));
01071         return result;
01072     }
01073     InterpolationMode GetInterpolationMode() const
01074     {
01075         InterpolationMode result = InterpolationModeDefault;
01076         updateStatus(DllExports::GdipGetInterpolationMode(
01077                 nativeGraphics, &result));
01078         return result;
01079     }
01080     Status GetLastStatus() const
01081     {
01082         Status result = lastStatus;
01083         lastStatus = Ok;
01084         return result;
01085     }
01086     Status GetNearestColor(Color *color) const
01087     {
01088         return updateStatus(DllExports::GdipGetNearestColor(
01089                 nativeGraphics, color ? &color->Value : NULL));
01090     }
01091     REAL GetPageScale() const
01092     {
01093         REAL result = 0.0f;
01094         updateStatus(DllExports::GdipGetPageScale(
01095                 nativeGraphics, &result));
01096         return result;
01097     }
01098     Unit GetPageUnit() const
01099     {
01100         Unit result = UnitWorld;
01101         updateStatus(DllExports::GdipGetPageUnit(
01102                 nativeGraphics, &result));
01103         return result;
01104     }
01105     PixelOffsetMode GetPixelOffsetMode() const
01106     {
01107         PixelOffsetMode result = PixelOffsetModeDefault;
01108         updateStatus(DllExports::GdipGetPixelOffsetMode(
01109                 nativeGraphics, &result));
01110         return result;
01111     }
01112     Status GetRenderingOrigin(INT *x, INT *y) const
01113     {
01114         return updateStatus(DllExports::GdipGetRenderingOrigin(
01115                 nativeGraphics, x, y));
01116     }
01117     SmoothingMode GetSmoothingMode() const
01118     {
01119         SmoothingMode result = SmoothingModeDefault;
01120         updateStatus(DllExports::GdipGetSmoothingMode(
01121                 nativeGraphics, &result));
01122         return result;
01123     }
01124     UINT GetTextContrast() const
01125     {
01126         UINT result = 0;
01127         updateStatus(DllExports::GdipGetTextContrast(
01128                 nativeGraphics, &result));
01129         return result;
01130     }
01131     TextRenderingHint GetTextRenderingHint() const
01132     {
01133         TextRenderingHint result = TextRenderingHintSystemDefault;
01134         updateStatus(DllExports::GdipGetTextRenderingHint(
01135                 nativeGraphics, &result));
01136         return result;
01137     }
01138     Status GetTransform(Matrix *matrix) const
01139     {
01140         return updateStatus(DllExports::GdipGetWorldTransform(
01141                 nativeGraphics,
01142                 matrix ? matrix->nativeMatrix : NULL));
01143     }
01144     Status GetVisibleClipBounds(RectF *rect) const
01145     {
01146         return updateStatus(DllExports::GdipGetVisibleClipBounds(
01147                 nativeGraphics, rect));
01148     }
01149     Status GetVisibleClipBounds(Rect *rect) const
01150     {
01151         return updateStatus(DllExports::GdipGetVisibleClipBoundsI(
01152                 nativeGraphics, rect));
01153     }
01154     Status IntersectClip(const RectF& rect)
01155     {
01156         return updateStatus(DllExports::GdipSetClipRect(
01157                 nativeGraphics,
01158                 rect.X, rect.Y, rect.Width, rect.Height,
01159                 CombineModeIntersect));
01160     }
01161     Status IntersectClip(const Rect& rect)
01162     {
01163         return updateStatus(DllExports::GdipSetClipRectI(
01164                 nativeGraphics,
01165                 rect.X, rect.Y, rect.Width, rect.Height,
01166                 CombineModeIntersect));
01167     }
01168     Status IntersectClip(const Region *region)
01169     {
01170         return updateStatus(DllExports::GdipSetClipRegion(
01171                 nativeGraphics,
01172                 region ? region->nativeRegion : NULL,
01173                 CombineModeIntersect));
01174     }
01175     BOOL IsClipEmpty() const
01176     {
01177         BOOL result = FALSE;
01178         updateStatus(DllExports::GdipIsClipEmpty(
01179                 nativeGraphics, &result));
01180         return result;
01181     }
01182     BOOL IsVisible(REAL x, REAL y) const
01183     {
01184         BOOL result = FALSE;
01185         updateStatus(DllExports::GdipIsVisiblePoint(
01186                 nativeGraphics, x, y, &result));
01187         return result;
01188     }
01189     BOOL IsVisible(INT x, INT y) const
01190     {
01191         BOOL result = FALSE;
01192         updateStatus(DllExports::GdipIsVisiblePointI(
01193                 nativeGraphics, x, y, &result));
01194         return result;
01195     }
01196     BOOL IsVisible(const PointF& point) const
01197     {
01198         BOOL result = FALSE;
01199         updateStatus(DllExports::GdipIsVisiblePoint(
01200                 nativeGraphics, point.X, point.Y, &result));
01201         return result;
01202     }
01203     BOOL IsVisible(const Point& point) const
01204     {
01205         BOOL result = FALSE;
01206         updateStatus(DllExports::GdipIsVisiblePointI(
01207                 nativeGraphics, point.X, point.Y, &result));
01208         return result;
01209     }
01210     BOOL IsVisible(REAL x, REAL y, REAL width, REAL height) const
01211     {
01212         BOOL result = FALSE;
01213         updateStatus(DllExports::GdipIsVisibleRect(
01214                 nativeGraphics, x, y, width, height, &result));
01215         return result;
01216     }
01217     BOOL IsVisible(INT x, INT y, INT width, INT height) const
01218     {
01219         BOOL result = FALSE;
01220         updateStatus(DllExports::GdipIsVisibleRectI(
01221                 nativeGraphics, x, y, width, height, &result));
01222         return result;
01223     }
01224     BOOL IsVisible(const RectF& rect) const
01225     {
01226         BOOL result = FALSE;
01227         updateStatus(DllExports::GdipIsVisibleRect(
01228                 nativeGraphics, rect.X, rect.Y,
01229                 rect.Width, rect.Height, &result));
01230         return result;
01231     }
01232     BOOL IsVisible(const Rect& rect) const
01233     {
01234         BOOL result = FALSE;
01235         updateStatus(DllExports::GdipIsVisibleRectI(
01236                 nativeGraphics, rect.X, rect.Y,
01237                 rect.Width, rect.Height, &result));
01238         return result;
01239     }
01240     BOOL IsVisibleClipEmpty() const
01241     {
01242         BOOL result = FALSE;
01243         updateStatus(DllExports::GdipIsVisibleClipEmpty(
01244                 nativeGraphics, &result));
01245         return result;
01246     }
01247     Status MeasureCharacterRanges(const WCHAR *string, INT length,
01248             const Font *font, const RectF& layoutRect,
01249             const StringFormat *stringFormat,
01250             INT regionCount, Region *regions) const
01251     {
01252         if (regionCount <= 0 || !regions)
01253             return lastStatus = InvalidParameter;
01254 
01255         GpRegion **nativeRegionArray = (GpRegion**)
01256             DllExports::GdipAlloc(regionCount * sizeof(GpRegion*));
01257         if (!nativeRegionArray)
01258             return lastStatus = OutOfMemory;
01259         for (int i = 0; i < regionCount; ++i) {
01260             nativeRegionArray[i] = regions[i].nativeRegion;
01261         }
01262         Status status = updateStatus(DllExports::GdipMeasureCharacterRanges(
01263                 nativeGraphics, string, length,
01264                 font ? font->nativeFont : NULL,
01265                 layoutRect,
01266                 stringFormat ? stringFormat->nativeStringFormat : NULL,
01267                 regionCount, nativeRegionArray));
01268         DllExports::GdipFree(nativeRegionArray);
01269         return status;
01270     }
01271     Status MeasureDriverString(const UINT16 *text, INT length,
01272             const Font *font, const PointF *positions, INT flags,
01273             const Matrix *matrix, RectF *boundingBox) const
01274     {
01275         return updateStatus(DllExports::GdipMeasureDriverString(
01276                 nativeGraphics, text, length,
01277                 font ? font->nativeFont : NULL,
01278                 positions, flags,
01279                 matrix ? matrix->nativeMatrix : NULL,
01280                 boundingBox));
01281     }
01282     Status MeasureString(const WCHAR *string, INT length,
01283             const Font *font, const RectF& layoutRect,
01284             RectF *boundingBox) const
01285     {
01286         return updateStatus(DllExports::GdipMeasureString(
01287                 nativeGraphics, string, length,
01288                 font ? font->nativeFont : NULL,
01289                 &layoutRect, NULL, boundingBox, NULL, NULL));
01290     }
01291     Status MeasureString(const WCHAR *string, INT length,
01292             const Font *font, const RectF& layoutRect,
01293             const StringFormat *stringFormat, RectF *boundingBox,
01294             INT *codepointsFitted = NULL,
01295             INT *linesFitted = NULL) const
01296     {
01297         return updateStatus(DllExports::GdipMeasureString(
01298                 nativeGraphics, string, length,
01299                 font ? font->nativeFont : NULL,
01300                 &layoutRect,
01301                 stringFormat ? stringFormat->nativeStringFormat : NULL,
01302                 boundingBox, codepointsFitted, linesFitted));
01303     }
01304     Status MeasureString(const WCHAR *string, INT length,
01305             const Font *font, const SizeF& layoutRectSize,
01306             const StringFormat *stringFormat, SizeF *size,
01307             INT *codepointsFitted = NULL,
01308             INT *linesFitted = NULL) const
01309     {
01310         if (!size) return lastStatus = InvalidParameter;
01311         RectF layoutRect(PointF(0.0f, 0.0f), layoutRectSize);
01312         RectF boundingBox;
01313         Status status = updateStatus(DllExports::GdipMeasureString(
01314                 nativeGraphics, string, length,
01315                 font ? font->nativeFont : NULL,
01316                 &layoutRect,
01317                 stringFormat ? stringFormat->nativeStringFormat : NULL,
01318                 &boundingBox, codepointsFitted, linesFitted));
01319         boundingBox.GetSize(size);
01320         return status;
01321     }
01322     Status MeasureString(const WCHAR *string, INT length,
01323             const Font *font, const PointF& origin,
01324             RectF *boundingBox) const
01325     {
01326         RectF layoutRect(origin, SizeF(0.0f, 0.0f));
01327         return updateStatus(DllExports::GdipMeasureString(
01328                 nativeGraphics, string, length,
01329                 font ? font->nativeFont : NULL,
01330                 &layoutRect, NULL, boundingBox, NULL, NULL));
01331     }
01332     Status MeasureString(const WCHAR *string, INT length,
01333             const Font *font, const PointF& origin,
01334             const StringFormat *stringFormat,
01335             RectF *boundingBox) const
01336     {
01337         RectF layoutRect(origin, SizeF(0.0f, 0.0f));
01338         return updateStatus(DllExports::GdipMeasureString(
01339                 nativeGraphics, string, length,
01340                 font ? font->nativeFont : NULL,
01341                 &layoutRect,
01342                 stringFormat ? stringFormat->nativeStringFormat : NULL,
01343                 boundingBox, NULL, NULL));
01344     }
01345     Status MultiplyTransform(const Matrix *matrix,
01346             MatrixOrder order = MatrixOrderPrepend)
01347     {
01348         return updateStatus(DllExports::GdipMultiplyWorldTransform(
01349                 nativeGraphics,
01350                 matrix ? matrix->nativeMatrix : NULL, order));
01351     }
01352     VOID ReleaseHDC(HDC hdc)
01353     {
01354         updateStatus(DllExports::GdipReleaseDC(nativeGraphics, hdc));
01355     }
01356     Status ResetClip()
01357     {
01358         return updateStatus(DllExports::GdipResetClip(nativeGraphics));
01359     }
01360     Status ResetTransform()
01361     {
01362         return updateStatus(DllExports::GdipResetWorldTransform(
01363                 nativeGraphics));
01364     }
01365     Status Restore(GraphicsState state)
01366     {
01367         return updateStatus(DllExports::GdipRestoreGraphics(
01368                 nativeGraphics, state));
01369     }
01370     Status RotateTransform(REAL angle,
01371             MatrixOrder order = MatrixOrderPrepend)
01372     {
01373         return updateStatus(DllExports::GdipRotateWorldTransform(
01374                 nativeGraphics, angle, order));
01375     }
01376     GraphicsState Save() const
01377     {
01378         GraphicsState result = 0;
01379         updateStatus(DllExports::GdipSaveGraphics(
01380                 nativeGraphics, &result));
01381         return result;
01382     }
01383     Status ScaleTransform(REAL sx, REAL sy,
01384             MatrixOrder order = MatrixOrderPrepend)
01385     {
01386         return updateStatus(DllExports::GdipScaleWorldTransform(
01387                 nativeGraphics, sx, sy, order));
01388     }
01389     VOID SetAbort()
01390     {
01391         updateStatus(NotImplemented);
01392     }
01393     Status SetClip(const Graphics *g,
01394             CombineMode combineMode = CombineModeReplace)
01395     {
01396         return updateStatus(DllExports::GdipSetClipGraphics(
01397                 nativeGraphics, g ? g->nativeGraphics : NULL,
01398                 combineMode));
01399     }
01400     Status SetClip(const RectF& rect,
01401             CombineMode combineMode = CombineModeReplace)
01402     {
01403         return updateStatus(DllExports::GdipSetClipRect(
01404                 nativeGraphics,
01405                 rect.X, rect.Y, rect.Width, rect.Height,
01406                 combineMode));
01407     }
01408     Status SetClip(const Rect& rect,
01409             CombineMode combineMode = CombineModeReplace)
01410     {
01411         return updateStatus(DllExports::GdipSetClipRectI(
01412                 nativeGraphics,
01413                 rect.X, rect.Y, rect.Width, rect.Height,
01414                 combineMode));
01415     }
01416     Status SetClip(const GraphicsPath *path,
01417             CombineMode combineMode = CombineModeReplace)
01418     {
01419         return updateStatus(DllExports::GdipSetClipPath(
01420                 nativeGraphics,
01421                 path ? path->nativePath : NULL,
01422                 combineMode));
01423     }
01424     Status SetClip(const Region *region,
01425             CombineMode combineMode = CombineModeReplace)
01426     {
01427         return updateStatus(DllExports::GdipSetClipRegion(
01428                 nativeGraphics,
01429                 region ? region->nativeRegion : NULL,
01430                 combineMode));
01431     }
01432     Status SetClip(HRGN hRgn, CombineMode combineMode = CombineModeReplace)
01433     {
01434         return updateStatus(DllExports::GdipSetClipHrgn(
01435                 nativeGraphics, hRgn, combineMode));
01436     }
01437     Status SetCompositingMode(CompositingMode compositingMode)
01438     {
01439         return updateStatus(DllExports::GdipSetCompositingMode(
01440                 nativeGraphics, compositingMode));
01441     }
01442     Status SetCompositingQuality(CompositingQuality compositingQuality)
01443     {
01444         return updateStatus(DllExports::GdipSetCompositingQuality(
01445                 nativeGraphics, compositingQuality));
01446     }
01447     Status SetInterpolationMode(InterpolationMode interpolationMode)
01448     {
01449         return updateStatus(DllExports::GdipSetInterpolationMode(
01450                 nativeGraphics, interpolationMode));
01451     }
01452     Status SetPageScale(REAL scale)
01453     {
01454         return updateStatus(DllExports::GdipSetPageScale(
01455                 nativeGraphics, scale));
01456     }
01457     Status SetPageUnit(Unit unit)
01458     {
01459         return updateStatus(DllExports::GdipSetPageUnit(
01460                 nativeGraphics, unit));
01461     }
01462     Status SetPixelOffsetMode(PixelOffsetMode pixelOffsetMode)
01463     {
01464         return updateStatus(DllExports::GdipSetPixelOffsetMode(
01465                 nativeGraphics, pixelOffsetMode));
01466     }
01467     Status SetRenderingOrigin(INT x, INT y)
01468     {
01469         return updateStatus(DllExports::GdipSetRenderingOrigin(
01470                 nativeGraphics, x, y));
01471     }
01472     Status SetSmoothingMode(SmoothingMode smoothingMode)
01473     {
01474         return updateStatus(DllExports::GdipSetSmoothingMode(
01475                 nativeGraphics, smoothingMode));
01476     }
01477     Status SetTextContrast(UINT contrast)
01478     {
01479         return updateStatus(DllExports::GdipSetTextContrast(
01480                 nativeGraphics, contrast));
01481     }
01482     Status SetTextRenderingHint(TextRenderingHint textRenderingHint)
01483     {
01484         return updateStatus(DllExports::GdipSetTextRenderingHint(
01485                 nativeGraphics, textRenderingHint));
01486     }
01487     Status SetTransform(const Matrix *matrix)
01488     {
01489         return updateStatus(DllExports::GdipSetWorldTransform(
01490                 nativeGraphics,
01491                 matrix ? matrix->nativeMatrix : NULL));
01492     }
01493     Status TransformPoints(CoordinateSpace destSpace,
01494             CoordinateSpace srcSpace,
01495             PointF *pts, INT count) const
01496     {
01497         return updateStatus(DllExports::GdipTransformPoints(
01498                 nativeGraphics, destSpace, srcSpace,
01499                 pts, count));
01500     }
01501     Status TransformPoints(CoordinateSpace destSpace,
01502             CoordinateSpace srcSpace,
01503             Point *pts, INT count) const
01504     {
01505         return updateStatus(DllExports::GdipTransformPointsI(
01506                 nativeGraphics, destSpace, srcSpace,
01507                 pts, count));
01508     }
01509     Status TranslateClip(REAL dx, REAL dy)
01510     {
01511         return updateStatus(DllExports::GdipTranslateClip(
01512                 nativeGraphics, dx, dy));
01513     }
01514     Status TranslateClip(INT dx, INT dy)
01515     {
01516         return updateStatus(DllExports::GdipTranslateClipI(
01517                 nativeGraphics, dx, dy));
01518     }
01519     Status TranslateTransform(REAL dx, REAL dy,
01520             MatrixOrder order = MatrixOrderPrepend)
01521     {
01522         return updateStatus(DllExports::GdipTranslateWorldTransform(
01523                 nativeGraphics, dx, dy, order));
01524     }
01525 
01526 private:
01527     Graphics(const Graphics&);
01528     Graphics& operator=(const Graphics&);
01529 
01530     Status updateStatus(Status newStatus) const
01531     {
01532         if (newStatus != Ok) lastStatus = newStatus;
01533         return newStatus;
01534     }
01535 
01536     GpGraphics *nativeGraphics;
01537     mutable Status lastStatus;
01538 };
01539 
01540 #endif /* __GDIPLUS_GRAPHICS_H */