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