1 /** 2 * @file gdiplusgraphics.h 3 * Copyright 2012, 2013 MinGW.org project 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the next 13 * paragraph) shall be included in all copies or substantial portions of the 14 * Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 * DEALINGS IN THE SOFTWARE. 23 */ 24 /* Created by Markus Koenig <markus@stber-koenig.de> */ 25 #ifndef __GDIPLUS_GRAPHICS_H 26 #define __GDIPLUS_GRAPHICS_H 27 #pragma GCC system_header 28 #include <_mingw.h> 29 30 /* 31 * GDI+ Graphics class 32 */ 33 34 #ifndef __cplusplus 35 #error "A C++ compiler is required to include gdiplusgraphics.h." 36 #endif 37 38 class Graphics: public GdiplusBase 39 { 40 friend class Bitmap; 41 friend class CachedBitmap; 42 friend class Font; 43 friend class GraphicsPath; 44 friend class Metafile; 45 friend class Region; 46 47 public: FromHDC(HDC hdc)48 static Graphics* FromHDC(HDC hdc) 49 { 50 return new Graphics(hdc); 51 } FromHDC(HDC hdc,HANDLE hdevice)52 static Graphics* FromHDC(HDC hdc, HANDLE hdevice) 53 { 54 return new Graphics(hdc, hdevice); 55 } 56 static Graphics* FromHWND(HWND hwnd, BOOL icm = FALSE) 57 { 58 return new Graphics(hwnd, icm); 59 } FromImage(Image * image)60 static Graphics* FromImage(Image *image) 61 { 62 return new Graphics(image); 63 } GetHalftonePalette()64 static HPALETTE GetHalftonePalette() 65 { 66 return DllExports::GdipCreateHalftonePalette(); 67 } 68 Graphics(Image * image)69 Graphics(Image *image): nativeGraphics(NULL), lastStatus(Ok) 70 { 71 lastStatus = DllExports::GdipGetImageGraphicsContext( 72 image ? image->nativeImage : NULL, 73 &nativeGraphics); 74 } Graphics(HDC hdc)75 Graphics(HDC hdc): nativeGraphics(NULL), lastStatus(Ok) 76 { 77 lastStatus = DllExports::GdipCreateFromHDC( 78 hdc, &nativeGraphics); 79 } Graphics(HDC hdc,HANDLE hdevice)80 Graphics(HDC hdc, HANDLE hdevice): nativeGraphics(NULL), lastStatus(Ok) 81 { 82 lastStatus = DllExports::GdipCreateFromHDC2( 83 hdc, hdevice, &nativeGraphics); 84 } 85 Graphics(HWND hwnd, BOOL icm = FALSE): nativeGraphics(NULL)86 nativeGraphics(NULL), lastStatus(Ok) 87 { 88 if (icm) { 89 lastStatus = DllExports::GdipCreateFromHWNDICM( 90 hwnd, &nativeGraphics); 91 } else { 92 lastStatus = DllExports::GdipCreateFromHWND( 93 hwnd, &nativeGraphics); 94 } 95 } ~Graphics()96 ~Graphics() 97 { 98 DllExports::GdipDeleteGraphics(nativeGraphics); 99 } 100 AddMetafileComment(const BYTE * data,UINT sizeData)101 Status AddMetafileComment(const BYTE *data, UINT sizeData) 102 { 103 return updateStatus(DllExports::GdipComment( 104 nativeGraphics, sizeData, data)); 105 } BeginContainer()106 GraphicsContainer BeginContainer() 107 { 108 GraphicsContainer result = 0; 109 updateStatus(DllExports::GdipBeginContainer2( 110 nativeGraphics, &result)); 111 return result; 112 } BeginContainer(const RectF & dstrect,const RectF & srcrect,Unit unit)113 GraphicsContainer BeginContainer(const RectF& dstrect, 114 const RectF& srcrect, Unit unit) 115 { 116 GraphicsContainer result = 0; 117 updateStatus(DllExports::GdipBeginContainer( 118 nativeGraphics, &dstrect, &srcrect, unit, 119 &result)); 120 return result; 121 } BeginContainer(const Rect & dstrect,const Rect & srcrect,Unit unit)122 GraphicsContainer BeginContainer(const Rect& dstrect, 123 const Rect& srcrect, Unit unit) 124 { 125 GraphicsContainer result = 0; 126 updateStatus(DllExports::GdipBeginContainerI( 127 nativeGraphics, &dstrect, &srcrect, unit, 128 &result)); 129 return result; 130 } Clear(const Color & color)131 Status Clear(const Color& color) 132 { 133 return updateStatus(DllExports::GdipGraphicsClear( 134 nativeGraphics, color.GetValue())); 135 } DrawArc(const Pen * pen,REAL x,REAL y,REAL width,REAL height,REAL startAngle,REAL sweepAngle)136 Status DrawArc(const Pen *pen, REAL x, REAL y, REAL width, REAL height, 137 REAL startAngle, REAL sweepAngle) 138 { 139 return updateStatus(DllExports::GdipDrawArc( 140 nativeGraphics, pen ? pen->nativePen : NULL, 141 x, y, width, height, startAngle, sweepAngle)); 142 } DrawArc(const Pen * pen,INT x,INT y,INT width,INT height,REAL startAngle,REAL sweepAngle)143 Status DrawArc(const Pen *pen, INT x, INT y, INT width, INT height, 144 REAL startAngle, REAL sweepAngle) 145 { 146 return updateStatus(DllExports::GdipDrawArcI( 147 nativeGraphics, pen ? pen->nativePen : NULL, 148 x, y, width, height, startAngle, sweepAngle)); 149 } DrawArc(const Pen * pen,const RectF & rect,REAL startAngle,REAL sweepAngle)150 Status DrawArc(const Pen *pen, const RectF& rect, 151 REAL startAngle, REAL sweepAngle) 152 { 153 return updateStatus(DllExports::GdipDrawArc( 154 nativeGraphics, pen ? pen->nativePen : NULL, 155 rect.X, rect.Y, rect.Width, rect.Height, 156 startAngle, sweepAngle)); 157 } DrawArc(const Pen * pen,const Rect & rect,REAL startAngle,REAL sweepAngle)158 Status DrawArc(const Pen *pen, const Rect& rect, 159 REAL startAngle, REAL sweepAngle) 160 { 161 return updateStatus(DllExports::GdipDrawArcI( 162 nativeGraphics, pen ? pen->nativePen : NULL, 163 rect.X, rect.Y, rect.Width, rect.Height, 164 startAngle, sweepAngle)); 165 } DrawBezier(const Pen * pen,REAL x1,REAL y1,REAL x2,REAL y2,REAL x3,REAL y3,REAL x4,REAL y4)166 Status DrawBezier(const Pen *pen, 167 REAL x1, REAL y1, REAL x2, REAL y2, 168 REAL x3, REAL y3, REAL x4, REAL y4) 169 { 170 return updateStatus(DllExports::GdipDrawBezier( 171 nativeGraphics, pen ? pen->nativePen : NULL, 172 x1, y1, x2, y2, x3, y3, x4, y4)); 173 } DrawBezier(const Pen * pen,INT x1,INT y1,INT x2,INT y2,INT x3,INT y3,INT x4,INT y4)174 Status DrawBezier(const Pen *pen, 175 INT x1, INT y1, INT x2, INT y2, 176 INT x3, INT y3, INT x4, INT y4) 177 { 178 return updateStatus(DllExports::GdipDrawBezierI( 179 nativeGraphics, pen ? pen->nativePen : NULL, 180 x1, y1, x2, y2, x3, y3, x4, y4)); 181 } DrawBezier(const Pen * pen,const PointF & pt1,const PointF & pt2,const PointF & pt3,const PointF & pt4)182 Status DrawBezier(const Pen *pen, 183 const PointF& pt1, const PointF& pt2, 184 const PointF& pt3, const PointF& pt4) 185 { 186 return updateStatus(DllExports::GdipDrawBezier( 187 nativeGraphics, pen ? pen->nativePen : NULL, 188 pt1.X, pt1.Y, pt2.X, pt2.Y, 189 pt3.X, pt3.Y, pt4.X, pt4.Y)); 190 } DrawBezier(const Pen * pen,const Point & pt1,const Point & pt2,const Point & pt3,const Point & pt4)191 Status DrawBezier(const Pen *pen, 192 const Point& pt1, const Point& pt2, 193 const Point& pt3, const Point& pt4) 194 { 195 return updateStatus(DllExports::GdipDrawBezierI( 196 nativeGraphics, pen ? pen->nativePen : NULL, 197 pt1.X, pt1.Y, pt2.X, pt2.Y, 198 pt3.X, pt3.Y, pt4.X, pt4.Y)); 199 } DrawBeziers(const Pen * pen,const PointF * points,INT count)200 Status DrawBeziers(const Pen *pen, const PointF *points, INT count) 201 { 202 return updateStatus(DllExports::GdipDrawBeziers( 203 nativeGraphics, pen ? pen->nativePen : NULL, 204 points, count)); 205 } DrawBeziers(const Pen * pen,const Point * points,INT count)206 Status DrawBeziers(const Pen *pen, const Point *points, INT count) 207 { 208 return updateStatus(DllExports::GdipDrawBeziersI( 209 nativeGraphics, pen ? pen->nativePen : NULL, 210 points, count)); 211 } DrawCachedBitmap(CachedBitmap * cb,INT x,INT y)212 Status DrawCachedBitmap(CachedBitmap *cb, INT x, INT y) 213 { 214 return updateStatus(DllExports::GdipDrawCachedBitmap( 215 nativeGraphics, 216 cb ? cb->nativeCachedBitmap : NULL, 217 x, y)); 218 } DrawClosedCurve(const Pen * pen,const PointF * points,INT count)219 Status DrawClosedCurve(const Pen *pen, const PointF *points, INT count) 220 { 221 return updateStatus(DllExports::GdipDrawClosedCurve( 222 nativeGraphics, pen ? pen->nativePen : NULL, 223 points, count)); 224 } DrawClosedCurve(const Pen * pen,const Point * points,INT count)225 Status DrawClosedCurve(const Pen *pen, const Point *points, INT count) 226 { 227 return updateStatus(DllExports::GdipDrawClosedCurveI( 228 nativeGraphics, pen ? pen->nativePen : NULL, 229 points, count)); 230 } DrawClosedCurve(const Pen * pen,const PointF * points,INT count,REAL tension)231 Status DrawClosedCurve(const Pen *pen, const PointF *points, INT count, 232 REAL tension) 233 { 234 return updateStatus(DllExports::GdipDrawClosedCurve2( 235 nativeGraphics, pen ? pen->nativePen : NULL, 236 points, count, tension)); 237 } DrawClosedCurve(const Pen * pen,const Point * points,INT count,REAL tension)238 Status DrawClosedCurve(const Pen *pen, const Point *points, INT count, 239 REAL tension) 240 { 241 return updateStatus(DllExports::GdipDrawClosedCurve2I( 242 nativeGraphics, pen ? pen->nativePen : NULL, 243 points, count, tension)); 244 } DrawCurve(const Pen * pen,const PointF * points,INT count)245 Status DrawCurve(const Pen *pen, const PointF *points, INT count) 246 { 247 return updateStatus(DllExports::GdipDrawCurve( 248 nativeGraphics, pen ? pen->nativePen : NULL, 249 points, count)); 250 } DrawCurve(const Pen * pen,const Point * points,INT count)251 Status DrawCurve(const Pen *pen, const Point *points, INT count) 252 { 253 return updateStatus(DllExports::GdipDrawCurveI( 254 nativeGraphics, pen ? pen->nativePen : NULL, 255 points, count)); 256 } DrawCurve(const Pen * pen,const PointF * points,INT count,REAL tension)257 Status DrawCurve(const Pen *pen, const PointF *points, INT count, 258 REAL tension) 259 { 260 return updateStatus(DllExports::GdipDrawCurve2( 261 nativeGraphics, pen ? pen->nativePen : NULL, 262 points, count, tension)); 263 } DrawCurve(const Pen * pen,const Point * points,INT count,REAL tension)264 Status DrawCurve(const Pen *pen, const Point *points, INT count, 265 REAL tension) 266 { 267 return updateStatus(DllExports::GdipDrawCurve2I( 268 nativeGraphics, pen ? pen->nativePen : NULL, 269 points, count, tension)); 270 } DrawCurve(const Pen * pen,const PointF * points,INT count,INT offset,INT numberOfSegments,REAL tension)271 Status DrawCurve(const Pen *pen, const PointF *points, INT count, 272 INT offset, INT numberOfSegments, REAL tension) 273 { 274 return updateStatus(DllExports::GdipDrawCurve3( 275 nativeGraphics, pen ? pen->nativePen : NULL, 276 points, count, offset, 277 numberOfSegments, tension)); 278 } DrawCurve(const Pen * pen,const Point * points,INT count,INT offset,INT numberOfSegments,REAL tension)279 Status DrawCurve(const Pen *pen, const Point *points, INT count, 280 INT offset, INT numberOfSegments, REAL tension) 281 { 282 return updateStatus(DllExports::GdipDrawCurve3I( 283 nativeGraphics, pen ? pen->nativePen : NULL, 284 points, count, offset, 285 numberOfSegments, tension)); 286 } DrawDriverString(const UINT16 * text,INT length,const Font * font,const Brush * brush,const PointF * positions,INT flags,const Matrix * matrix)287 Status DrawDriverString(const UINT16 *text, INT length, 288 const Font *font, const Brush *brush, 289 const PointF *positions, INT flags, 290 const Matrix *matrix) 291 { 292 return updateStatus(DllExports::GdipDrawDriverString( 293 nativeGraphics, text, length, 294 font ? font->nativeFont : NULL, 295 brush ? brush->nativeBrush : NULL, 296 positions, flags, 297 matrix ? matrix->nativeMatrix : NULL)); 298 } DrawEllipse(const Pen * pen,REAL x,REAL y,REAL width,REAL height)299 Status DrawEllipse(const Pen *pen, 300 REAL x, REAL y, REAL width, REAL height) 301 { 302 return updateStatus(DllExports::GdipDrawEllipse( 303 nativeGraphics, pen ? pen->nativePen : NULL, 304 x, y, width, height)); 305 } DrawEllipse(const Pen * pen,INT x,INT y,INT width,INT height)306 Status DrawEllipse(const Pen *pen, INT x, INT y, INT width, INT height) 307 { 308 return updateStatus(DllExports::GdipDrawEllipseI( 309 nativeGraphics, pen ? pen->nativePen : NULL, 310 x, y, width, height)); 311 } DrawEllipse(const Pen * pen,const RectF & rect)312 Status DrawEllipse(const Pen *pen, const RectF& rect) 313 { 314 return updateStatus(DllExports::GdipDrawEllipse( 315 nativeGraphics, pen ? pen->nativePen : NULL, 316 rect.X, rect.Y, rect.Width, rect.Height)); 317 } DrawEllipse(const Pen * pen,const Rect & rect)318 Status DrawEllipse(const Pen *pen, const Rect& rect) 319 { 320 return updateStatus(DllExports::GdipDrawEllipseI( 321 nativeGraphics, pen ? pen->nativePen : NULL, 322 rect.X, rect.Y, rect.Width, rect.Height)); 323 } DrawImage(Image * image,REAL x,REAL y)324 Status DrawImage(Image *image, REAL x, REAL y) 325 { 326 return updateStatus(DllExports::GdipDrawImage( 327 nativeGraphics, 328 image ? image->nativeImage : NULL, 329 x, y)); 330 } DrawImage(Image * image,INT x,INT y)331 Status DrawImage(Image *image, INT x, INT y) 332 { 333 return updateStatus(DllExports::GdipDrawImageI( 334 nativeGraphics, 335 image ? image->nativeImage : NULL, 336 x, y)); 337 } DrawImage(Image * image,const PointF & point)338 Status DrawImage(Image *image, const PointF& point) 339 { 340 return updateStatus(DllExports::GdipDrawImage( 341 nativeGraphics, 342 image ? image->nativeImage : NULL, 343 point.X, point.Y)); 344 } DrawImage(Image * image,const Point & point)345 Status DrawImage(Image *image, const Point& point) 346 { 347 return updateStatus(DllExports::GdipDrawImageI( 348 nativeGraphics, 349 image ? image->nativeImage : NULL, 350 point.X, point.Y)); 351 } DrawImage(Image * image,REAL x,REAL y,REAL width,REAL height)352 Status DrawImage(Image *image, REAL x, REAL y, REAL width, REAL height) 353 { 354 return updateStatus(DllExports::GdipDrawImageRect( 355 nativeGraphics, 356 image ? image->nativeImage : NULL, 357 x, y, width, height)); 358 } DrawImage(Image * image,INT x,INT y,INT width,INT height)359 Status DrawImage(Image *image, INT x, INT y, INT width, INT height) 360 { 361 return updateStatus(DllExports::GdipDrawImageRectI( 362 nativeGraphics, 363 image ? image->nativeImage : NULL, 364 x, y, width, height)); 365 } DrawImage(Image * image,const RectF & rect)366 Status DrawImage(Image *image, const RectF& rect) 367 { 368 return updateStatus(DllExports::GdipDrawImageRect( 369 nativeGraphics, 370 image ? image->nativeImage : NULL, 371 rect.X, rect.Y, rect.Width, rect.Height)); 372 } DrawImage(Image * image,const Rect & rect)373 Status DrawImage(Image *image, const Rect& rect) 374 { 375 return updateStatus(DllExports::GdipDrawImageRectI( 376 nativeGraphics, 377 image ? image->nativeImage : NULL, 378 rect.X, rect.Y, rect.Width, rect.Height)); 379 } DrawImage(Image * image,const PointF * destPoints,INT count)380 Status DrawImage(Image *image, const PointF *destPoints, INT count) 381 { 382 return updateStatus(DllExports::GdipDrawImagePoints( 383 nativeGraphics, 384 image ? image->nativeImage : NULL, 385 destPoints, count)); 386 } DrawImage(Image * image,const Point * destPoints,INT count)387 Status DrawImage(Image *image, const Point *destPoints, INT count) 388 { 389 return updateStatus(DllExports::GdipDrawImagePointsI( 390 nativeGraphics, 391 image ? image->nativeImage : NULL, 392 destPoints, count)); 393 } DrawImage(Image * image,REAL x,REAL y,REAL srcx,REAL srcy,REAL srcwidth,REAL srcheight,Unit srcUnit)394 Status DrawImage(Image *image, REAL x, REAL y, REAL srcx, REAL srcy, 395 REAL srcwidth, REAL srcheight, Unit srcUnit) 396 { 397 return updateStatus(DllExports::GdipDrawImagePointRect( 398 nativeGraphics, 399 image ? image->nativeImage : NULL, 400 x, y, srcx, srcy, srcwidth, srcheight, 401 srcUnit)); 402 } DrawImage(Image * image,INT x,INT y,INT srcx,INT srcy,INT srcwidth,INT srcheight,Unit srcUnit)403 Status DrawImage(Image *image, INT x, INT y, INT srcx, INT srcy, 404 INT srcwidth, INT srcheight, Unit srcUnit) 405 { 406 return updateStatus(DllExports::GdipDrawImagePointRectI( 407 nativeGraphics, 408 image ? image->nativeImage : NULL, 409 x, y, srcx, srcy, srcwidth, srcheight, 410 srcUnit)); 411 } 412 Status DrawImage(Image *image, const RectF& destRect, 413 REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, 414 Unit srcUnit, 415 const ImageAttributes *imageAttributes = NULL, 416 DrawImageAbort callback = NULL, 417 VOID *callbackData = NULL) 418 { 419 return updateStatus(DllExports::GdipDrawImageRectRect( 420 nativeGraphics, 421 image ? image->nativeImage : NULL, 422 destRect.X, destRect.Y, 423 destRect.Width, destRect.Height, 424 srcx, srcy, srcwidth, srcheight, srcUnit, 425 imageAttributes ? imageAttributes->nativeImageAttributes : NULL, 426 callback, callbackData)); 427 } 428 Status DrawImage(Image *image, const Rect& destRect, 429 INT srcx, INT srcy, INT srcwidth, INT srcheight, 430 Unit srcUnit, 431 const ImageAttributes *imageAttributes = NULL, 432 DrawImageAbort callback = NULL, 433 VOID *callbackData = NULL) 434 { 435 return updateStatus(DllExports::GdipDrawImageRectRectI( 436 nativeGraphics, 437 image ? image->nativeImage : NULL, 438 destRect.X, destRect.Y, 439 destRect.Width, destRect.Height, 440 srcx, srcy, srcwidth, srcheight, srcUnit, 441 imageAttributes ? imageAttributes->nativeImageAttributes : NULL, 442 callback, callbackData)); 443 } 444 Status DrawImage(Image *image, const RectF& destRect, 445 const RectF& sourceRect, Unit srcUnit, 446 const ImageAttributes *imageAttributes = NULL) 447 { 448 return updateStatus(DllExports::GdipDrawImageRectRectI( 449 nativeGraphics, 450 image ? image->nativeImage : NULL, 451 destRect.X, destRect.Y, 452 destRect.Width, destRect.Height, 453 sourceRect.X, sourceRect.Y, 454 sourceRect.Width, sourceRect.Height, srcUnit, 455 imageAttributes ? imageAttributes->nativeImageAttributes : NULL, 456 NULL, NULL)); 457 } 458 Status DrawImage(Image *image, const PointF *destPoints, INT count, 459 REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, 460 Unit srcUnit, 461 const ImageAttributes *imageAttributes = NULL, 462 DrawImageAbort callback = NULL, 463 VOID *callbackData = NULL) 464 { 465 return updateStatus(DllExports::GdipDrawImagePointsRect( 466 nativeGraphics, 467 image ? image->nativeImage : NULL, 468 destPoints, count, 469 srcx, srcy, srcwidth, srcheight, srcUnit, 470 imageAttributes ? imageAttributes->nativeImageAttributes : NULL, 471 callback, callbackData)); 472 } 473 Status DrawImage(Image *image, const Point *destPoints, INT count, 474 INT srcx, INT srcy, INT srcwidth, INT srcheight, 475 Unit srcUnit, 476 const ImageAttributes *imageAttributes = NULL, 477 DrawImageAbort callback = NULL, 478 VOID *callbackData = NULL) 479 { 480 return updateStatus(DllExports::GdipDrawImagePointsRectI( 481 nativeGraphics, 482 image ? image->nativeImage : NULL, 483 destPoints, count, 484 srcx, srcy, srcwidth, srcheight, srcUnit, 485 imageAttributes ? imageAttributes->nativeImageAttributes : NULL, 486 callback, callbackData)); 487 } 488 // TODO: [GDI+ 1.1] Graphics::DrawImage(..Effect..) 489 //Status DrawImage(Image *image, RectF *sourceRect, Matrix *matrix, 490 // Effect *effect, ImageAttributes *imageAttributes, 491 // Unit srcUnit) 492 //{ 493 // return updateStatus(DllExports::GdipDrawImageFX( 494 // nativeGraphics, 495 // image ? image->nativeImage : NULL, 496 // sourceRect, 497 // matrix ? matrix->nativeMatrix : NULL, 498 // effect ? effect->nativeEffect : NULL, 499 // imageAttributes ? imageAttributes->nativeImageAttributes : NULL, 500 // srcUnit)); 501 //} DrawLine(const Pen * pen,REAL x1,REAL y1,REAL x2,REAL y2)502 Status DrawLine(const Pen *pen, REAL x1, REAL y1, REAL x2, REAL y2) 503 { 504 return updateStatus(DllExports::GdipDrawLine( 505 nativeGraphics, pen ? pen->nativePen : NULL, 506 x1, y1, x2, y2)); 507 } DrawLine(const Pen * pen,INT x1,INT y1,INT x2,INT y2)508 Status DrawLine(const Pen *pen, INT x1, INT y1, INT x2, INT y2) 509 { 510 return updateStatus(DllExports::GdipDrawLineI( 511 nativeGraphics, pen ? pen->nativePen : NULL, 512 x1, y1, x2, y2)); 513 } DrawLine(const Pen * pen,const PointF & pt1,const PointF & pt2)514 Status DrawLine(const Pen *pen, const PointF& pt1, const PointF& pt2) 515 { 516 return updateStatus(DllExports::GdipDrawLine( 517 nativeGraphics, pen ? pen->nativePen : NULL, 518 pt1.X, pt1.Y, pt2.X, pt2.Y)); 519 } DrawLine(const Pen * pen,const Point & pt1,const Point & pt2)520 Status DrawLine(const Pen *pen, const Point& pt1, const Point& pt2) 521 { 522 return updateStatus(DllExports::GdipDrawLineI( 523 nativeGraphics, pen ? pen->nativePen : NULL, 524 pt1.X, pt1.Y, pt2.X, pt2.Y)); 525 } DrawLines(const Pen * pen,const PointF * points,INT count)526 Status DrawLines(const Pen *pen, const PointF *points, INT count) 527 { 528 return updateStatus(DllExports::GdipDrawLines( 529 nativeGraphics, pen ? pen->nativePen : NULL, 530 points, count)); 531 } DrawLines(const Pen * pen,const Point * points,INT count)532 Status DrawLines(const Pen *pen, const Point *points, INT count) 533 { 534 return updateStatus(DllExports::GdipDrawLinesI( 535 nativeGraphics, pen ? pen->nativePen : NULL, 536 points, count)); 537 } DrawPath(const Pen * pen,const GraphicsPath * path)538 Status DrawPath(const Pen *pen, const GraphicsPath *path) 539 { 540 return updateStatus(DllExports::GdipDrawPath( 541 nativeGraphics, pen ? pen->nativePen : NULL, 542 path ? path->nativePath : NULL)); 543 } DrawPie(const Pen * pen,REAL x,REAL y,REAL width,REAL height,REAL startAngle,REAL sweepAngle)544 Status DrawPie(const Pen *pen, REAL x, REAL y, REAL width, REAL height, 545 REAL startAngle, REAL sweepAngle) 546 { 547 return updateStatus(DllExports::GdipDrawPie( 548 nativeGraphics, pen ? pen->nativePen : NULL, 549 x, y, width, height, startAngle, sweepAngle)); 550 } DrawPie(const Pen * pen,INT x,INT y,INT width,INT height,REAL startAngle,REAL sweepAngle)551 Status DrawPie(const Pen *pen, INT x, INT y, INT width, INT height, 552 REAL startAngle, REAL sweepAngle) 553 { 554 return updateStatus(DllExports::GdipDrawPieI( 555 nativeGraphics, pen ? pen->nativePen : NULL, 556 x, y, width, height, startAngle, sweepAngle)); 557 } DrawPie(const Pen * pen,const RectF & rect,REAL startAngle,REAL sweepAngle)558 Status DrawPie(const Pen *pen, const RectF& rect, 559 REAL startAngle, REAL sweepAngle) 560 { 561 return updateStatus(DllExports::GdipDrawPie( 562 nativeGraphics, pen ? pen->nativePen : NULL, 563 rect.X, rect.Y, rect.Width, rect.Height, 564 startAngle, sweepAngle)); 565 } DrawPie(const Pen * pen,const Rect & rect,REAL startAngle,REAL sweepAngle)566 Status DrawPie(const Pen *pen, const Rect& rect, 567 REAL startAngle, REAL sweepAngle) 568 { 569 return updateStatus(DllExports::GdipDrawPieI( 570 nativeGraphics, pen ? pen->nativePen : NULL, 571 rect.X, rect.Y, rect.Width, rect.Height, 572 startAngle, sweepAngle)); 573 } DrawPolygon(const Pen * pen,const PointF * points,INT count)574 Status DrawPolygon(const Pen *pen, const PointF *points, INT count) 575 { 576 return updateStatus(DllExports::GdipDrawPolygon( 577 nativeGraphics, pen ? pen->nativePen : NULL, 578 points, count)); 579 } DrawPolygon(const Pen * pen,const Point * points,INT count)580 Status DrawPolygon(const Pen *pen, const Point *points, INT count) 581 { 582 return updateStatus(DllExports::GdipDrawPolygonI( 583 nativeGraphics, pen ? pen->nativePen : NULL, 584 points, count)); 585 } DrawRectangle(const Pen * pen,REAL x,REAL y,REAL width,REAL height)586 Status DrawRectangle(const Pen *pen, 587 REAL x, REAL y, REAL width, REAL height) 588 { 589 return updateStatus(DllExports::GdipDrawRectangle( 590 nativeGraphics, pen ? pen->nativePen : NULL, 591 x, y, width, height)); 592 } DrawRectangle(const Pen * pen,INT x,INT y,INT width,INT height)593 Status DrawRectangle(const Pen *pen, 594 INT x, INT y, INT width, INT height) 595 { 596 return updateStatus(DllExports::GdipDrawRectangleI( 597 nativeGraphics, pen ? pen->nativePen : NULL, 598 x, y, width, height)); 599 } DrawRectangle(const Pen * pen,const RectF & rect)600 Status DrawRectangle(const Pen *pen, const RectF& rect) 601 { 602 return updateStatus(DllExports::GdipDrawRectangle( 603 nativeGraphics, pen ? pen->nativePen : NULL, 604 rect.X, rect.Y, rect.Width, rect.Height)); 605 } DrawRectangle(const Pen * pen,const Rect & rect)606 Status DrawRectangle(const Pen *pen, const Rect& rect) 607 { 608 return updateStatus(DllExports::GdipDrawRectangleI( 609 nativeGraphics, pen ? pen->nativePen : NULL, 610 rect.X, rect.Y, rect.Width, rect.Height)); 611 } DrawRectangles(const Pen * pen,const RectF * rects,INT count)612 Status DrawRectangles(const Pen *pen, const RectF *rects, INT count) 613 { 614 return updateStatus(DllExports::GdipDrawRectangles( 615 nativeGraphics, pen ? pen->nativePen : NULL, 616 rects, count)); 617 } DrawRectangles(const Pen * pen,const Rect * rects,INT count)618 Status DrawRectangles(const Pen *pen, const Rect *rects, INT count) 619 { 620 return updateStatus(DllExports::GdipDrawRectanglesI( 621 nativeGraphics, pen ? pen->nativePen : NULL, 622 rects, count)); 623 } DrawString(const WCHAR * string,INT length,const Font * font,const PointF & origin,const Brush * brush)624 Status DrawString(const WCHAR *string, INT length, const Font *font, 625 const PointF& origin, const Brush *brush) 626 { 627 RectF layoutRect(origin.X, origin.Y, 0.0f, 0.0f); 628 return updateStatus(DllExports::GdipDrawString( 629 nativeGraphics, string, length, 630 font ? font->nativeFont : NULL, 631 &layoutRect, NULL, 632 brush ? brush->nativeBrush : NULL)); 633 } DrawString(const WCHAR * string,INT length,const Font * font,const PointF & origin,const StringFormat * stringFormat,const Brush * brush)634 Status DrawString(const WCHAR *string, INT length, 635 const Font *font, const PointF& origin, 636 const StringFormat *stringFormat, const Brush *brush) 637 { 638 RectF layoutRect(origin.X, origin.Y, 0.0f, 0.0f); 639 return updateStatus(DllExports::GdipDrawString( 640 nativeGraphics, string, length, 641 font ? font->nativeFont : NULL, 642 &layoutRect, 643 stringFormat ? stringFormat->nativeStringFormat : NULL, 644 brush ? brush->nativeBrush : NULL)); 645 } DrawString(const WCHAR * string,INT length,const Font * font,const RectF & layoutRect,const StringFormat * stringFormat,const Brush * brush)646 Status DrawString(const WCHAR *string, INT length, 647 const Font *font, const RectF& layoutRect, 648 const StringFormat *stringFormat, const Brush *brush) 649 { 650 return updateStatus(DllExports::GdipDrawString( 651 nativeGraphics, string, length, 652 font ? font->nativeFont : NULL, 653 &layoutRect, 654 stringFormat ? stringFormat->nativeStringFormat : NULL, 655 brush ? brush->nativeBrush : NULL)); 656 } EndContainer(GraphicsContainer state)657 Status EndContainer(GraphicsContainer state) 658 { 659 return updateStatus(DllExports::GdipEndContainer( 660 nativeGraphics, state)); 661 } 662 Status EnumerateMetafile(const Metafile *metafile, 663 const PointF& destPoint, 664 EnumerateMetafileProc callback, 665 VOID *callbackData = NULL, 666 ImageAttributes *imageAttributes = NULL) 667 { 668 return updateStatus(DllExports::GdipEnumerateMetafileDestPoint( 669 nativeGraphics, 670 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 671 destPoint, callback, callbackData, 672 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 673 } 674 Status EnumerateMetafile(const Metafile *metafile, 675 const Point& destPoint, 676 EnumerateMetafileProc callback, 677 VOID *callbackData = NULL, 678 ImageAttributes *imageAttributes = NULL) 679 { 680 return updateStatus(DllExports::GdipEnumerateMetafileDestPointI( 681 nativeGraphics, 682 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 683 destPoint, callback, callbackData, 684 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 685 } 686 Status EnumerateMetafile(const Metafile *metafile, 687 const RectF& destRect, 688 EnumerateMetafileProc callback, 689 VOID *callbackData = NULL, 690 ImageAttributes *imageAttributes = NULL) 691 { 692 return updateStatus(DllExports::GdipEnumerateMetafileDestRect( 693 nativeGraphics, 694 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 695 destRect, callback, callbackData, 696 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 697 } 698 Status EnumerateMetafile(const Metafile *metafile, 699 const Rect& destRect, 700 EnumerateMetafileProc callback, 701 VOID *callbackData = NULL, 702 ImageAttributes *imageAttributes = NULL) 703 { 704 return updateStatus(DllExports::GdipEnumerateMetafileDestRectI( 705 nativeGraphics, 706 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 707 destRect, callback, callbackData, 708 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 709 } 710 Status EnumerateMetafile(const Metafile *metafile, 711 const PointF *destPoints, INT count, 712 EnumerateMetafileProc callback, 713 VOID *callbackData = NULL, 714 ImageAttributes *imageAttributes = NULL) 715 { 716 return updateStatus(DllExports::GdipEnumerateMetafileDestPoints( 717 nativeGraphics, 718 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 719 destPoints, count, callback, callbackData, 720 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 721 } 722 Status EnumerateMetafile(const Metafile *metafile, 723 const Point *destPoints, INT count, 724 EnumerateMetafileProc callback, 725 VOID *callbackData = NULL, 726 ImageAttributes *imageAttributes = NULL) 727 { 728 return updateStatus(DllExports::GdipEnumerateMetafileDestPointsI( 729 nativeGraphics, 730 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 731 destPoints, count, callback, callbackData, 732 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 733 } 734 Status EnumerateMetafile(const Metafile *metafile, 735 const PointF& destPoint, 736 const RectF& srcRect, Unit srcUnit, 737 EnumerateMetafileProc callback, 738 VOID *callbackData = NULL, 739 ImageAttributes *imageAttributes = NULL) 740 { 741 return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoint( 742 nativeGraphics, 743 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 744 destPoint, srcRect, srcUnit, 745 callback, callbackData, 746 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 747 } 748 Status EnumerateMetafile(const Metafile *metafile, 749 const Point& destPoint, 750 const Rect& srcRect, Unit srcUnit, 751 EnumerateMetafileProc callback, 752 VOID *callbackData = NULL, 753 ImageAttributes *imageAttributes = NULL) 754 { 755 return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointI( 756 nativeGraphics, 757 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 758 destPoint, srcRect, srcUnit, 759 callback, callbackData, 760 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 761 } 762 Status EnumerateMetafile(const Metafile *metafile, 763 const RectF& destRect, 764 const RectF& srcRect, Unit srcUnit, 765 EnumerateMetafileProc callback, 766 VOID *callbackData = NULL, 767 ImageAttributes *imageAttributes = NULL) 768 { 769 return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestRect( 770 nativeGraphics, 771 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 772 destRect, srcRect, srcUnit, 773 callback, callbackData, 774 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 775 } 776 Status EnumerateMetafile(const Metafile *metafile, 777 const Rect& destRect, 778 const Rect& srcRect, Unit srcUnit, 779 EnumerateMetafileProc callback, 780 VOID *callbackData = NULL, 781 ImageAttributes *imageAttributes = NULL) 782 { 783 return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestRectI( 784 nativeGraphics, 785 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 786 destRect, srcRect, srcUnit, 787 callback, callbackData, 788 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 789 } 790 Status EnumerateMetafile(const Metafile *metafile, 791 const PointF* destPoints, INT count, 792 const RectF& srcRect, Unit srcUnit, 793 EnumerateMetafileProc callback, 794 VOID *callbackData = NULL, 795 ImageAttributes *imageAttributes = NULL) 796 { 797 return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoints( 798 nativeGraphics, 799 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 800 destPoints, count, srcRect, srcUnit, 801 callback, callbackData, 802 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 803 } 804 Status EnumerateMetafile(const Metafile *metafile, 805 const Point* destPoints, INT count, 806 const Rect& srcRect, Unit srcUnit, 807 EnumerateMetafileProc callback, 808 VOID *callbackData = NULL, 809 ImageAttributes *imageAttributes = NULL) 810 { 811 return updateStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointsI( 812 nativeGraphics, 813 metafile ? ((GpMetafile*) metafile->nativeImage) : NULL, 814 destPoints, count, srcRect, srcUnit, 815 callback, callbackData, 816 imageAttributes ? imageAttributes->nativeImageAttributes : NULL)); 817 } ExcludeClip(const RectF & rect)818 Status ExcludeClip(const RectF& rect) 819 { 820 return updateStatus(DllExports::GdipSetClipRect( 821 nativeGraphics, 822 rect.X, rect.Y, rect.Width, rect.Height, 823 CombineModeExclude)); 824 } ExcludeClip(const Rect & rect)825 Status ExcludeClip(const Rect& rect) 826 { 827 return updateStatus(DllExports::GdipSetClipRectI( 828 nativeGraphics, 829 rect.X, rect.Y, rect.Width, rect.Height, 830 CombineModeExclude)); 831 } ExcludeClip(const Region * region)832 Status ExcludeClip(const Region *region) 833 { 834 return updateStatus(DllExports::GdipSetClipRegion( 835 nativeGraphics, 836 region ? region->nativeRegion : NULL, 837 CombineModeExclude)); 838 } FillClosedCurve(const Brush * brush,const PointF * points,INT count)839 Status FillClosedCurve(const Brush *brush, 840 const PointF *points, INT count) 841 { 842 return updateStatus(DllExports::GdipFillClosedCurve( 843 nativeGraphics, 844 brush ? brush->nativeBrush : NULL, 845 points, count)); 846 } FillClosedCurve(const Brush * brush,const Point * points,INT count)847 Status FillClosedCurve(const Brush *brush, 848 const Point *points, INT count) 849 { 850 return updateStatus(DllExports::GdipFillClosedCurveI( 851 nativeGraphics, 852 brush ? brush->nativeBrush : NULL, 853 points, count)); 854 } 855 Status FillClosedCurve(const Brush *brush, 856 const PointF *points, INT count, 857 FillMode fillMode, REAL tension = 0.5f) 858 { 859 return updateStatus(DllExports::GdipFillClosedCurve2( 860 nativeGraphics, 861 brush ? brush->nativeBrush : NULL, 862 points, count, tension, fillMode)); 863 } 864 Status FillClosedCurve(const Brush *brush, 865 const Point *points, INT count, 866 FillMode fillMode, REAL tension = 0.5f) 867 { 868 return updateStatus(DllExports::GdipFillClosedCurve2I( 869 nativeGraphics, 870 brush ? brush->nativeBrush : NULL, 871 points, count, tension, fillMode)); 872 } FillEllipse(const Brush * brush,REAL x,REAL y,REAL width,REAL height)873 Status FillEllipse(const Brush *brush, 874 REAL x, REAL y, REAL width, REAL height) 875 { 876 return updateStatus(DllExports::GdipFillEllipse( 877 nativeGraphics, 878 brush ? brush->nativeBrush : NULL, 879 x, y, width, height)); 880 } FillEllipse(const Brush * brush,INT x,INT y,INT width,INT height)881 Status FillEllipse(const Brush *brush, 882 INT x, INT y, INT width, INT height) 883 { 884 return updateStatus(DllExports::GdipFillEllipseI( 885 nativeGraphics, 886 brush ? brush->nativeBrush : NULL, 887 x, y, width, height)); 888 } FillEllipse(const Brush * brush,const RectF & rect)889 Status FillEllipse(const Brush *brush, const RectF& rect) 890 { 891 return updateStatus(DllExports::GdipFillEllipse( 892 nativeGraphics, 893 brush ? brush->nativeBrush : NULL, 894 rect.X, rect.Y, rect.Width, rect.Height)); 895 } FillEllipse(const Brush * brush,const Rect & rect)896 Status FillEllipse(const Brush *brush, const Rect& rect) 897 { 898 return updateStatus(DllExports::GdipFillEllipseI( 899 nativeGraphics, 900 brush ? brush->nativeBrush : NULL, 901 rect.X, rect.Y, rect.Width, rect.Height)); 902 } FillPath(const Brush * brush,const GraphicsPath * path)903 Status FillPath(const Brush *brush, const GraphicsPath *path) 904 { 905 return updateStatus(DllExports::GdipFillPath( 906 nativeGraphics, 907 brush ? brush->nativeBrush : NULL, 908 path ? path->nativePath : NULL)); 909 } FillPie(const Brush * brush,REAL x,REAL y,REAL width,REAL height,REAL startAngle,REAL sweepAngle)910 Status FillPie(const Brush *brush, 911 REAL x, REAL y, REAL width, REAL height, 912 REAL startAngle, REAL sweepAngle) 913 { 914 return updateStatus(DllExports::GdipFillPie( 915 nativeGraphics, 916 brush ? brush->nativeBrush : NULL, 917 x, y, width, height, startAngle, sweepAngle)); 918 } FillPie(const Brush * brush,INT x,INT y,INT width,INT height,REAL startAngle,REAL sweepAngle)919 Status FillPie(const Brush *brush, INT x, INT y, INT width, INT height, 920 REAL startAngle, REAL sweepAngle) 921 { 922 return updateStatus(DllExports::GdipFillPieI( 923 nativeGraphics, 924 brush ? brush->nativeBrush : NULL, 925 x, y, width, height, startAngle, sweepAngle)); 926 } FillPie(const Brush * brush,const RectF & rect,REAL startAngle,REAL sweepAngle)927 Status FillPie(const Brush *brush, const RectF& rect, 928 REAL startAngle, REAL sweepAngle) 929 { 930 return updateStatus(DllExports::GdipFillPie( 931 nativeGraphics, 932 brush ? brush->nativeBrush : NULL, 933 rect.X, rect.Y, rect.Width, rect.Height, 934 startAngle, sweepAngle)); 935 } FillPie(const Brush * brush,const Rect & rect,REAL startAngle,REAL sweepAngle)936 Status FillPie(const Brush *brush, const Rect& rect, 937 REAL startAngle, REAL sweepAngle) 938 { 939 return updateStatus(DllExports::GdipFillPieI( 940 nativeGraphics, 941 brush ? brush->nativeBrush : NULL, 942 rect.X, rect.Y, rect.Width, rect.Height, 943 startAngle, sweepAngle)); 944 } FillPolygon(const Brush * brush,const PointF * points,INT count)945 Status FillPolygon(const Brush *brush, const PointF *points, INT count) 946 { 947 return updateStatus(DllExports::GdipFillPolygon( 948 nativeGraphics, 949 brush ? brush->nativeBrush : NULL, 950 points, count, FillModeAlternate)); 951 } FillPolygon(const Brush * brush,const Point * points,INT count)952 Status FillPolygon(const Brush *brush, const Point *points, INT count) 953 { 954 return updateStatus(DllExports::GdipFillPolygonI( 955 nativeGraphics, 956 brush ? brush->nativeBrush : NULL, 957 points, count, FillModeAlternate)); 958 } FillPolygon(const Brush * brush,const PointF * points,INT count,FillMode fillMode)959 Status FillPolygon(const Brush *brush, const PointF *points, INT count, 960 FillMode fillMode) 961 { 962 return updateStatus(DllExports::GdipFillPolygon( 963 nativeGraphics, 964 brush ? brush->nativeBrush : NULL, 965 points, count, fillMode)); 966 } FillPolygon(const Brush * brush,const Point * points,INT count,FillMode fillMode)967 Status FillPolygon(const Brush *brush, const Point *points, INT count, 968 FillMode fillMode) 969 { 970 return updateStatus(DllExports::GdipFillPolygonI( 971 nativeGraphics, 972 brush ? brush->nativeBrush : NULL, 973 points, count, fillMode)); 974 } FillRectangle(const Brush * brush,REAL x,REAL y,REAL width,REAL height)975 Status FillRectangle(const Brush *brush, 976 REAL x, REAL y, REAL width, REAL height) 977 { 978 return updateStatus(DllExports::GdipFillRectangle( 979 nativeGraphics, 980 brush ? brush->nativeBrush : NULL, 981 x, y, width, height)); 982 } FillRectangle(const Brush * brush,INT x,INT y,INT width,INT height)983 Status FillRectangle(const Brush *brush, 984 INT x, INT y, INT width, INT height) 985 { 986 return updateStatus(DllExports::GdipFillRectangleI( 987 nativeGraphics, 988 brush ? brush->nativeBrush : NULL, 989 x, y, width, height)); 990 } FillRectangle(const Brush * brush,const RectF & rect)991 Status FillRectangle(const Brush *brush, const RectF& rect) 992 { 993 return updateStatus(DllExports::GdipFillRectangle( 994 nativeGraphics, 995 brush ? brush->nativeBrush : NULL, 996 rect.X, rect.Y, rect.Width, rect.Height)); 997 } FillRectangle(const Brush * brush,const Rect & rect)998 Status FillRectangle(const Brush *brush, const Rect& rect) 999 { 1000 return updateStatus(DllExports::GdipFillRectangleI( 1001 nativeGraphics, 1002 brush ? brush->nativeBrush : NULL, 1003 rect.X, rect.Y, rect.Width, rect.Height)); 1004 } FillRectangles(const Brush * brush,const RectF * rects,INT count)1005 Status FillRectangles(const Brush *brush, const RectF *rects, INT count) 1006 { 1007 return updateStatus(DllExports::GdipFillRectangles( 1008 nativeGraphics, 1009 brush ? brush->nativeBrush : NULL, 1010 rects, count)); 1011 } FillRectangles(const Brush * brush,const Rect * rects,INT count)1012 Status FillRectangles(const Brush *brush, const Rect *rects, INT count) 1013 { 1014 return updateStatus(DllExports::GdipFillRectanglesI( 1015 nativeGraphics, 1016 brush ? brush->nativeBrush : NULL, 1017 rects, count)); 1018 } FillRegion(const Brush * brush,const Region * region)1019 Status FillRegion(const Brush *brush, const Region *region) 1020 { 1021 return updateStatus(DllExports::GdipFillRegion( 1022 nativeGraphics, 1023 brush ? brush->nativeBrush : NULL, 1024 region ? region->nativeRegion : NULL)); 1025 } 1026 VOID Flush(FlushIntention intention = FlushIntentionFlush) 1027 { 1028 updateStatus(DllExports::GdipFlush(nativeGraphics, intention)); 1029 } GetClip(Region * region)1030 Status GetClip(Region *region) const 1031 { 1032 return updateStatus(DllExports::GdipGetClip( 1033 nativeGraphics, 1034 region ? region->nativeRegion : NULL)); 1035 } GetClipBounds(RectF * rect)1036 Status GetClipBounds(RectF *rect) const 1037 { 1038 return updateStatus(DllExports::GdipGetClipBounds( 1039 nativeGraphics, rect)); 1040 } GetClipBounds(Rect * rect)1041 Status GetClipBounds(Rect *rect) const 1042 { 1043 return updateStatus(DllExports::GdipGetClipBoundsI( 1044 nativeGraphics, rect)); 1045 } GetCompositingMode()1046 CompositingMode GetCompositingMode() const 1047 { 1048 CompositingMode result = CompositingModeSourceOver; 1049 updateStatus(DllExports::GdipGetCompositingMode( 1050 nativeGraphics, &result)); 1051 return result; 1052 } GetCompositingQuality()1053 CompositingQuality GetCompositingQuality() const 1054 { 1055 CompositingQuality result = CompositingQualityDefault; 1056 updateStatus(DllExports::GdipGetCompositingQuality( 1057 nativeGraphics, &result)); 1058 return result; 1059 } GetDpiX()1060 REAL GetDpiX() const 1061 { 1062 REAL result = 0.0f; 1063 updateStatus(DllExports::GdipGetDpiX(nativeGraphics, &result)); 1064 return result; 1065 } GetDpiY()1066 REAL GetDpiY() const 1067 { 1068 REAL result = 0.0f; 1069 updateStatus(DllExports::GdipGetDpiY(nativeGraphics, &result)); 1070 return result; 1071 } GetHDC()1072 HDC GetHDC() 1073 { 1074 HDC result = NULL; 1075 updateStatus(DllExports::GdipGetDC(nativeGraphics, &result)); 1076 return result; 1077 } GetInterpolationMode()1078 InterpolationMode GetInterpolationMode() const 1079 { 1080 InterpolationMode result = InterpolationModeDefault; 1081 updateStatus(DllExports::GdipGetInterpolationMode( 1082 nativeGraphics, &result)); 1083 return result; 1084 } GetLastStatus()1085 Status GetLastStatus() const 1086 { 1087 Status result = lastStatus; 1088 lastStatus = Ok; 1089 return result; 1090 } GetNearestColor(Color * color)1091 Status GetNearestColor(Color *color) const 1092 { 1093 return updateStatus(DllExports::GdipGetNearestColor( 1094 nativeGraphics, color ? &color->Value : NULL)); 1095 } GetPageScale()1096 REAL GetPageScale() const 1097 { 1098 REAL result = 0.0f; 1099 updateStatus(DllExports::GdipGetPageScale( 1100 nativeGraphics, &result)); 1101 return result; 1102 } GetPageUnit()1103 Unit GetPageUnit() const 1104 { 1105 Unit result = UnitWorld; 1106 updateStatus(DllExports::GdipGetPageUnit( 1107 nativeGraphics, &result)); 1108 return result; 1109 } GetPixelOffsetMode()1110 PixelOffsetMode GetPixelOffsetMode() const 1111 { 1112 PixelOffsetMode result = PixelOffsetModeDefault; 1113 updateStatus(DllExports::GdipGetPixelOffsetMode( 1114 nativeGraphics, &result)); 1115 return result; 1116 } GetRenderingOrigin(INT * x,INT * y)1117 Status GetRenderingOrigin(INT *x, INT *y) const 1118 { 1119 return updateStatus(DllExports::GdipGetRenderingOrigin( 1120 nativeGraphics, x, y)); 1121 } GetSmoothingMode()1122 SmoothingMode GetSmoothingMode() const 1123 { 1124 SmoothingMode result = SmoothingModeDefault; 1125 updateStatus(DllExports::GdipGetSmoothingMode( 1126 nativeGraphics, &result)); 1127 return result; 1128 } GetTextContrast()1129 UINT GetTextContrast() const 1130 { 1131 UINT result = 0; 1132 updateStatus(DllExports::GdipGetTextContrast( 1133 nativeGraphics, &result)); 1134 return result; 1135 } GetTextRenderingHint()1136 TextRenderingHint GetTextRenderingHint() const 1137 { 1138 TextRenderingHint result = TextRenderingHintSystemDefault; 1139 updateStatus(DllExports::GdipGetTextRenderingHint( 1140 nativeGraphics, &result)); 1141 return result; 1142 } GetTransform(Matrix * matrix)1143 Status GetTransform(Matrix *matrix) const 1144 { 1145 return updateStatus(DllExports::GdipGetWorldTransform( 1146 nativeGraphics, 1147 matrix ? matrix->nativeMatrix : NULL)); 1148 } GetVisibleClipBounds(RectF * rect)1149 Status GetVisibleClipBounds(RectF *rect) const 1150 { 1151 return updateStatus(DllExports::GdipGetVisibleClipBounds( 1152 nativeGraphics, rect)); 1153 } GetVisibleClipBounds(Rect * rect)1154 Status GetVisibleClipBounds(Rect *rect) const 1155 { 1156 return updateStatus(DllExports::GdipGetVisibleClipBoundsI( 1157 nativeGraphics, rect)); 1158 } IntersectClip(const RectF & rect)1159 Status IntersectClip(const RectF& rect) 1160 { 1161 return updateStatus(DllExports::GdipSetClipRect( 1162 nativeGraphics, 1163 rect.X, rect.Y, rect.Width, rect.Height, 1164 CombineModeIntersect)); 1165 } IntersectClip(const Rect & rect)1166 Status IntersectClip(const Rect& rect) 1167 { 1168 return updateStatus(DllExports::GdipSetClipRectI( 1169 nativeGraphics, 1170 rect.X, rect.Y, rect.Width, rect.Height, 1171 CombineModeIntersect)); 1172 } IntersectClip(const Region * region)1173 Status IntersectClip(const Region *region) 1174 { 1175 return updateStatus(DllExports::GdipSetClipRegion( 1176 nativeGraphics, 1177 region ? region->nativeRegion : NULL, 1178 CombineModeIntersect)); 1179 } IsClipEmpty()1180 BOOL IsClipEmpty() const 1181 { 1182 BOOL result = FALSE; 1183 updateStatus(DllExports::GdipIsClipEmpty( 1184 nativeGraphics, &result)); 1185 return result; 1186 } IsVisible(REAL x,REAL y)1187 BOOL IsVisible(REAL x, REAL y) const 1188 { 1189 BOOL result = FALSE; 1190 updateStatus(DllExports::GdipIsVisiblePoint( 1191 nativeGraphics, x, y, &result)); 1192 return result; 1193 } IsVisible(INT x,INT y)1194 BOOL IsVisible(INT x, INT y) const 1195 { 1196 BOOL result = FALSE; 1197 updateStatus(DllExports::GdipIsVisiblePointI( 1198 nativeGraphics, x, y, &result)); 1199 return result; 1200 } IsVisible(const PointF & point)1201 BOOL IsVisible(const PointF& point) const 1202 { 1203 BOOL result = FALSE; 1204 updateStatus(DllExports::GdipIsVisiblePoint( 1205 nativeGraphics, point.X, point.Y, &result)); 1206 return result; 1207 } IsVisible(const Point & point)1208 BOOL IsVisible(const Point& point) const 1209 { 1210 BOOL result = FALSE; 1211 updateStatus(DllExports::GdipIsVisiblePointI( 1212 nativeGraphics, point.X, point.Y, &result)); 1213 return result; 1214 } IsVisible(REAL x,REAL y,REAL width,REAL height)1215 BOOL IsVisible(REAL x, REAL y, REAL width, REAL height) const 1216 { 1217 BOOL result = FALSE; 1218 updateStatus(DllExports::GdipIsVisibleRect( 1219 nativeGraphics, x, y, width, height, &result)); 1220 return result; 1221 } IsVisible(INT x,INT y,INT width,INT height)1222 BOOL IsVisible(INT x, INT y, INT width, INT height) const 1223 { 1224 BOOL result = FALSE; 1225 updateStatus(DllExports::GdipIsVisibleRectI( 1226 nativeGraphics, x, y, width, height, &result)); 1227 return result; 1228 } IsVisible(const RectF & rect)1229 BOOL IsVisible(const RectF& rect) const 1230 { 1231 BOOL result = FALSE; 1232 updateStatus(DllExports::GdipIsVisibleRect( 1233 nativeGraphics, rect.X, rect.Y, 1234 rect.Width, rect.Height, &result)); 1235 return result; 1236 } IsVisible(const Rect & rect)1237 BOOL IsVisible(const Rect& rect) const 1238 { 1239 BOOL result = FALSE; 1240 updateStatus(DllExports::GdipIsVisibleRectI( 1241 nativeGraphics, rect.X, rect.Y, 1242 rect.Width, rect.Height, &result)); 1243 return result; 1244 } IsVisibleClipEmpty()1245 BOOL IsVisibleClipEmpty() const 1246 { 1247 BOOL result = FALSE; 1248 updateStatus(DllExports::GdipIsVisibleClipEmpty( 1249 nativeGraphics, &result)); 1250 return result; 1251 } MeasureCharacterRanges(const WCHAR * string,INT length,const Font * font,const RectF & layoutRect,const StringFormat * stringFormat,INT regionCount,Region * regions)1252 Status MeasureCharacterRanges(const WCHAR *string, INT length, 1253 const Font *font, const RectF& layoutRect, 1254 const StringFormat *stringFormat, 1255 INT regionCount, Region *regions) const 1256 { 1257 if (regionCount <= 0 || !regions) 1258 return lastStatus = InvalidParameter; 1259 1260 GpRegion **nativeRegionArray = (GpRegion**) 1261 DllExports::GdipAlloc(regionCount * sizeof(GpRegion*)); 1262 if (!nativeRegionArray) 1263 return lastStatus = OutOfMemory; 1264 for (int i = 0; i < regionCount; ++i) { 1265 nativeRegionArray[i] = regions[i].nativeRegion; 1266 } 1267 Status status = updateStatus(DllExports::GdipMeasureCharacterRanges( 1268 nativeGraphics, string, length, 1269 font ? font->nativeFont : NULL, 1270 layoutRect, 1271 stringFormat ? stringFormat->nativeStringFormat : NULL, 1272 regionCount, nativeRegionArray)); 1273 DllExports::GdipFree(nativeRegionArray); 1274 return status; 1275 } MeasureDriverString(const UINT16 * text,INT length,const Font * font,const PointF * positions,INT flags,const Matrix * matrix,RectF * boundingBox)1276 Status MeasureDriverString(const UINT16 *text, INT length, 1277 const Font *font, const PointF *positions, INT flags, 1278 const Matrix *matrix, RectF *boundingBox) const 1279 { 1280 return updateStatus(DllExports::GdipMeasureDriverString( 1281 nativeGraphics, text, length, 1282 font ? font->nativeFont : NULL, 1283 positions, flags, 1284 matrix ? matrix->nativeMatrix : NULL, 1285 boundingBox)); 1286 } MeasureString(const WCHAR * string,INT length,const Font * font,const RectF & layoutRect,RectF * boundingBox)1287 Status MeasureString(const WCHAR *string, INT length, 1288 const Font *font, const RectF& layoutRect, 1289 RectF *boundingBox) const 1290 { 1291 return updateStatus(DllExports::GdipMeasureString( 1292 nativeGraphics, string, length, 1293 font ? font->nativeFont : NULL, 1294 &layoutRect, NULL, boundingBox, NULL, NULL)); 1295 } 1296 Status MeasureString(const WCHAR *string, INT length, 1297 const Font *font, const RectF& layoutRect, 1298 const StringFormat *stringFormat, RectF *boundingBox, 1299 INT *codepointsFitted = NULL, 1300 INT *linesFitted = NULL) const 1301 { 1302 return updateStatus(DllExports::GdipMeasureString( 1303 nativeGraphics, string, length, 1304 font ? font->nativeFont : NULL, 1305 &layoutRect, 1306 stringFormat ? stringFormat->nativeStringFormat : NULL, 1307 boundingBox, codepointsFitted, linesFitted)); 1308 } 1309 Status MeasureString(const WCHAR *string, INT length, 1310 const Font *font, const SizeF& layoutRectSize, 1311 const StringFormat *stringFormat, SizeF *size, 1312 INT *codepointsFitted = NULL, 1313 INT *linesFitted = NULL) const 1314 { 1315 if (!size) return lastStatus = InvalidParameter; 1316 RectF layoutRect(PointF(0.0f, 0.0f), layoutRectSize); 1317 RectF boundingBox; 1318 Status status = updateStatus(DllExports::GdipMeasureString( 1319 nativeGraphics, string, length, 1320 font ? font->nativeFont : NULL, 1321 &layoutRect, 1322 stringFormat ? stringFormat->nativeStringFormat : NULL, 1323 &boundingBox, codepointsFitted, linesFitted)); 1324 boundingBox.GetSize(size); 1325 return status; 1326 } MeasureString(const WCHAR * string,INT length,const Font * font,const PointF & origin,RectF * boundingBox)1327 Status MeasureString(const WCHAR *string, INT length, 1328 const Font *font, const PointF& origin, 1329 RectF *boundingBox) const 1330 { 1331 RectF layoutRect(origin, SizeF(0.0f, 0.0f)); 1332 return updateStatus(DllExports::GdipMeasureString( 1333 nativeGraphics, string, length, 1334 font ? font->nativeFont : NULL, 1335 &layoutRect, NULL, boundingBox, NULL, NULL)); 1336 } MeasureString(const WCHAR * string,INT length,const Font * font,const PointF & origin,const StringFormat * stringFormat,RectF * boundingBox)1337 Status MeasureString(const WCHAR *string, INT length, 1338 const Font *font, const PointF& origin, 1339 const StringFormat *stringFormat, 1340 RectF *boundingBox) const 1341 { 1342 RectF layoutRect(origin, SizeF(0.0f, 0.0f)); 1343 return updateStatus(DllExports::GdipMeasureString( 1344 nativeGraphics, string, length, 1345 font ? font->nativeFont : NULL, 1346 &layoutRect, 1347 stringFormat ? stringFormat->nativeStringFormat : NULL, 1348 boundingBox, NULL, NULL)); 1349 } 1350 Status MultiplyTransform(const Matrix *matrix, 1351 MatrixOrder order = MatrixOrderPrepend) 1352 { 1353 return updateStatus(DllExports::GdipMultiplyWorldTransform( 1354 nativeGraphics, 1355 matrix ? matrix->nativeMatrix : NULL, order)); 1356 } ReleaseHDC(HDC hdc)1357 VOID ReleaseHDC(HDC hdc) 1358 { 1359 updateStatus(DllExports::GdipReleaseDC(nativeGraphics, hdc)); 1360 } ResetClip()1361 Status ResetClip() 1362 { 1363 return updateStatus(DllExports::GdipResetClip(nativeGraphics)); 1364 } ResetTransform()1365 Status ResetTransform() 1366 { 1367 return updateStatus(DllExports::GdipResetWorldTransform( 1368 nativeGraphics)); 1369 } Restore(GraphicsState state)1370 Status Restore(GraphicsState state) 1371 { 1372 return updateStatus(DllExports::GdipRestoreGraphics( 1373 nativeGraphics, state)); 1374 } 1375 Status RotateTransform(REAL angle, 1376 MatrixOrder order = MatrixOrderPrepend) 1377 { 1378 return updateStatus(DllExports::GdipRotateWorldTransform( 1379 nativeGraphics, angle, order)); 1380 } Save()1381 GraphicsState Save() const 1382 { 1383 GraphicsState result = 0; 1384 updateStatus(DllExports::GdipSaveGraphics( 1385 nativeGraphics, &result)); 1386 return result; 1387 } 1388 Status ScaleTransform(REAL sx, REAL sy, 1389 MatrixOrder order = MatrixOrderPrepend) 1390 { 1391 return updateStatus(DllExports::GdipScaleWorldTransform( 1392 nativeGraphics, sx, sy, order)); 1393 } SetAbort()1394 VOID SetAbort() 1395 { 1396 updateStatus(NotImplemented); 1397 } 1398 Status SetClip(const Graphics *g, 1399 CombineMode combineMode = CombineModeReplace) 1400 { 1401 return updateStatus(DllExports::GdipSetClipGraphics( 1402 nativeGraphics, g ? g->nativeGraphics : NULL, 1403 combineMode)); 1404 } 1405 Status SetClip(const RectF& rect, 1406 CombineMode combineMode = CombineModeReplace) 1407 { 1408 return updateStatus(DllExports::GdipSetClipRect( 1409 nativeGraphics, 1410 rect.X, rect.Y, rect.Width, rect.Height, 1411 combineMode)); 1412 } 1413 Status SetClip(const Rect& rect, 1414 CombineMode combineMode = CombineModeReplace) 1415 { 1416 return updateStatus(DllExports::GdipSetClipRectI( 1417 nativeGraphics, 1418 rect.X, rect.Y, rect.Width, rect.Height, 1419 combineMode)); 1420 } 1421 Status SetClip(const GraphicsPath *path, 1422 CombineMode combineMode = CombineModeReplace) 1423 { 1424 return updateStatus(DllExports::GdipSetClipPath( 1425 nativeGraphics, 1426 path ? path->nativePath : NULL, 1427 combineMode)); 1428 } 1429 Status SetClip(const Region *region, 1430 CombineMode combineMode = CombineModeReplace) 1431 { 1432 return updateStatus(DllExports::GdipSetClipRegion( 1433 nativeGraphics, 1434 region ? region->nativeRegion : NULL, 1435 combineMode)); 1436 } 1437 Status SetClip(HRGN hRgn, CombineMode combineMode = CombineModeReplace) 1438 { 1439 return updateStatus(DllExports::GdipSetClipHrgn( 1440 nativeGraphics, hRgn, combineMode)); 1441 } SetCompositingMode(CompositingMode compositingMode)1442 Status SetCompositingMode(CompositingMode compositingMode) 1443 { 1444 return updateStatus(DllExports::GdipSetCompositingMode( 1445 nativeGraphics, compositingMode)); 1446 } SetCompositingQuality(CompositingQuality compositingQuality)1447 Status SetCompositingQuality(CompositingQuality compositingQuality) 1448 { 1449 return updateStatus(DllExports::GdipSetCompositingQuality( 1450 nativeGraphics, compositingQuality)); 1451 } SetInterpolationMode(InterpolationMode interpolationMode)1452 Status SetInterpolationMode(InterpolationMode interpolationMode) 1453 { 1454 return updateStatus(DllExports::GdipSetInterpolationMode( 1455 nativeGraphics, interpolationMode)); 1456 } SetPageScale(REAL scale)1457 Status SetPageScale(REAL scale) 1458 { 1459 return updateStatus(DllExports::GdipSetPageScale( 1460 nativeGraphics, scale)); 1461 } SetPageUnit(Unit unit)1462 Status SetPageUnit(Unit unit) 1463 { 1464 return updateStatus(DllExports::GdipSetPageUnit( 1465 nativeGraphics, unit)); 1466 } SetPixelOffsetMode(PixelOffsetMode pixelOffsetMode)1467 Status SetPixelOffsetMode(PixelOffsetMode pixelOffsetMode) 1468 { 1469 return updateStatus(DllExports::GdipSetPixelOffsetMode( 1470 nativeGraphics, pixelOffsetMode)); 1471 } SetRenderingOrigin(INT x,INT y)1472 Status SetRenderingOrigin(INT x, INT y) 1473 { 1474 return updateStatus(DllExports::GdipSetRenderingOrigin( 1475 nativeGraphics, x, y)); 1476 } SetSmoothingMode(SmoothingMode smoothingMode)1477 Status SetSmoothingMode(SmoothingMode smoothingMode) 1478 { 1479 return updateStatus(DllExports::GdipSetSmoothingMode( 1480 nativeGraphics, smoothingMode)); 1481 } SetTextContrast(UINT contrast)1482 Status SetTextContrast(UINT contrast) 1483 { 1484 return updateStatus(DllExports::GdipSetTextContrast( 1485 nativeGraphics, contrast)); 1486 } SetTextRenderingHint(TextRenderingHint textRenderingHint)1487 Status SetTextRenderingHint(TextRenderingHint textRenderingHint) 1488 { 1489 return updateStatus(DllExports::GdipSetTextRenderingHint( 1490 nativeGraphics, textRenderingHint)); 1491 } SetTransform(const Matrix * matrix)1492 Status SetTransform(const Matrix *matrix) 1493 { 1494 return updateStatus(DllExports::GdipSetWorldTransform( 1495 nativeGraphics, 1496 matrix ? matrix->nativeMatrix : NULL)); 1497 } TransformPoints(CoordinateSpace destSpace,CoordinateSpace srcSpace,PointF * pts,INT count)1498 Status TransformPoints(CoordinateSpace destSpace, 1499 CoordinateSpace srcSpace, 1500 PointF *pts, INT count) const 1501 { 1502 return updateStatus(DllExports::GdipTransformPoints( 1503 nativeGraphics, destSpace, srcSpace, 1504 pts, count)); 1505 } TransformPoints(CoordinateSpace destSpace,CoordinateSpace srcSpace,Point * pts,INT count)1506 Status TransformPoints(CoordinateSpace destSpace, 1507 CoordinateSpace srcSpace, 1508 Point *pts, INT count) const 1509 { 1510 return updateStatus(DllExports::GdipTransformPointsI( 1511 nativeGraphics, destSpace, srcSpace, 1512 pts, count)); 1513 } TranslateClip(REAL dx,REAL dy)1514 Status TranslateClip(REAL dx, REAL dy) 1515 { 1516 return updateStatus(DllExports::GdipTranslateClip( 1517 nativeGraphics, dx, dy)); 1518 } TranslateClip(INT dx,INT dy)1519 Status TranslateClip(INT dx, INT dy) 1520 { 1521 return updateStatus(DllExports::GdipTranslateClipI( 1522 nativeGraphics, dx, dy)); 1523 } 1524 Status TranslateTransform(REAL dx, REAL dy, 1525 MatrixOrder order = MatrixOrderPrepend) 1526 { 1527 return updateStatus(DllExports::GdipTranslateWorldTransform( 1528 nativeGraphics, dx, dy, order)); 1529 } 1530 1531 private: 1532 Graphics(const Graphics&); 1533 Graphics& operator=(const Graphics&); 1534 updateStatus(Status newStatus)1535 Status updateStatus(Status newStatus) const 1536 { 1537 if (newStatus != Ok) lastStatus = newStatus; 1538 return newStatus; 1539 } 1540 1541 GpGraphics *nativeGraphics; 1542 mutable Status lastStatus; 1543 }; 1544 1545 #endif /* __GDIPLUS_GRAPHICS_H */ 1546