2 // System.Drawing.Bitmap.cs
4 // (C) 2003 Ximian, Inc. http://www.ximian.com
7 // Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
8 // Alexandre Pigolkine (pigolkine@gmx.de)
12 using System.Drawing.Drawing2D;
13 using System.Drawing.Imaging;
14 using System.Drawing.Text;
15 using System.Runtime.InteropServices;
17 namespace System.Drawing
21 internal class GraphicsFactory : IGraphicsFactory {
23 public System.Drawing.IGraphics Graphics(IntPtr nativeGraphics) {
24 return new Graphics(nativeGraphics);
27 public System.Drawing.IGraphics FromImage(System.Drawing.Image image) {
28 return Win32Impl.Graphics.FromImage(image);
31 public System.Drawing.IGraphics FromHwnd( IntPtr hwnd) {
32 return Win32Impl.Graphics.FromHwnd(hwnd);
38 internal sealed class Graphics : MarshalByRefObject, IGraphics
40 public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
44 PlayRecordCallback callbackData);
46 public delegate bool DrawImageAbort (IntPtr callbackData);
48 internal enum GraphicsType {
49 fromHdc, fromHwnd, fromImage
52 internal GraphicsType type_;
53 internal IntPtr hdc_ = IntPtr.Zero;
54 internal IntPtr initialBitmap_ = IntPtr.Zero;
55 internal IntPtr initialHwnd_ = IntPtr.Zero;
56 internal System.Drawing.Win32Impl.Image initializedFromImage_ = null;
58 internal Graphics (IntPtr nativeGraphics)
60 hdc_ = nativeGraphics;
64 internal static Pen ConvertPen( System.Drawing.Pen pen)
66 return pen.implementation_ as Pen;
69 internal static Brush ConvertBrush( System.Drawing.Brush brush)
71 return brush.implementation_ as Brush;
74 internal static Image ConvertImage( System.Drawing.Image image)
76 return image.implementation_ as Image;
81 void IGraphics.AddMetafileComment (byte [] data)
83 throw new NotImplementedException ();
87 GraphicsContainer IGraphics.BeginContainer ()
89 throw new NotImplementedException ();
93 GraphicsContainer IGraphics.BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
95 throw new NotImplementedException ();
99 GraphicsContainer IGraphics.BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
101 throw new NotImplementedException ();
105 void IGraphics.Clear (Color color)
107 throw new NotImplementedException ();
111 void IDisposable.Dispose ()
114 case GraphicsType.fromHwnd:
115 Win32.ReleaseDC(initialHwnd_, hdc_);
117 case GraphicsType.fromHdc:
119 case GraphicsType.fromImage:
120 Win32.SelectObject(hdc_, initialBitmap_);
121 initializedFromImage_.selectedIntoGraphics_ = null;
127 void IGraphics.DrawArc (System.Drawing.Pen pen, Rectangle rect, float startAngle, float sweepAngle)
129 throw new NotImplementedException ();
133 void IGraphics.DrawArc (System.Drawing.Pen pen, RectangleF rect, float startAngle, float sweepAngle)
135 throw new NotImplementedException ();
139 void IGraphics.DrawArc (System.Drawing.Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
141 throw new NotImplementedException ();
145 void IGraphics.DrawArc (System.Drawing.Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
147 throw new NotImplementedException ();
151 void IGraphics.DrawBezier (System.Drawing.Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
153 throw new NotImplementedException ();
157 void IGraphics.DrawBezier (System.Drawing.Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
159 throw new NotImplementedException ();
163 void IGraphics.DrawBezier (System.Drawing.Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
165 throw new NotImplementedException ();
169 void IGraphics.DrawBeziers (System.Drawing.Pen pen, Point [] points)
171 throw new NotImplementedException ();
175 void IGraphics.DrawBeziers (System.Drawing.Pen pen, PointF [] points)
177 throw new NotImplementedException ();
181 void IGraphics.DrawClosedCurve (System.Drawing.Pen pen, PointF [] points)
183 throw new NotImplementedException ();
187 void IGraphics.DrawClosedCurve (System.Drawing.Pen pen, Point [] points)
189 throw new NotImplementedException ();
193 void IGraphics.DrawClosedCurve (System.Drawing.Pen pen, Point [] points, float tension, FillMode fillmode)
195 throw new NotImplementedException ();
199 void IGraphics.DrawClosedCurve (System.Drawing.Pen pen, PointF [] points, float tension, FillMode fillmode)
201 throw new NotImplementedException ();
205 void IGraphics.DrawCurve (System.Drawing.Pen pen, Point [] points)
207 throw new NotImplementedException ();
211 void IGraphics.DrawCurve (System.Drawing.Pen pen, PointF [] points)
213 throw new NotImplementedException ();
217 void IGraphics.DrawCurve (System.Drawing.Pen pen, PointF [] points, float tension)
219 throw new NotImplementedException ();
223 void IGraphics.DrawCurve (System.Drawing.Pen pen, Point [] points, float tension)
225 throw new NotImplementedException ();
229 void IGraphics.DrawCurve (System.Drawing.Pen pen, PointF [] points, int offset, int numberOfSegments)
231 throw new NotImplementedException ();
235 void IGraphics.DrawCurve (System.Drawing.Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
237 throw new NotImplementedException ();
241 void IGraphics.DrawCurve (System.Drawing.Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
243 throw new NotImplementedException ();
247 void IGraphics.DrawEllipse (System.Drawing.Pen pen, Rectangle rect)
249 throw new NotImplementedException ();
253 void IGraphics.DrawEllipse (System.Drawing.Pen pen, RectangleF rect)
255 throw new NotImplementedException ();
259 void IGraphics.DrawEllipse (System.Drawing.Pen pen, int x, int y, int width, int height)
261 throw new NotImplementedException ();
265 void IGraphics.DrawEllipse (System.Drawing.Pen pen, float x, float y, float width, float height)
267 throw new NotImplementedException ();
271 void IGraphics.DrawIcon (System.Drawing.Icon icon, Rectangle targetRect)
273 throw new NotImplementedException ();
277 void IGraphics.DrawIcon (System.Drawing.Icon icon, int x, int y)
279 throw new NotImplementedException ();
283 void IGraphics.DrawIconUnstretched (System.Drawing.Icon icon, Rectangle targetRect)
285 throw new NotImplementedException ();
289 void IGraphics.DrawImage (System.Drawing.Image image, RectangleF rect)
291 throw new NotImplementedException ();
295 void IGraphics.DrawImage (System.Drawing.Image image, PointF point)
297 throw new NotImplementedException ();
301 void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints)
303 throw new NotImplementedException ();
307 void IGraphics.DrawImage (System.Drawing.Image image, Point point)
309 throw new NotImplementedException ();
313 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle rect)
315 throw new NotImplementedException ();
319 void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints)
321 throw new NotImplementedException ();
325 void IGraphics.DrawImage (System.Drawing.Image image, int x, int y)
327 throw new NotImplementedException ();
331 void IGraphics.DrawImage (System.Drawing.Image image, float x, float y)
333 throw new NotImplementedException ();
337 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
339 throw new NotImplementedException ();
343 void IGraphics.DrawImage (System.Drawing.Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
345 throw new NotImplementedException ();
349 void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
351 throw new NotImplementedException ();
355 void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
357 throw new NotImplementedException ();
361 void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)
363 throw new NotImplementedException ();
367 void IGraphics.DrawImage (System.Drawing.Image image, float x, float y, float width, float height)
369 throw new NotImplementedException ();
373 void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)
375 throw new NotImplementedException ();
379 void IGraphics.DrawImage (System.Drawing.Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
381 throw new NotImplementedException ();
385 void IGraphics.DrawImage (System.Drawing.Image image, int x, int y, int width, int height)
387 System.Drawing.Win32Impl.Image wineImage = image.implementation_ as System.Drawing.Win32Impl.Image;
388 Graphics imageGraphics = wineImage.selectedIntoGraphics_;
389 if( imageGraphics == null) {
390 IntPtr tempDC = Win32.CreateCompatibleDC (hdc_);
391 IntPtr oldBmp = Win32.SelectObject (tempDC, wineImage.nativeObject_);
392 Win32.BitBlt(hdc_, x, y, width, height, tempDC, 0, 0, PatBltTypes.SRCCOPY);
393 Win32.SelectObject (tempDC, oldBmp);
394 Win32.DeleteDC (tempDC);
397 Win32.BitBlt(hdc_, x, y, width, height, imageGraphics.hdc_, 0, 0, PatBltTypes.SRCCOPY);
402 void IGraphics.DrawImage (System.Drawing.Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
404 throw new NotImplementedException ();
408 void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback)
410 throw new NotImplementedException ();
414 void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback)
416 throw new NotImplementedException ();
420 void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback, int callbackData)
422 throw new NotImplementedException ();
426 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
428 throw new NotImplementedException ();
432 void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback, int callbackData)
434 throw new NotImplementedException ();
438 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
440 throw new NotImplementedException ();
444 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
446 throw new NotImplementedException ();
450 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
452 throw new NotImplementedException ();
456 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback)
458 throw new NotImplementedException ();
462 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback)
464 throw new NotImplementedException ();
468 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback, IntPtr callbackData)
470 throw new NotImplementedException ();
474 void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback, IntPtr callbackData)
476 throw new NotImplementedException ();
480 void IGraphics.DrawImageUnscaled (System.Drawing.Image image, Point point)
482 throw new NotImplementedException ();
486 void IGraphics.DrawImageUnscaled (System.Drawing.Image image, Rectangle rect)
488 throw new NotImplementedException ();
492 void IGraphics.DrawImageUnscaled (System.Drawing.Image image, int x, int y)
494 throw new NotImplementedException ();
498 void IGraphics.DrawImageUnscaled (System.Drawing.Image image, int x, int y, int width, int height)
500 throw new NotImplementedException ();
504 void IGraphics.DrawLine (System.Drawing.Pen pen, PointF pt1, PointF pt2)
506 throw new NotImplementedException ();
510 void IGraphics.DrawLine (System.Drawing.Pen pen, Point pt1, Point pt2)
512 throw new NotImplementedException ();
516 void IGraphics.DrawLine (System.Drawing.Pen pen, int x1, int y1, int x2, int y2)
518 throw new NotImplementedException ();
522 void IGraphics.DrawLine (System.Drawing.Pen pen, float x1, float y1, float x2, float y2)
524 throw new NotImplementedException ();
528 void IGraphics.DrawLines (System.Drawing.Pen pen, PointF [] points)
530 throw new NotImplementedException ();
534 void IGraphics.DrawLines (System.Drawing.Pen pen, Point [] points)
536 throw new NotImplementedException ();
540 void IGraphics.DrawPath (System.Drawing.Pen pen, GraphicsPath path)
542 throw new NotImplementedException ();
546 void IGraphics.DrawPie (System.Drawing.Pen pen, Rectangle rect, float startAngle, float sweepAngle)
548 throw new NotImplementedException ();
552 void IGraphics.DrawPie (System.Drawing.Pen pen, RectangleF rect, float startAngle, float sweepAngle)
554 throw new NotImplementedException ();
558 void IGraphics.DrawPie (System.Drawing.Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
560 throw new NotImplementedException ();
564 void IGraphics.DrawPie (System.Drawing.Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
566 throw new NotImplementedException ();
570 void IGraphics.DrawPolygon (System.Drawing.Pen pen, Point [] points)
572 throw new NotImplementedException ();
576 void IGraphics.DrawPolygon (System.Drawing.Pen pen, PointF [] points)
578 throw new NotImplementedException ();
582 void IGraphics.DrawRectangle (System.Drawing.Pen pen, Rectangle rect)
584 DrawRectangle(ConvertPen(pen), rect.Left, rect.Top, rect.Width, rect.Height);
588 void IGraphics.DrawRectangle (System.Drawing.Pen pen, float x, float y, float width, float height)
590 DrawRectangle(ConvertPen(pen), (int)x, (int)y, (int)width, (int)height);
593 void DrawRectangle (Pen winePen, int x, int y, int width, int height)
595 POINT[] pts = new POINT[5];
599 pts[1].y = y + height;
600 pts[2].x = x + width;
601 pts[2].y = y + height;
602 pts[3].x = x + width;
606 IntPtr oldPen = Win32.SelectObject(hdc_, winePen.hpen_);
607 Win32.Polyline( hdc_, pts, 5);
608 Win32.SelectObject(hdc_, oldPen);
612 void IGraphics.DrawRectangle (System.Drawing.Pen pen, int x, int y, int width, int height)
614 DrawRectangle(ConvertPen(pen), x, y, width, height);
618 void IGraphics.DrawRectangles (System.Drawing.Pen pen, RectangleF [] rects)
620 foreach( RectangleF rc in rects)
622 DrawRectangle(ConvertPen(pen), (int)rc.Left, (int)rc.Top, (int)rc.Width, (int)rc.Height);
627 void IGraphics.DrawRectangles (System.Drawing.Pen pen, Rectangle [] rects)
629 foreach( RectangleF rc in rects)
631 DrawRectangle(ConvertPen(pen), (int)rc.Left, (int)rc.Top, (int)rc.Width, (int)rc.Height);
636 void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, RectangleF layoutRectangle)
638 //throw new NotImplementedException ();
642 void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, PointF point)
644 //throw new NotImplementedException ();
648 void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, PointF point, StringFormat format)
650 //throw new NotImplementedException ();
654 void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, RectangleF layoutRectangle, StringFormat format)
656 //throw new NotImplementedException ();
657 RECT rc = new RECT();
658 rc.left = (int)layoutRectangle.Left;
659 rc.top = (int)layoutRectangle.Top;
660 rc.right = (int)layoutRectangle.Right;
661 rc.bottom = (int)layoutRectangle.Bottom;
662 IntPtr prevFont = Win32.SelectObject(hdc_, font.ToHfont());
663 Win32.SetTextColor(hdc_, Win32.RGB(((IBrush)ConvertBrush(brush)).TextColor));
664 Win32.SetBkMode(hdc_, BackgroundMode.TRANSPARENT);
665 Win32.ExtTextOut(hdc_, (int)layoutRectangle.Left, (int)layoutRectangle.Top, 0, ref rc,
666 s, s.Length, IntPtr.Zero);
667 Win32.SelectObject(hdc_, prevFont);
671 void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, float x, float y)
673 IntPtr prevFont = Win32.SelectObject(hdc_, font.ToHfont());
674 Win32.SetTextColor(hdc_, Win32.RGB(((IBrush)ConvertBrush(brush)).TextColor));
675 Win32.SetBkMode(hdc_, BackgroundMode.TRANSPARENT);
676 Win32.ExtTextOut(hdc_, (int)x, (int)y, 0, IntPtr.Zero,
677 s, s.Length, IntPtr.Zero);
678 Win32.SelectObject(hdc_, prevFont);
682 void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, float x, float y, StringFormat format)
684 //throw new NotImplementedException ();
688 void IGraphics.EndContainer (GraphicsContainer container)
690 throw new NotImplementedException ();
694 void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback)
696 throw new NotImplementedException ();
700 void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback)
702 throw new NotImplementedException ();
706 void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback)
708 throw new NotImplementedException ();
712 void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback)
714 throw new NotImplementedException ();
718 void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback)
720 throw new NotImplementedException ();
724 void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback)
726 throw new NotImplementedException ();
730 void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
732 throw new NotImplementedException ();
736 void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
738 throw new NotImplementedException ();
742 void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
744 throw new NotImplementedException ();
748 void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
750 throw new NotImplementedException ();
754 void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
756 throw new NotImplementedException ();
760 void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
762 throw new NotImplementedException ();
766 void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback)
768 throw new NotImplementedException ();
772 void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback)
774 throw new NotImplementedException ();
778 void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback)
780 throw new NotImplementedException ();
784 void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback)
786 throw new NotImplementedException ();
790 void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback)
792 throw new NotImplementedException ();
796 void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback)
798 throw new NotImplementedException ();
802 void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
804 throw new NotImplementedException ();
808 void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
810 throw new NotImplementedException ();
814 void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
816 throw new NotImplementedException ();
820 void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
822 throw new NotImplementedException ();
826 void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
828 throw new NotImplementedException ();
832 void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
834 throw new NotImplementedException ();
838 void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
840 throw new NotImplementedException ();
844 void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
846 throw new NotImplementedException ();
850 void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
852 throw new NotImplementedException ();
856 void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
858 throw new NotImplementedException ();
862 void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
864 throw new NotImplementedException ();
868 void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData)
870 throw new NotImplementedException ();
874 void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
876 throw new NotImplementedException ();
880 void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
882 throw new NotImplementedException ();
886 void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
888 throw new NotImplementedException ();
892 void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
894 throw new NotImplementedException ();
898 void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
900 throw new NotImplementedException ();
904 void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
906 throw new NotImplementedException ();
910 void IGraphics.ExcludeClip (Rectangle rect)
912 throw new NotImplementedException ();
916 void IGraphics.ExcludeClip (System.Drawing.Region region)
918 throw new NotImplementedException ();
922 void IGraphics.FillClosedCurve (System.Drawing.Brush brush, PointF [] points)
924 throw new NotImplementedException ();
928 void IGraphics.FillClosedCurve (System.Drawing.Brush brush, Point [] points)
930 throw new NotImplementedException ();
934 void IGraphics.FillClosedCurve (System.Drawing.Brush brush, PointF [] points, FillMode fillmode)
936 throw new NotImplementedException ();
940 void IGraphics.FillClosedCurve (System.Drawing.Brush brush, Point [] points, FillMode fillmode)
942 throw new NotImplementedException ();
946 void IGraphics.FillClosedCurve (System.Drawing.Brush brush, PointF [] points, FillMode fillmode, float tension)
948 throw new NotImplementedException ();
952 void IGraphics.FillClosedCurve (System.Drawing.Brush brush, Point [] points, FillMode fillmode, float tension)
954 throw new NotImplementedException ();
958 void IGraphics.FillEllipse (System.Drawing.Brush brush, Rectangle rect)
960 throw new NotImplementedException ();
964 void IGraphics.FillEllipse (System.Drawing.Brush brush, RectangleF rect)
966 throw new NotImplementedException ();
970 void IGraphics.FillEllipse (System.Drawing.Brush brush, float x, float y, float width, float height)
972 throw new NotImplementedException ();
976 void IGraphics.FillEllipse (System.Drawing.Brush brush, int x, int y, int width, int height)
978 throw new NotImplementedException ();
982 void IGraphics.FillPath (System.Drawing.Brush brush, GraphicsPath path)
984 throw new NotImplementedException ();
988 void IGraphics.FillPie (System.Drawing.Brush brush, Rectangle rect, float startAngle, float sweepAngle)
990 throw new NotImplementedException ();
994 void IGraphics.FillPie (System.Drawing.Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
996 throw new NotImplementedException ();
1000 void IGraphics.FillPie (System.Drawing.Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
1002 throw new NotImplementedException ();
1006 void IGraphics.FillPolygon (System.Drawing.Brush brush, PointF [] points)
1008 throw new NotImplementedException ();
1012 void IGraphics.FillPolygon (System.Drawing.Brush brush, Point [] points)
1014 throw new NotImplementedException ();
1018 void IGraphics.FillPolygon (System.Drawing.Brush brush, Point [] points, FillMode fillMode)
1020 throw new NotImplementedException ();
1024 void IGraphics.FillPolygon (System.Drawing.Brush brush, PointF [] points, FillMode fillMode)
1026 throw new NotImplementedException ();
1030 void IGraphics.FillRectangle (System.Drawing.Brush brush, RectangleF rect)
1032 FillRectangle( ConvertBrush(brush), (int)rect.Left, (int)rect.Top, (int)rect.Width, (int)rect.Height);
1036 void IGraphics.FillRectangle (System.Drawing.Brush brush, Rectangle rect)
1038 FillRectangle( ConvertBrush(brush), rect.Left, rect.Top, rect.Width, rect.Height);
1041 void FillRectangle (Brush wineBrush, RectangleF rect)
1043 FillRectangle( wineBrush, (int)rect.Left, (int)rect.Top, (int)rect.Width, (int)rect.Height);
1046 void FillRectangle (Brush wineBrush, Rectangle rect)
1048 FillRectangle( wineBrush, rect.Left, rect.Top, rect.Width, rect.Height);
1051 void FillRectangle (Brush wineBrush, int x, int y, int width, int height)
1053 RECT rc = new RECT();
1056 rc.right = rc.left + width /*+ 1*/;
1057 rc.bottom = rc.top + height /*+ 1*/;
1058 Win32.FillRect( hdc_, ref rc, wineBrush.hbrush_);
1062 void IGraphics.FillRectangle (System.Drawing.Brush brush, int x, int y, int width, int height)
1064 System.Drawing.Win32Impl.Brush wineBrush = ConvertBrush(brush);
1066 if( wineBrush is SolidBrush)
1068 FillRectangle(wineBrush, x, y, width, height);
1070 else if( brush is LinearGradientBrush)
1072 // FIXME: just to indicate 2 colours
1073 LinearGradientBrush br = brush as LinearGradientBrush;
1074 Color[] colors = br.LinearColors;
1075 SolidBrush sb1 = new SolidBrush(colors[0]);
1076 SolidBrush sb2 = new SolidBrush(colors[1]);
1077 // FIXME: find a way to call those
1078 FillRectangle(sb1, x, y, width / 2, height);
1079 FillRectangle(sb2, x + width / 2, y, width , height);
1086 void IGraphics.FillRectangle (System.Drawing.Brush brush, float x, float y, float width, float height)
1088 FillRectangle( ConvertBrush(brush), (int)x, (int)y, (int)width, (int)height);
1092 void IGraphics.FillRectangles (System.Drawing.Brush brush, Rectangle [] rects)
1096 foreach( Rectangle rc in rects)
1098 FillRectangle(ConvertBrush(brush), rc);
1104 void IGraphics.FillRectangles (System.Drawing.Brush brush, RectangleF [] rects)
1108 foreach( RectangleF rc in rects)
1110 FillRectangle(ConvertBrush(brush), rc);
1116 void IGraphics.FillRegion (System.Drawing.Brush brush, System.Drawing.Region region)
1118 throw new NotImplementedException ();
1122 void IGraphics.Flush ()
1124 ((IGraphics)this).Flush(FlushIntention.Flush);
1128 void IGraphics.Flush (FlushIntention intention)
1134 public static Graphics FromHdc (IntPtr hdc)
1136 Graphics result = new Graphics(hdc);
1137 result.type_ = GraphicsType.fromHdc;
1142 public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1144 throw new NotImplementedException ();
1148 public static Graphics FromHdcInternal (IntPtr hdc)
1150 throw new NotImplementedException ();
1154 public static Graphics FromHwnd (IntPtr hwnd)
1156 IntPtr hdc = Win32.GetDC(hwnd);
1157 Graphics result = new Graphics(hdc);
1158 result.type_ = GraphicsType.fromHwnd;
1163 public static Graphics FromHwndInternal (IntPtr hwnd)
1165 throw new NotImplementedException ();
1169 public static Graphics FromImage (System.Drawing.Image image)
1171 System.Drawing.Win32Impl.Image wineImage = ConvertImage(image);
1172 IntPtr display = Win32.CreateDC("DISPLAY", "", "", IntPtr.Zero);
1173 IntPtr hdc = Win32.CreateCompatibleDC(display);
1174 Graphics result = new Graphics( hdc);
1175 result.initialBitmap_ = Win32.SelectObject(hdc, wineImage.nativeObject_);
1176 wineImage.selectedIntoGraphics_ = result;
1177 result.initializedFromImage_ = wineImage;
1178 Win32.DeleteDC(display);
1179 result.type_ = GraphicsType.fromImage;
1184 public static IntPtr GetHalftonePalette ()
1186 throw new NotImplementedException ();
1190 public IntPtr GetHdc ()
1196 public Color GetNearestColor (Color color)
1198 throw new NotImplementedException ();
1202 void IGraphics.IntersectClip (System.Drawing.Region region)
1204 throw new NotImplementedException ();
1208 void IGraphics.IntersectClip (RectangleF rect)
1210 throw new NotImplementedException ();
1214 void IGraphics.IntersectClip (Rectangle rect)
1216 throw new NotImplementedException ();
1220 public bool IsVisible (Point point)
1222 throw new NotImplementedException ();
1226 public bool IsVisible (RectangleF rect)
1228 throw new NotImplementedException ();
1232 public bool IsVisible (PointF point)
1234 throw new NotImplementedException ();
1238 public bool IsVisible (Rectangle rect)
1240 throw new NotImplementedException ();
1244 public bool IsVisible (float x, float y)
1246 throw new NotImplementedException ();
1250 public bool IsVisible (int x, int y)
1252 throw new NotImplementedException ();
1256 public bool IsVisible (float x, float y, float width, float height)
1258 throw new NotImplementedException ();
1262 public bool IsVisible (int x, int y, int width, int height)
1264 throw new NotImplementedException ();
1268 public System.Drawing.Region [] MeasureCharacterRanges (string text, System.Drawing.Font font, RectangleF layoutRect, StringFormat stringFormat)
1270 throw new NotImplementedException ();
1274 public SizeF MeasureString (string text, System.Drawing.Font font)
1276 SIZE sz = new SIZE();
1277 IntPtr prevFont = Win32.SelectObject(hdc_, font.ToHfont());
1278 Win32.GetTextExtentPoint32(hdc_, text, text.Length, ref sz);
1279 Win32.SelectObject(hdc_, prevFont);
1280 return new SizeF((float)sz.cx, (float)sz.cy);
1284 public SizeF MeasureString (string text, System.Drawing.Font font, SizeF layoutArea)
1286 throw new NotImplementedException ();
1290 public SizeF MeasureString (string text, System.Drawing.Font font, int width)
1292 throw new NotImplementedException ();
1296 public SizeF MeasureString (string text, System.Drawing.Font font, SizeF layoutArea, StringFormat stringFormat)
1298 throw new NotImplementedException ();
1302 public SizeF MeasureString (string text, System.Drawing.Font font, int width, StringFormat format)
1304 throw new NotImplementedException ();
1308 public SizeF MeasureString (string text, System.Drawing.Font font, PointF origin, StringFormat stringFormat)
1310 throw new NotImplementedException ();
1314 public SizeF MeasureString (string text, System.Drawing.Font font, SizeF layoutArea, StringFormat stringFormat, ref int charactersFitted, ref int linesFilled)
1316 throw new NotImplementedException ();
1320 void IGraphics.MultiplyTransform (Matrix matrix)
1322 throw new NotImplementedException ();
1326 void IGraphics.MultiplyTransform (Matrix matrix, MatrixOrder order)
1328 throw new NotImplementedException ();
1332 internal void ReleaseHdc (IntPtr hdc)
1337 void IGraphics.ReleaseHdc (IntPtr hdc)
1342 void IGraphics.ReleaseHdcInternal (IntPtr hdc)
1344 throw new NotImplementedException ();
1348 void IGraphics.ResetClip ()
1350 throw new NotImplementedException ();
1354 void IGraphics.ResetTransform ()
1356 throw new NotImplementedException ();
1360 void IGraphics.Restore (GraphicsState gstate)
1362 throw new NotImplementedException ();
1366 void IGraphics.RotateTransform (float angle)
1368 throw new NotImplementedException ();
1372 void IGraphics.RotateTransform (float angle, MatrixOrder order)
1374 throw new NotImplementedException ();
1378 public GraphicsState Save ()
1380 throw new NotImplementedException ();
1384 void IGraphics.ScaleTransform (float sx, float sy)
1386 throw new NotImplementedException ();
1390 void IGraphics.ScaleTransform (float sx, float sy, MatrixOrder order)
1392 throw new NotImplementedException ();
1396 void IGraphics.SetClip (RectangleF rect)
1398 throw new NotImplementedException ();
1402 void IGraphics.SetClip (GraphicsPath path)
1404 throw new NotImplementedException ();
1408 void IGraphics.SetClip (Rectangle rect)
1410 throw new NotImplementedException ();
1414 void IGraphics.SetClip (System.Drawing.Graphics g)
1416 throw new NotImplementedException ();
1420 void IGraphics.SetClip (System.Drawing.Graphics g, CombineMode combineMode)
1422 throw new NotImplementedException ();
1426 void IGraphics.SetClip (Rectangle rect, CombineMode combineMode)
1428 throw new NotImplementedException ();
1432 void IGraphics.SetClip (RectangleF rect, CombineMode combineMode)
1434 throw new NotImplementedException ();
1438 void IGraphics.SetClip (System.Drawing.Region region, CombineMode combineMode)
1440 throw new NotImplementedException ();
1444 void IGraphics.SetClip (GraphicsPath path, CombineMode combineMode)
1446 throw new NotImplementedException ();
1450 void IGraphics.TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
1452 throw new NotImplementedException ();
1456 void IGraphics.TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
1458 throw new NotImplementedException ();
1462 void IGraphics.TranslateClip (int dx, int dy)
1464 throw new NotImplementedException ();
1468 void IGraphics.TranslateClip (float dx, float dy)
1470 throw new NotImplementedException ();
1474 void IGraphics.TranslateTransform (float dx, float dy)
1476 throw new NotImplementedException ();
1480 void IGraphics.TranslateTransform (float dx, float dy, MatrixOrder order)
1482 throw new NotImplementedException ();
1485 System.Drawing.Region System.Drawing.IGraphics.Clip
1489 throw new NotImplementedException ();
1493 //throw new NotImplementedException ();
1497 RectangleF IGraphics.ClipBounds
1501 throw new NotImplementedException ();
1505 CompositingMode IGraphics.CompositingMode
1509 throw new NotImplementedException ();
1513 throw new NotImplementedException ();
1517 CompositingQuality IGraphics.CompositingQuality
1521 throw new NotImplementedException ();
1525 throw new NotImplementedException ();
1529 float IGraphics.DpiX
1533 throw new NotImplementedException ();
1537 float IGraphics.DpiY
1541 throw new NotImplementedException ();
1545 InterpolationMode IGraphics.InterpolationMode
1549 throw new NotImplementedException ();
1553 throw new NotImplementedException ();
1557 bool IGraphics.IsClipEmpty
1561 throw new NotImplementedException ();
1565 bool IGraphics.IsVisibleClipEmpty
1569 throw new NotImplementedException ();
1573 float IGraphics.PageScale
1577 throw new NotImplementedException ();
1581 throw new NotImplementedException ();
1585 GraphicsUnit IGraphics.PageUnit
1589 throw new NotImplementedException ();
1593 throw new NotImplementedException ();
1597 PixelOffsetMode IGraphics.PixelOffsetMode
1601 throw new NotImplementedException ();
1605 throw new NotImplementedException ();
1609 Point IGraphics.RenderingOrigin
1613 throw new NotImplementedException ();
1617 throw new NotImplementedException ();
1621 SmoothingMode IGraphics.SmoothingMode
1625 throw new NotImplementedException ();
1629 throw new NotImplementedException ();
1633 int IGraphics.TextContrast
1637 throw new NotImplementedException ();
1641 throw new NotImplementedException ();
1645 TextRenderingHint IGraphics.TextRenderingHint
1649 throw new NotImplementedException ();
1653 throw new NotImplementedException ();
1657 Matrix IGraphics.Transform
1661 throw new NotImplementedException ();
1665 throw new NotImplementedException ();
1669 RectangleF IGraphics.VisibleClipBounds
1673 throw new NotImplementedException ();