コード例 #1
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawRectangles(DUIPen pen, Rectangle[] rects)
 {
     foreach (Rectangle rect in rects)
     {
         DrawRectangle(pen, rect);
     }
 }
コード例 #2
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawEllipses(DUIPen pen, RectangleF[] rects)
 {
     foreach (RectangleF rect in rects)
     {
         DrawEllipse(pen, rect);
     }
 }
コード例 #3
0
ファイル: DUIGraphics_D2D.cs プロジェクト: scjjcs/DirectUI
 public void DrawBezier(DUIPen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
 {
     pen.RenderTarget = this.target;
     if (pen.IsDefaultStyleProperties)
     {
         using (SharpDX.Direct2D1.PathGeometry pathGeometry = new SharpDX.Direct2D1.PathGeometry(this.target.RenderTarget.Factory))
             using (SharpDX.Direct2D1.GeometrySink geometrySink = pathGeometry.Open())
             {
                 geometrySink.BeginFigure(DxConvert.ToVector2(x1, y1), SharpDX.Direct2D1.FigureBegin.Hollow);
                 geometrySink.AddBezier(new SharpDX.Direct2D1.BezierSegment()
                 {
                     Point1 = DxConvert.ToVector2(x2, y2), Point2 = DxConvert.ToVector2(x3, y3), Point3 = DxConvert.ToVector2(x4, y4)
                 });
                 geometrySink.EndFigure(SharpDX.Direct2D1.FigureEnd.Open);
                 geometrySink.Close();
                 this.target.RenderTarget.DrawGeometry(pathGeometry, pen, pen.Width);
             }
     }
     else
     {
         using (SharpDX.Direct2D1.PathGeometry pathGeometry = new SharpDX.Direct2D1.PathGeometry(this.target.RenderTarget.Factory))
             using (SharpDX.Direct2D1.GeometrySink geometrySink = pathGeometry.Open())
             {
                 geometrySink.BeginFigure(DxConvert.ToVector2(x1, y1), SharpDX.Direct2D1.FigureBegin.Hollow);
                 geometrySink.AddBezier(new SharpDX.Direct2D1.BezierSegment()
                 {
                     Point1 = DxConvert.ToVector2(x2, y2), Point2 = DxConvert.ToVector2(x3, y3), Point3 = DxConvert.ToVector2(x4, y4)
                 });
                 geometrySink.EndFigure(SharpDX.Direct2D1.FigureEnd.Open);
                 geometrySink.Close();
                 this.target.RenderTarget.DrawGeometry(pathGeometry, pen, pen.Width, pen);
             }
     }
 }
コード例 #4
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawEllipse(DUIPen pen, float x, float y, float width, float height)
 {
     if (pen.Width == 0 || width == 0 || height == 0)
     {
         return;
     }
     this.iDUIGraphics.DrawEllipse(pen, x, y, width, height);
 }
コード例 #5
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawBezier(DUIPen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
 {
     if (pen.Width == 0)
     {
         return;
     }
     this.iDUIGraphics.DrawBezier(pen, x1, y1, x2, y2, x3, y3, x4, y4);
 }
コード例 #6
0
ファイル: DUIGraphics_GDIP.cs プロジェクト: scjjcs/DirectUI
 public void DrawRoundedRectangle(DUIPen pen, float x, float y, float width, float height, float radius)
 {
     if (width <= 0 || height <= 0)
     {
         return;
     }
     this.graphics.DrawPath(pen, Tools.GetRoundRectangleF(new RectangleF(x, y, width, height), radius));
 }
コード例 #7
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawRoundedRectangle(DUIPen pen, float x, float y, float width, float height, float radius)
 {
     if (pen.Width == 0 || width == 0 || height == 0)
     {
         return;
     }
     this.iDUIGraphics.DrawRoundedRectangle(pen, x, y, width, height, radius);
 }
コード例 #8
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawLine(DUIPen pen, float x1, float y1, float x2, float y2)
 {
     if (pen.Width == 0)
     {
         return;
     }
     if (x1 == x2 && y1 == y2)
     {
         return;
     }
     this.iDUIGraphics.DrawLine(pen, x1, y1, x2, y2);
 }
コード例 #9
0
ファイル: DUIGraphics_D2D.cs プロジェクト: scjjcs/DirectUI
 public void DrawRoundedRectangle(DUIPen pen, float x, float y, float width, float height, float radius)
 {
     pen.RenderTarget = this.target;
     if (pen.IsDefaultStyleProperties)
     {
         this.target.RenderTarget.DrawRoundedRectangle(DxConvert.ToRoundRectF(x, y, width, height, radius), pen, pen.Width);
     }
     else
     {
         this.target.RenderTarget.DrawRoundedRectangle(DxConvert.ToRoundRectF(x, y, width, height, radius), pen, pen.Width, pen);
     }
 }
コード例 #10
0
ファイル: DUIGraphics_D2D.cs プロジェクト: scjjcs/DirectUI
 public void DrawLine(DUIPen pen, float x1, float y1, float x2, float y2)
 {
     pen.RenderTarget = this.target;
     if (pen.IsDefaultStyleProperties)
     {
         this.target.RenderTarget.DrawLine(new SharpDX.Mathematics.Interop.RawVector2(x1, y1), new SharpDX.Mathematics.Interop.RawVector2(x2, y2), pen, pen.Width);
     }
     else
     {
         this.target.RenderTarget.DrawLine(new SharpDX.Mathematics.Interop.RawVector2(x1, y1), new SharpDX.Mathematics.Interop.RawVector2(x2, y2), pen, pen.Width, pen);
     }
 }
コード例 #11
0
ファイル: DUIGraphics_D2D.cs プロジェクト: scjjcs/DirectUI
 public void DrawEllipse(DUIPen pen, float x, float y, float width, float height)
 {
     pen.RenderTarget = this.target;
     if (pen.IsDefaultStyleProperties)
     {
         this.target.RenderTarget.DrawEllipse(DxConvert.ToEllipse(new RectangleF(x, y, width, height)), pen, pen.Width);
     }
     else
     {
         this.target.RenderTarget.DrawEllipse(DxConvert.ToEllipse(new RectangleF(x, y, width, height)), pen, pen.Width, pen);
     }
 }
コード例 #12
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawLines(DUIPen pen, PointF[] points)
 {
     if (points.Length < 2)
     {
         return;
     }
     for (int i = 1; i < points.Length; i++)
     {
         PointF pt1 = points[i - 1];
         PointF pt2 = points[i];
         this.DrawLine(pen, pt1, pt2);
     }
 }
コード例 #13
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawPolygon(DUIPen pen, PointF[] points)
 {
     if (pen.Width == 0)
     {
         return;
     }
     if (points == null)
     {
         return;
     }
     if (points.Length < 3)
     {
         return;
     }
     this.iDUIGraphics.DrawPolygon(pen, points);
 }
コード例 #14
0
ファイル: DUIGraphics_D2D.cs プロジェクト: scjjcs/DirectUI
        public void DrawPolygon(DUIPen pen, PointF[] points)
        {
            bool closed = true;

            if (points == null)
            {
                return;
            }
            if (points.Length < (closed ? 3 : 2))
            {
                return;
            }
            pen.RenderTarget = this.target;
            if (pen.IsDefaultStyleProperties)
            {
                using (SharpDX.Direct2D1.PathGeometry pathGeometry = new SharpDX.Direct2D1.PathGeometry(this.target.RenderTarget.Factory))
                    using (SharpDX.Direct2D1.GeometrySink geometrySink = pathGeometry.Open())
                    {
                        geometrySink.BeginFigure(DxConvert.ToVector2(points[0]), SharpDX.Direct2D1.FigureBegin.Filled);
                        for (int i = 1; i < points.Length; i++)
                        {
                            geometrySink.AddLine(DxConvert.ToVector2(points[i]));
                        }
                        geometrySink.EndFigure(closed ? SharpDX.Direct2D1.FigureEnd.Closed : SharpDX.Direct2D1.FigureEnd.Open);
                        geometrySink.Close();
                        this.target.RenderTarget.DrawGeometry(pathGeometry, pen, pen.Width);
                    }
            }
            else
            {
                using (SharpDX.Direct2D1.PathGeometry pathGeometry = new SharpDX.Direct2D1.PathGeometry(this.target.RenderTarget.Factory))
                    using (SharpDX.Direct2D1.GeometrySink geometrySink = pathGeometry.Open())
                    {
                        geometrySink.BeginFigure(DxConvert.ToVector2(points[0]), SharpDX.Direct2D1.FigureBegin.Filled);
                        for (int i = 1; i < points.Length; i++)
                        {
                            geometrySink.AddLine(DxConvert.ToVector2(points[i]));
                        }
                        geometrySink.EndFigure(closed ? SharpDX.Direct2D1.FigureEnd.Closed : SharpDX.Direct2D1.FigureEnd.Open);
                        geometrySink.Close();
                        this.target.RenderTarget.DrawGeometry(pathGeometry, pen, pen.Width, pen);
                    }
            }
        }
コード例 #15
0
ファイル: DUIGraphics_GDIP.cs プロジェクト: scjjcs/DirectUI
 public void DrawBezier(DUIPen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
 {
     this.graphics.DrawBezier(pen, x1, y1, x2, y2, x3, y3, x4, y4);
 }
コード例 #16
0
ファイル: DUIGraphics_GDIP.cs プロジェクト: scjjcs/DirectUI
 public void DrawLine(DUIPen pen, float x1, float y1, float x2, float y2)
 {
     this.graphics.DrawLine(pen, x1, y1, x2, y2);
 }
コード例 #17
0
ファイル: DUIGraphics_GDIP.cs プロジェクト: scjjcs/DirectUI
 public void DrawPolygon(DUIPen pen, PointF[] points)
 {
     this.graphics.DrawPolygon(pen, points);
 }
コード例 #18
0
ファイル: DUIGraphics_GDIP.cs プロジェクト: scjjcs/DirectUI
 public void DrawEllipse(DUIPen pen, float x, float y, float width, float height)
 {
     this.graphics.DrawEllipse(pen, x, y, width, height);
 }
コード例 #19
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawRoundedRectangle(DUIPen pen, RectangleF rect, float radius)
 {
     this.DrawRoundedRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height, radius);
 }
コード例 #20
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawEllipse(DUIPen pen, int x, int y, int width, int height)
 {
     this.DrawEllipse(pen, (float)x, (float)y, (float)width, (float)height);
 }
コード例 #21
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawBezier(DUIPen pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
 {
     this.DrawBezier(pen, (float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3, (float)x4, (float)y4);
 }
コード例 #22
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawEllipse(DUIPen pen, RectangleF rect)
 {
     this.DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
 }
コード例 #23
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawLine(DUIPen pen, int x1, int y1, int x2, int y2)
 {
     this.DrawLine(pen, (float)x1, (float)y1, (float)x2, (float)y2);
 }
コード例 #24
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawLines(DUIPen pen, Point[] points)
 {
     this.DrawLines(pen, points.Select(p => new PointF(p.X, p.Y)).ToArray());
 }
コード例 #25
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawBezier(DUIPen pen, PointF p1, PointF p2, PointF p3, PointF p4)
 {
     this.DrawBezier(pen, p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y, p4.X, p4.Y);
 }
コード例 #26
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawPolygon(DUIPen pen, Point[] points)
 {
     this.DrawPolygon(pen, points.Select(p => (PointF)p).ToArray());
 }
コード例 #27
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawLine(DUIPen pen, PointF pt1, PointF pt2)
 {
     this.DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y);
 }
コード例 #28
0
ファイル: DUIGraphics.cs プロジェクト: scjjcs/DirectUI
 public void DrawRoundedRectangle(DUIPen pen, int x, int y, int width, int height, float radius)
 {
     this.DrawRoundedRectangle(pen, (float)x, (float)y, (float)width, (float)height, radius);
 }