6 * This file is part of the w32api package.
8 * THIS SOFTWARE IS NOT COPYRIGHTED
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
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.
19 #ifndef _GDIPLUSGRAPHICS_H
20 #define _GDIPLUSGRAPHICS_H
23 class ImageAttributes
;
32 getNat(const Image
*image
);
35 getNat(const Pen
*pen
);
38 getNat(const Brush
*brush
);
41 getNat(const CachedBitmap
*cb
);
44 getNat(const ImageAttributes
*ia
);
47 getNat(const Region
*region
);
50 getNat(const Matrix
*matrix
);
53 getNat(const GraphicsPath
*path
);
55 class Graphics
: public GdiplusBase
60 friend class CachedBitmap
;
63 Graphics(Image
*image
)
65 GpGraphics
*graphics
= NULL
;
68 lastStatus
= DllExports::GdipGetImageGraphicsContext(getNat(image
), &graphics
);
70 SetNativeGraphics(graphics
);
75 GpGraphics
*graphics
= NULL
;
76 lastStatus
= DllExports::GdipCreateFromHDC(hdc
, &graphics
);
77 SetNativeGraphics(graphics
);
80 Graphics(HDC hdc
, HANDLE hdevice
)
82 GpGraphics
*graphics
= NULL
;
83 lastStatus
= DllExports::GdipCreateFromHDC2(hdc
, hdevice
, &graphics
);
84 SetNativeGraphics(graphics
);
87 Graphics(HWND hwnd
, BOOL icm
= FALSE
)
89 GpGraphics
*graphics
= NULL
;
92 lastStatus
= DllExports::GdipCreateFromHWNDICM(hwnd
, &graphics
);
96 lastStatus
= DllExports::GdipCreateFromHWND(hwnd
, &graphics
);
98 SetNativeGraphics(graphics
);
103 DllExports::GdipDeleteGraphics(nativeGraphics
);
107 AddMetafileComment(const BYTE
*data
, UINT sizeData
)
109 return SetStatus(DllExports::GdipComment(nativeGraphics
, sizeData
, data
));
115 return GraphicsContainer();
119 BeginContainer(const RectF
&dstrect
, const RectF
&srcrect
, Unit unit
)
121 return GraphicsContainer();
125 BeginContainer(const Rect
&dstrect
, const Rect
&srcrect
, Unit unit
)
127 return GraphicsContainer();
131 Clear(const Color
&color
)
133 return SetStatus(DllExports::GdipGraphicsClear(nativeGraphics
, color
.GetValue()));
137 DrawArc(const Pen
*pen
, const Rect
&rect
, REAL startAngle
, REAL sweepAngle
)
139 return SetStatus(DllExports::GdipDrawArcI(
140 nativeGraphics
, pen
? getNat(pen
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, startAngle
, sweepAngle
));
144 DrawArc(const Pen
*pen
, const RectF
&rect
, REAL startAngle
, REAL sweepAngle
)
146 return SetStatus(DllExports::GdipDrawArcI(
147 nativeGraphics
, pen
? getNat(pen
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, startAngle
, sweepAngle
));
151 DrawArc(const Pen
*pen
, REAL x
, REAL y
, REAL width
, REAL height
, REAL startAngle
, REAL sweepAngle
)
153 return SetStatus(DllExports::GdipDrawArc(
154 nativeGraphics
, pen
? getNat(pen
) : NULL
, x
, y
, width
, height
, startAngle
, sweepAngle
));
158 DrawArc(const Pen
*pen
, INT x
, INT y
, INT width
, INT height
, REAL startAngle
, REAL sweepAngle
)
160 return SetStatus(DllExports::GdipDrawArcI(
161 nativeGraphics
, pen
? getNat(pen
) : NULL
, x
, y
, width
, height
, startAngle
, sweepAngle
));
165 DrawBezier(const Pen
*pen
, const Point
&pt1
, const Point
&pt2
, const Point
&pt3
, const Point
&pt4
)
167 return SetStatus(DllExports::GdipDrawBezierI(
168 nativeGraphics
, pen
? getNat(pen
) : NULL
, pt1
.X
, pt1
.Y
, pt2
.X
, pt2
.Y
, pt3
.X
, pt3
.Y
, pt4
.X
, pt4
.Y
));
172 DrawBezier(const Pen
*pen
, const PointF
&pt1
, const PointF
&pt2
, const PointF
&pt3
, const PointF
&pt4
)
174 return SetStatus(DllExports::GdipDrawBezier(
175 nativeGraphics
, pen
? getNat(pen
) : NULL
, pt1
.X
, pt1
.Y
, pt2
.X
, pt2
.Y
, pt3
.X
, pt3
.Y
, pt4
.X
, pt4
.Y
));
179 DrawBezier(const Pen
*pen
, REAL x1
, REAL y1
, REAL x2
, REAL y2
, REAL x3
, REAL y3
, REAL x4
, REAL y4
)
182 DllExports::GdipDrawBezier(nativeGraphics
, pen
? getNat(pen
) : NULL
, x1
, y1
, x2
, y2
, x3
, y3
, x4
, y4
));
186 DrawBezier(const Pen
*pen
, INT x1
, INT y1
, INT x2
, INT y2
, INT x3
, INT y3
, INT x4
, INT y4
)
189 DllExports::GdipDrawBezierI(nativeGraphics
, pen
? getNat(pen
) : NULL
, x1
, y1
, x2
, y2
, x3
, y3
, x4
, y4
));
193 DrawBeziers(const Pen
*pen
, const Point
*points
, INT count
)
195 return SetStatus(DllExports::GdipDrawBeziersI(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
199 DrawBeziers(const Pen
*pen
, const PointF
*points
, INT count
)
201 return SetStatus(DllExports::GdipDrawBeziers(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
205 DrawCachedBitmap(CachedBitmap
*cb
, INT x
, INT y
)
207 return SetStatus(DllExports::GdipDrawCachedBitmap(nativeGraphics
, getNat(cb
), x
, y
));
211 DrawClosedCurve(const Pen
*pen
, const Point
*points
, INT count
)
213 return SetStatus(DllExports::GdipDrawClosedCurveI(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
217 DrawClosedCurve(const Pen
*pen
, const PointF
*points
, INT count
)
219 return SetStatus(DllExports::GdipDrawClosedCurve(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
223 DrawClosedCurve(const Pen
*pen
, const PointF
*points
, INT count
, REAL tension
)
226 DllExports::GdipDrawClosedCurve2(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
, tension
));
230 DrawClosedCurve(const Pen
*pen
, const Point
*points
, INT count
, REAL tension
)
233 DllExports::GdipDrawClosedCurve2I(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
, tension
));
237 DrawCurve(const Pen
*pen
, const Point
*points
, INT count
)
239 return SetStatus(DllExports::GdipDrawCurveI(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
243 DrawCurve(const Pen
*pen
, const PointF
*points
, INT count
)
245 return SetStatus(DllExports::GdipDrawCurve(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
249 DrawCurve(const Pen
*pen
, const PointF
*points
, INT count
, REAL tension
)
251 return SetStatus(DllExports::GdipDrawCurve2(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
, tension
));
255 DrawCurve(const Pen
*pen
, const Point
*points
, INT count
, INT offset
, INT numberOfSegments
, REAL tension
)
257 return SetStatus(DllExports::GdipDrawCurve3I(
258 nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
, offset
, numberOfSegments
, tension
));
262 DrawCurve(const Pen
*pen
, const PointF
*points
, INT count
, INT offset
, INT numberOfSegments
, REAL tension
)
264 return SetStatus(DllExports::GdipDrawCurve3(
265 nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
, offset
, numberOfSegments
, tension
));
269 DrawCurve(const Pen
*pen
, const Point
*points
, INT count
, REAL tension
)
271 return SetStatus(DllExports::GdipDrawCurve2I(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
, tension
));
280 const PointF
*positions
,
282 const Matrix
*matrix
)
284 return NotImplemented
;
288 DrawEllipse(const Pen
*pen
, const Rect
&rect
)
290 return SetStatus(DllExports::GdipDrawEllipseI(
291 nativeGraphics
, pen
? getNat(pen
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
));
295 DrawEllipse(const Pen
*pen
, REAL x
, REAL y
, REAL width
, REAL height
)
297 return SetStatus(DllExports::GdipDrawEllipse(nativeGraphics
, pen
? getNat(pen
) : NULL
, x
, y
, width
, height
));
301 DrawEllipse(const Pen
*pen
, const RectF
&rect
)
303 return SetStatus(DllExports::GdipDrawEllipse(
304 nativeGraphics
, pen
? getNat(pen
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
));
308 DrawEllipse(const Pen
*pen
, INT x
, INT y
, INT width
, INT height
)
310 return SetStatus(DllExports::GdipDrawEllipseI(nativeGraphics
, pen
? getNat(pen
) : NULL
, x
, y
, width
, height
));
314 DrawImage(Image
*image
, const Point
*destPoints
, INT count
)
316 if (count
!= 3 && count
!= 4)
317 return SetStatus(InvalidParameter
);
320 DllExports::GdipDrawImagePointsI(nativeGraphics
, image
? getNat(image
) : NULL
, destPoints
, count
));
324 DrawImage(Image
*image
, INT x
, INT y
)
326 return SetStatus(DllExports::GdipDrawImageI(nativeGraphics
, image
? getNat(image
) : NULL
, x
, y
));
330 DrawImage(Image
*image
, const Point
&point
)
332 return DrawImage(image
, point
.X
, point
.Y
);
336 DrawImage(Image
*image
, REAL x
, REAL y
)
338 return SetStatus(DllExports::GdipDrawImage(nativeGraphics
, image
? getNat(image
) : NULL
, x
, y
));
342 DrawImage(Image
*image
, const PointF
&point
)
344 return DrawImage(image
, point
.X
, point
.Y
);
348 DrawImage(Image
*image
, const PointF
*destPoints
, INT count
)
350 if (count
!= 3 && count
!= 4)
351 return SetStatus(InvalidParameter
);
354 DllExports::GdipDrawImagePoints(nativeGraphics
, image
? getNat(image
) : NULL
, destPoints
, count
));
358 DrawImage(Image
*image
, REAL x
, REAL y
, REAL srcx
, REAL srcy
, REAL srcwidth
, REAL srcheight
, Unit srcUnit
)
360 return SetStatus(DllExports::GdipDrawImagePointRect(
361 nativeGraphics
, image
? getNat(image
) : NULL
, x
, y
, srcx
, srcy
, srcwidth
, srcheight
, srcUnit
));
365 DrawImage(Image
*image
, const RectF
&rect
)
367 return DrawImage(image
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
);
371 DrawImage(Image
*image
, INT x
, INT y
, INT width
, INT height
)
374 DllExports::GdipDrawImageRectI(nativeGraphics
, image
? getNat(image
) : NULL
, x
, y
, width
, height
));
380 const PointF
*destPoints
,
387 ImageAttributes
*imageAttributes
,
388 DrawImageAbort callback
,
391 return SetStatus(DllExports::GdipDrawImagePointsRect(
392 nativeGraphics
, image
? getNat(image
) : NULL
, destPoints
, count
, srcx
, srcy
, srcwidth
, srcheight
, srcUnit
,
393 imageAttributes
? getNat(imageAttributes
) : NULL
, callback
, callbackData
));
399 const Rect
&destRect
,
405 const ImageAttributes
*imageAttributes
= NULL
,
406 DrawImageAbort callback
= NULL
,
407 VOID
*callbackData
= NULL
)
409 return SetStatus(DllExports::GdipDrawImageRectRectI(
410 nativeGraphics
, image
? getNat(image
) : NULL
, destRect
.X
, destRect
.Y
, destRect
.Width
, destRect
.Height
, srcx
,
411 srcy
, srcwidth
, srcheight
, srcUnit
, imageAttributes
? getNat(imageAttributes
) : NULL
, callback
,
418 const Point
*destPoints
,
425 ImageAttributes
*imageAttributes
= NULL
,
426 DrawImageAbort callback
= NULL
,
427 VOID
*callbackData
= NULL
)
429 return SetStatus(DllExports::GdipDrawImagePointsRectI(
430 nativeGraphics
, image
? getNat(image
) : NULL
, destPoints
, count
, srcx
, srcy
, srcwidth
, srcheight
, srcUnit
,
431 imageAttributes
? getNat(imageAttributes
) : NULL
, callback
, callbackData
));
435 DrawImage(Image
*image
, REAL x
, REAL y
, REAL width
, REAL height
)
438 DllExports::GdipDrawImageRect(nativeGraphics
, image
? getNat(image
) : NULL
, x
, y
, width
, height
));
442 DrawImage(Image
*image
, const Rect
&rect
)
444 return DrawImage(image
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
);
448 DrawImage(Image
*image
, INT x
, INT y
, INT srcx
, INT srcy
, INT srcwidth
, INT srcheight
, Unit srcUnit
)
450 return SetStatus(DllExports::GdipDrawImagePointRectI(
451 nativeGraphics
, image
? getNat(image
) : NULL
, x
, y
, srcx
, srcy
, srcwidth
, srcheight
, srcUnit
));
457 const RectF
&destRect
,
463 ImageAttributes
*imageAttributes
= NULL
,
464 DrawImageAbort callback
= NULL
,
465 VOID
*callbackData
= NULL
)
467 return SetStatus(DllExports::GdipDrawImageRectRect(
468 nativeGraphics
, image
? getNat(image
) : NULL
, destRect
.X
, destRect
.Y
, destRect
.Width
, destRect
.Height
, srcx
,
469 srcy
, srcwidth
, srcheight
, srcUnit
, imageAttributes
? getNat(imageAttributes
) : NULL
, callback
,
474 DrawLine(const Pen
*pen
, const Point
&pt1
, const Point
&pt2
)
477 DllExports::GdipDrawLineI(nativeGraphics
, pen
? getNat(pen
) : NULL
, pt1
.X
, pt1
.Y
, pt2
.X
, pt2
.Y
));
481 DrawLine(const Pen
*pen
, const PointF
&pt1
, const Point
&pt2
)
484 DllExports::GdipDrawLine(nativeGraphics
, pen
? getNat(pen
) : NULL
, pt1
.X
, pt1
.Y
, pt2
.X
, pt2
.Y
));
488 DrawLine(const Pen
*pen
, REAL x1
, REAL y1
, REAL x2
, REAL y2
)
490 return SetStatus(DllExports::GdipDrawLine(nativeGraphics
, pen
? getNat(pen
) : NULL
, x1
, y1
, x2
, y2
));
494 DrawLine(const Pen
*pen
, INT x1
, INT y1
, INT x2
, INT y2
)
496 return SetStatus(DllExports::GdipDrawLine(nativeGraphics
, pen
? getNat(pen
) : NULL
, x1
, y1
, x2
, y2
));
500 DrawLines(const Pen
*pen
, const Point
*points
, INT count
)
502 return SetStatus(DllExports::GdipDrawLinesI(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
506 DrawLines(const Pen
*pen
, const PointF
*points
, INT count
)
508 return SetStatus(DllExports::GdipDrawLines(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
512 DrawPath(const Pen
*pen
, const GraphicsPath
*path
)
515 DllExports::GdipDrawPath(nativeGraphics
, pen
? getNat(pen
) : NULL
, path
? getNat(path
) : NULL
));
519 DrawPie(const Pen
*pen
, const Rect
&rect
, REAL startAngle
, REAL sweepAngle
)
521 return SetStatus(DllExports::GdipDrawPieI(
522 nativeGraphics
, pen
? getNat(pen
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, startAngle
, sweepAngle
));
526 DrawPie(const Pen
*pen
, INT x
, INT y
, INT width
, INT height
, REAL startAngle
, REAL sweepAngle
)
528 return SetStatus(DllExports::GdipDrawPieI(
529 nativeGraphics
, pen
? getNat(pen
) : NULL
, x
, y
, width
, height
, startAngle
, sweepAngle
));
533 DrawPie(const Pen
*pen
, REAL x
, REAL y
, REAL width
, REAL height
, REAL startAngle
, REAL sweepAngle
)
535 return SetStatus(DllExports::GdipDrawPie(
536 nativeGraphics
, pen
? getNat(pen
) : NULL
, x
, y
, width
, height
, startAngle
, sweepAngle
));
540 DrawPie(const Pen
*pen
, const RectF
&rect
, REAL startAngle
, REAL sweepAngle
)
542 return SetStatus(DllExports::GdipDrawPie(
543 nativeGraphics
, pen
? getNat(pen
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, startAngle
, sweepAngle
));
547 DrawPolygon(const Pen
*pen
, const Point
*points
, INT count
)
549 return SetStatus(DllExports::GdipDrawPolygonI(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
553 DrawPolygon(const Pen
*pen
, const PointF
*points
, INT count
)
555 return SetStatus(DllExports::GdipDrawPolygon(nativeGraphics
, pen
? getNat(pen
) : NULL
, points
, count
));
559 DrawRectangle(const Pen
*pen
, const Rect
&rect
)
561 return SetStatus(DllExports::GdipDrawRectangleI(
562 nativeGraphics
, pen
? getNat(pen
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
));
566 DrawRectangle(const Pen
*pen
, INT x
, INT y
, INT width
, INT height
)
568 return SetStatus(DllExports::GdipDrawRectangleI(nativeGraphics
, pen
? getNat(pen
) : NULL
, x
, y
, width
, height
));
572 DrawRectangle(const Pen
*pen
, REAL x
, REAL y
, REAL width
, REAL height
)
574 return SetStatus(DllExports::GdipDrawRectangle(nativeGraphics
, pen
? getNat(pen
) : NULL
, x
, y
, width
, height
));
578 DrawRectangle(const Pen
*pen
, const RectF
&rect
)
580 return SetStatus(DllExports::GdipDrawRectangleI(
581 nativeGraphics
, pen
? getNat(pen
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
));
585 DrawRectangles(const Pen
*pen
, const Rect
*rects
, INT count
)
587 return SetStatus(DllExports::GdipDrawRectanglesI(nativeGraphics
, pen
? getNat(pen
) : NULL
, rects
, count
));
591 DrawRectangles(const Pen
*pen
, const RectF
*rects
, INT count
)
593 return SetStatus(DllExports::GdipDrawRectangles(nativeGraphics
, pen
? getNat(pen
) : NULL
, rects
, count
));
601 const RectF
&layoutRect
,
602 const StringFormat
*stringFormat
,
605 return NotImplemented
;
609 DrawString(const WCHAR
*string
, INT length
, const Font
*font
, const PointF
&origin
, const Brush
*brush
)
611 return NotImplemented
;
619 const PointF
&origin
,
620 const StringFormat
*stringFormat
,
623 return NotImplemented
;
627 EndContainer(GraphicsContainer state
)
629 return SetStatus(DllExports::GdipEndContainer(nativeGraphics
, state
));
634 const Metafile
*metafile
,
635 const Metafile
&destPoint
,
636 EnumerateMetafileProc callback
,
637 VOID
*callbackData
= NULL
,
638 ImageAttributes
*imageAttributes
= NULL
)
640 return NotImplemented
;
645 const Metafile
*metafile
,
646 const Point
*destPoints
,
648 EnumerateMetafileProc callback
,
650 ImageAttributes
*imageAttributes
)
652 return NotImplemented
;
657 const Metafile
*metafile
,
658 const Point
&destPoint
,
661 EnumerateMetafileProc callback
,
663 ImageAttributes
*imageAttributes
)
665 return NotImplemented
;
670 const Metafile
*metafile
,
671 const PointF
*destPoints
,
673 EnumerateMetafileProc callback
,
675 ImageAttributes
*imageAttributes
)
677 return NotImplemented
;
682 const Metafile
*metafile
,
683 const Rect
&destRect
,
684 EnumerateMetafileProc callback
,
686 ImageAttributes
*imageAttributes
)
688 return NotImplemented
;
693 const Metafile
*metafile
,
694 const RectF
&destRect
,
695 const RectF
&srcRect
,
697 EnumerateMetafileProc callback
,
699 ImageAttributes
*imageAttributes
)
701 return NotImplemented
;
706 const Metafile
*metafile
,
707 const RectF
&destRect
,
708 EnumerateMetafileProc callback
,
710 ImageAttributes
*imageAttributes
)
712 return NotImplemented
;
717 const Metafile
*metafile
,
718 const PointF
&destPoint
,
721 EnumerateMetafileProc callback
,
723 ImageAttributes
*imageAttributes
)
725 return NotImplemented
;
730 const Metafile
*metafile
,
731 const Point
*destPoints
,
735 EnumerateMetafileProc callback
,
737 ImageAttributes
*imageAttributes
)
739 return NotImplemented
;
744 const Metafile
*metafile
,
745 const Rect
&destRect
,
748 EnumerateMetafileProc callback
,
750 ImageAttributes
*imageAttributes
)
752 return NotImplemented
;
757 const Metafile
*metafile
,
758 const Point
*destPoints
,
760 const RectF
&srcRect
,
762 EnumerateMetafileProc callback
,
764 ImageAttributes
*imageAttributes
)
766 return NotImplemented
;
771 const Metafile
*metafile
,
772 const PointF
&destPoint
,
773 EnumerateMetafileProc callback
,
775 ImageAttributes
*imageAttributes
)
777 return NotImplemented
;
781 ExcludeClip(const Rect
&rect
)
784 DllExports::GdipSetClipRectI(nativeGraphics
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, CombineModeExclude
));
788 ExcludeClip(const RectF
&rect
)
791 DllExports::GdipSetClipRect(nativeGraphics
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, CombineModeExclude
));
795 ExcludeClip(const Region
*region
)
797 return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics
, getNat(region
), CombineModeExclude
));
801 FillClosedCurve(const Brush
*brush
, const Point
*points
, INT count
)
803 return SetStatus(DllExports::GdipFillClosedCurveI(nativeGraphics
, brush
? getNat(brush
) : NULL
, points
, count
));
807 FillClosedCurve(const Brush
*brush
, const Point
*points
, INT count
, FillMode fillMode
, REAL tension
)
809 return SetStatus(DllExports::GdipFillClosedCurve2I(
810 nativeGraphics
, brush
? getNat(brush
) : NULL
, points
, count
, tension
, fillMode
));
814 FillClosedCurve(const Brush
*brush
, const PointF
*points
, INT count
)
816 return SetStatus(DllExports::GdipFillClosedCurve(nativeGraphics
, brush
? getNat(brush
) : NULL
, points
, count
));
820 FillClosedCurve(const Brush
*brush
, const PointF
*points
, INT count
, FillMode fillMode
, REAL tension
)
822 return SetStatus(DllExports::GdipFillClosedCurve2(
823 nativeGraphics
, brush
? getNat(brush
) : NULL
, points
, count
, tension
, fillMode
));
827 FillEllipse(const Brush
*brush
, const Rect
&rect
)
829 return SetStatus(DllExports::GdipFillEllipseI(
830 nativeGraphics
, brush
? getNat(brush
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
));
834 FillEllipse(const Brush
*brush
, REAL x
, REAL y
, REAL width
, REAL height
)
837 DllExports::GdipFillEllipse(nativeGraphics
, brush
? getNat(brush
) : NULL
, x
, y
, width
, height
));
841 FillEllipse(const Brush
*brush
, const RectF
&rect
)
843 return SetStatus(DllExports::GdipFillEllipse(
844 nativeGraphics
, brush
? getNat(brush
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
));
848 FillEllipse(const Brush
*brush
, INT x
, INT y
, INT width
, INT height
)
851 DllExports::GdipFillEllipseI(nativeGraphics
, brush
? getNat(brush
) : NULL
, x
, y
, width
, height
));
855 FillPath(const Brush
*brush
, const GraphicsPath
*path
)
857 return SetStatus(DllExports::GdipFillPath(nativeGraphics
, getNat(brush
), getNat(path
)));
861 FillPie(const Brush
*brush
, const Rect
&rect
, REAL startAngle
, REAL sweepAngle
)
863 return SetStatus(DllExports::GdipFillPieI(
864 nativeGraphics
, brush
? getNat(brush
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, startAngle
,
869 FillPie(const Brush
*brush
, INT x
, INT y
, INT width
, INT height
, REAL startAngle
, REAL sweepAngle
)
871 return SetStatus(DllExports::GdipFillPieI(
872 nativeGraphics
, brush
? getNat(brush
) : NULL
, x
, y
, width
, height
, startAngle
, sweepAngle
));
876 FillPie(const Brush
*brush
, REAL x
, REAL y
, REAL width
, REAL height
, REAL startAngle
, REAL sweepAngle
)
878 return SetStatus(DllExports::GdipFillPie(
879 nativeGraphics
, brush
? getNat(brush
) : NULL
, x
, y
, width
, height
, startAngle
, sweepAngle
));
883 FillPie(const Brush
*brush
, RectF
&rect
, REAL startAngle
, REAL sweepAngle
)
885 return SetStatus(DllExports::GdipFillPie(
886 nativeGraphics
, brush
? getNat(brush
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, startAngle
,
891 FillPolygon(const Brush
*brush
, const Point
*points
, INT count
)
893 return SetStatus(DllExports::GdipFillPolygon2I(nativeGraphics
, brush
? getNat(brush
) : NULL
, points
, count
));
897 FillPolygon(const Brush
*brush
, const PointF
*points
, INT count
)
899 return SetStatus(DllExports::GdipFillPolygon2(nativeGraphics
, brush
? getNat(brush
) : NULL
, points
, count
));
903 FillPolygon(const Brush
*brush
, const Point
*points
, INT count
, FillMode fillMode
)
906 DllExports::GdipFillPolygonI(nativeGraphics
, brush
? getNat(brush
) : NULL
, points
, count
, fillMode
));
910 FillPolygon(const Brush
*brush
, const PointF
*points
, INT count
, FillMode fillMode
)
913 DllExports::GdipFillPolygon(nativeGraphics
, brush
? getNat(brush
) : NULL
, points
, count
, fillMode
));
917 FillRectangle(const Brush
*brush
, const Rect
&rect
)
919 return SetStatus(DllExports::GdipFillRectangleI(
920 nativeGraphics
, brush
? getNat(brush
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
));
924 FillRectangle(const Brush
*brush
, const RectF
&rect
)
926 return SetStatus(DllExports::GdipFillRectangle(
927 nativeGraphics
, brush
? getNat(brush
) : NULL
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
));
931 FillRectangle(const Brush
*brush
, REAL x
, REAL y
, REAL width
, REAL height
)
934 DllExports::GdipFillRectangle(nativeGraphics
, brush
? getNat(brush
) : NULL
, x
, y
, width
, height
));
938 FillRectangle(const Brush
*brush
, INT x
, INT y
, INT width
, INT height
)
941 DllExports::GdipFillRectangleI(nativeGraphics
, brush
? getNat(brush
) : NULL
, x
, y
, width
, height
));
945 FillRectangles(const Brush
*brush
, const Rect
*rects
, INT count
)
947 return SetStatus(DllExports::GdipFillRectanglesI(nativeGraphics
, brush
? getNat(brush
) : NULL
, rects
, count
));
951 FillRectangles(const Brush
*brush
, const RectF
*rects
, INT count
)
953 return SetStatus(DllExports::GdipFillRectangles(nativeGraphics
, brush
? getNat(brush
) : NULL
, rects
, count
));
957 FillRegion(const Brush
*brush
, const Region
*region
)
959 return SetStatus(DllExports::GdipFillRegion(nativeGraphics
, getNat(brush
), getNat(region
)));
963 Flush(FlushIntention intention
)
965 DllExports::GdipFlush(nativeGraphics
, intention
);
971 return new Graphics(hdc
);
975 FromHDC(HDC hdc
, HANDLE hDevice
)
977 return new Graphics(hdc
, hDevice
);
981 FromHWND(HWND hWnd
, BOOL icm
)
983 return new Graphics(hWnd
, icm
);
987 FromImage(Image
*image
)
989 return new Graphics(image
);
993 GetClip(Region
*region
) const
995 return SetStatus(DllExports::GdipGetClip(nativeGraphics
, getNat(region
)));
999 GetClipBounds(Rect
*rect
) const
1001 return SetStatus(DllExports::GdipGetClipBoundsI(nativeGraphics
, rect
));
1005 GetClipBounds(RectF
*rect
) const
1007 return SetStatus(DllExports::GdipGetClipBounds(nativeGraphics
, rect
));
1011 GetCompositingMode() const
1013 CompositingMode compositingMode
;
1014 SetStatus(DllExports::GdipGetCompositingMode(nativeGraphics
, &compositingMode
));
1015 return compositingMode
;
1019 GetCompositingQuality() const
1021 CompositingQuality compositingQuality
;
1022 SetStatus(DllExports::GdipGetCompositingQuality(nativeGraphics
, &compositingQuality
));
1023 return compositingQuality
;
1030 SetStatus(DllExports::GdipGetDpiX(nativeGraphics
, &dpi
));
1038 SetStatus(DllExports::GdipGetDpiY(nativeGraphics
, &dpi
));
1043 GetHalftonePalette()
1052 SetStatus(DllExports::GdipGetDC(nativeGraphics
, &hdc
));
1057 GetInterpolationMode() const
1059 InterpolationMode interpolationMode
;
1060 SetStatus(DllExports::GdipGetInterpolationMode(nativeGraphics
, &interpolationMode
));
1061 return interpolationMode
;
1065 GetLastStatus() const
1071 GetNearestColor(Color
*color
) const
1074 return SetStatus(InvalidParameter
);
1076 ARGB argb
= color
->GetValue();
1077 SetStatus(DllExports::GdipGetNearestColor(nativeGraphics
, &argb
));
1079 color
->SetValue(argb
);
1084 GetPageScale() const
1087 SetStatus(DllExports::GdipGetPageScale(nativeGraphics
, &scale
));
1095 SetStatus(DllExports::GdipGetPageUnit(nativeGraphics
, &unit
));
1100 GetPixelOffsetMode() const
1102 PixelOffsetMode pixelOffsetMode
;
1103 SetStatus(DllExports::GdipGetPixelOffsetMode(nativeGraphics
, &pixelOffsetMode
));
1104 return pixelOffsetMode
;
1108 GetRenderingOrigin(INT
*x
, INT
*y
) const
1111 return SetStatus(NotImplemented
); // FIXME
1113 return SetStatus(DllExports::GdipGetRenderingOrigin(nativeGraphics
, x
, y
));
1118 GetSmoothingMode() const
1120 SmoothingMode smoothingMode
;
1121 SetStatus(DllExports::GdipGetSmoothingMode(nativeGraphics
, &smoothingMode
));
1122 return smoothingMode
;
1126 GetTextContrast() const
1129 SetStatus(DllExports::GdipGetTextContrast(nativeGraphics
, &contrast
));
1134 GetTextRenderingHint() const
1136 TextRenderingHint mode
;
1137 SetStatus(DllExports::GdipGetTextRenderingHint(nativeGraphics
, &mode
));
1142 GetTextGammaValue() const
1145 return SetStatus(NotImplemented
); // FIXME
1148 SetStatus(DllExports::GdipGetTextGammaValue(nativeGraphics
, &gammaValue
));
1154 GetTransform(Matrix
*matrix
) const
1156 return SetStatus(DllExports::GdipGetWorldTransform(nativeGraphics
, getNat(matrix
)));
1160 GetVisibleClipBounds(Rect
*rect
) const
1162 return SetStatus(DllExports::GdipGetVisibleClipBoundsI(nativeGraphics
, rect
));
1166 GetVisibleClipBounds(RectF
*rect
) const
1168 return SetStatus(DllExports::GdipGetVisibleClipBounds(nativeGraphics
, rect
));
1172 IntersectClip(const Rect
&rect
)
1174 return SetStatus(DllExports::GdipSetClipRectI(
1175 nativeGraphics
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, CombineModeIntersect
));
1179 IntersectClip(const Region
*region
)
1181 return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics
, getNat(region
), CombineModeIntersect
));
1185 IntersectClip(const RectF
&rect
)
1188 DllExports::GdipSetClipRect(nativeGraphics
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, CombineModeIntersect
));
1195 SetStatus(DllExports::GdipIsClipEmpty(nativeGraphics
, &result
));
1200 IsVisible(const Point
&point
) const
1203 SetStatus(DllExports::GdipIsVisiblePointI(nativeGraphics
, point
.X
, point
.Y
, &result
));
1208 IsVisible(const Rect
&rect
) const
1211 SetStatus(DllExports::GdipIsVisibleRectI(nativeGraphics
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, &result
));
1216 IsVisible(REAL x
, REAL y
) const
1219 SetStatus(DllExports::GdipIsVisiblePoint(nativeGraphics
, x
, y
, &result
));
1224 IsVisible(const RectF
&rect
) const
1227 SetStatus(DllExports::GdipIsVisibleRect(nativeGraphics
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, &result
));
1232 IsVisible(INT x
, INT y
, INT width
, INT height
) const
1235 SetStatus(DllExports::GdipIsVisibleRectI(nativeGraphics
, x
, y
, width
, height
, &result
));
1240 IsVisible(INT x
, INT y
) const
1243 SetStatus(DllExports::GdipIsVisiblePointI(nativeGraphics
, x
, y
, &result
));
1248 IsVisible(const PointF
&point
) const
1251 SetStatus(DllExports::GdipIsVisiblePoint(nativeGraphics
, point
.X
, point
.Y
, &result
));
1256 IsVisible(REAL x
, REAL y
, REAL width
, REAL height
) const
1259 SetStatus(DllExports::GdipIsVisibleRect(nativeGraphics
, x
, y
, width
, height
, &result
));
1264 IsVisibleClipEmpty() const
1267 return FALSE
; // FIXME
1270 SetStatus(DllExports::GdipIsVisibleClipEmpty(nativeGraphics
, &flag
));
1276 MeasureCharacterRanges(
1277 const WCHAR
*string
,
1280 const RectF
&layoutRect
,
1281 const StringFormat
*stringFormat
,
1283 Region
*regions
) const
1285 return NotImplemented
;
1289 MeasureDriverString(
1293 const PointF
*positions
,
1295 const Matrix
*matrix
,
1296 RectF
*boundingBox
) const
1298 return NotImplemented
;
1302 MeasureString(const WCHAR
*string
, INT length
, const Font
*font
, const RectF
&layoutRect
, RectF
*boundingBox
) const
1304 return NotImplemented
;
1309 const WCHAR
*string
,
1312 const PointF
&origin
,
1313 const StringFormat
*stringFormat
,
1314 RectF
*boundingBox
) const
1316 return NotImplemented
;
1321 const WCHAR
*string
,
1324 const RectF
&layoutRect
,
1325 const StringFormat
*stringFormat
,
1327 INT
*codepointsFitted
,
1328 INT
*linesFilled
) const
1330 return NotImplemented
;
1335 const WCHAR
*string
,
1338 const SizeF
&layoutRectSize
,
1339 const StringFormat
*stringFormat
,
1341 INT
*codepointsFitted
,
1342 INT
*linesFilled
) const
1344 return NotImplemented
;
1348 MeasureString(const WCHAR
*string
, INT length
, const Font
*font
, const PointF
&origin
, RectF
*boundingBox
) const
1350 return NotImplemented
;
1354 MultiplyTransform(Matrix
*matrix
, MatrixOrder order
)
1356 return SetStatus(DllExports::GdipMultiplyWorldTransform(nativeGraphics
, getNat(matrix
), order
));
1362 SetStatus(DllExports::GdipReleaseDC(nativeGraphics
, hdc
));
1368 return SetStatus(DllExports::GdipResetClip(nativeGraphics
));
1374 return SetStatus(DllExports::GdipResetWorldTransform(nativeGraphics
));
1378 Restore(GraphicsState gstate
)
1380 return NotImplemented
;
1384 RotateTransform(REAL angle
, MatrixOrder order
= MatrixOrderPrepend
)
1386 return SetStatus(DllExports::GdipRotateWorldTransform(nativeGraphics
, angle
, order
));
1396 ScaleTransform(REAL sx
, REAL sy
, MatrixOrder order
= MatrixOrderPrepend
)
1398 return SetStatus(DllExports::GdipScaleWorldTransform(nativeGraphics
, sx
, sy
, order
));
1402 SetClip(const Graphics
*g
, CombineMode combineMode
= CombineModeReplace
)
1404 return SetStatus(DllExports::GdipSetClipGraphics(nativeGraphics
, g
? g
->nativeGraphics
: NULL
, combineMode
));
1408 SetClip(const GraphicsPath
*path
, CombineMode combineMode
= CombineModeReplace
)
1410 return SetStatus(DllExports::GdipSetClipPath(nativeGraphics
, getNat(path
), combineMode
));
1414 SetClip(const Region
*region
, CombineMode combineMode
= CombineModeReplace
)
1416 return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics
, getNat(region
), combineMode
));
1420 SetClip(const Rect
&rect
, CombineMode combineMode
= CombineModeReplace
)
1423 DllExports::GdipSetClipRectI(nativeGraphics
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, combineMode
));
1427 SetClip(HRGN hRgn
, CombineMode combineMode
= CombineModeReplace
)
1429 return SetStatus(DllExports::GdipSetClipHrgn(nativeGraphics
, hRgn
, combineMode
));
1433 SetClip(const RectF
&rect
, CombineMode combineMode
= CombineModeReplace
)
1436 DllExports::GdipSetClipRect(nativeGraphics
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, combineMode
));
1440 SetCompositingMode(CompositingMode compositingMode
)
1442 return SetStatus(DllExports::GdipSetCompositingMode(nativeGraphics
, compositingMode
));
1446 SetCompositingQuality(CompositingQuality compositingQuality
)
1448 return SetStatus(DllExports::GdipSetCompositingQuality(nativeGraphics
, compositingQuality
));
1452 SetInterpolationMode(InterpolationMode interpolationMode
)
1454 return SetStatus(DllExports::GdipSetInterpolationMode(nativeGraphics
, interpolationMode
));
1458 SetPageScale(REAL scale
)
1460 return SetStatus(DllExports::GdipSetPageScale(nativeGraphics
, scale
));
1464 SetPageUnit(Unit unit
)
1466 return SetStatus(DllExports::GdipSetPageUnit(nativeGraphics
, unit
));
1470 SetPixelOffsetMode(PixelOffsetMode pixelOffsetMode
)
1472 return SetStatus(DllExports::GdipSetPixelOffsetMode(nativeGraphics
, pixelOffsetMode
));
1476 SetRenderingOrigin(INT x
, INT y
)
1478 return SetStatus(DllExports::GdipSetRenderingOrigin(nativeGraphics
, x
, y
));
1482 SetSmoothingMode(SmoothingMode smoothingMode
)
1484 return SetStatus(DllExports::GdipSetSmoothingMode(nativeGraphics
, smoothingMode
));
1488 SetTextContrast(UINT contrast
)
1490 return SetStatus(DllExports::GdipSetTextContrast(nativeGraphics
, contrast
));
1494 SetTextRenderingHint(TextRenderingHint newMode
)
1496 return SetStatus(DllExports::GdipSetTextRenderingHint(nativeGraphics
, newMode
));
1500 SetTransform(const Matrix
*matrix
)
1502 return SetStatus(DllExports::GdipSetWorldTransform(nativeGraphics
, getNat(matrix
)));
1506 TransformPoints(CoordinateSpace destSpace
, CoordinateSpace srcSpace
, Point
*pts
, INT count
)
1508 return SetStatus(DllExports::GdipTransformPointsI(nativeGraphics
, destSpace
, srcSpace
, pts
, count
));
1512 TransformPoints(CoordinateSpace destSpace
, CoordinateSpace srcSpace
, PointF
*pts
, INT count
)
1514 return SetStatus(DllExports::GdipTransformPoints(nativeGraphics
, destSpace
, srcSpace
, pts
, count
));
1518 TranslateClip(INT dx
, INT dy
)
1520 return SetStatus(DllExports::GdipTranslateClipI(nativeGraphics
, dx
, dy
));
1524 TranslateClip(REAL dx
, REAL dy
)
1526 return SetStatus(DllExports::GdipTranslateClip(nativeGraphics
, dx
, dy
));
1530 TranslateTransform(REAL dx
, REAL dy
, MatrixOrder order
= MatrixOrderPrepend
)
1532 return SetStatus(DllExports::GdipTranslateWorldTransform(nativeGraphics
, dx
, dy
, order
));
1537 SetStatus(Status status
) const
1540 lastStatus
= status
;
1545 SetNativeGraphics(GpGraphics
*graphics
)
1547 nativeGraphics
= graphics
;
1551 GpGraphics
*nativeGraphics
;
1552 mutable Status lastStatus
;
1555 friend inline GpGraphics
*&
1556 getNat(const Graphics
*graph
)
1558 return const_cast<Graphics
*>(graph
)->nativeGraphics
;
1562 #endif /* _GDIPLUSGRAPHICS_H */