Exemple #1
0
        public void DrawBeziers(PenX pen, Point[] points)
        {
            lock (this)
            {
                int length = points.Length;
                if (length < 4)
                {
                    return;
                }

                graphics.Pen = PenX.ToPenFP(pen);
                GraphicsPathFP path = new GraphicsPathFP();
                path.AddMoveTo(new PointFP(SingleFP.FromInt(points[0].X), SingleFP.FromInt(points[0].Y)));
                for (int i = 1; i <= length - 3; i += 3)
                {
                    Point p1 = points[i];
                    Point p2 = points[i + 1];
                    Point p3 = points[i + 2];
                    path.AddCurveTo(
                        new PointFP(SingleFP.FromInt(p1.X), SingleFP.FromInt(p1.Y)),
                        new PointFP(SingleFP.FromInt(p2.X), SingleFP.FromInt(p2.Y)),
                        new PointFP(SingleFP.FromInt(p3.X), SingleFP.FromInt(p3.Y)));
                }
                graphics.Matrix = matrix == null ? null : matrix.matrix;
                graphics.DrawPath(path);
            }
        }
Exemple #2
0
        public void DrawPie(PenX pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
        {
            lock (this)
            {
                double a1 = startAngle * Math.PI / 180;
                double a2 = (startAngle + sweepAngle) * Math.PI / 180;

                graphics.Pen = PenX.ToPenFP(pen);
                bool  positive = sweepAngle >= 0;
                float endAngle = startAngle + sweepAngle;
                startAngle = (float)TransformAngle(startAngle, width, height);
                sweepAngle = (float)TransformAngle(endAngle, width, height) - startAngle;
                if (positive && sweepAngle < 0)
                {
                    sweepAngle += 360;
                }
                else if (!positive && sweepAngle >= 0)
                {
                    sweepAngle -= 360;
                }

                graphics.Matrix = matrix == null ? null : matrix.matrix;
                graphics.DrawPie(
                    SingleFP.FromFloat(x),
                    SingleFP.FromFloat(y),
                    SingleFP.FromFloat(x + width),
                    SingleFP.FromFloat(y + height),
                    MathFP.ToRadians(SingleFP.FromFloat(startAngle)),
                    MathFP.ToRadians(SingleFP.FromFloat(sweepAngle)));
            }
        }
Exemple #3
0
 public void DrawBezier(PenX pen, Point pt1, Point pt2, Point pt3, Point pt4)
 {
     DrawBezier(pen,
                (float)pt1.X, (float)pt1.Y,
                (float)pt2.X, (float)pt2.Y,
                (float)pt3.X, (float)pt3.Y,
                (float)pt4.X, (float)pt4.Y);
 }
Exemple #4
0
 public void DrawPolygon(PenX pen, Point[] points)
 {
     lock (this)
     {
         graphics.Pen    = PenX.ToPenFP(pen);
         graphics.Matrix = matrix == null ? null : matrix.matrix;
         graphics.DrawPolygon(Utils.ToPointFPArray(points));
     }
 }
Exemple #5
0
 public void DrawCurve(PenX pen, Point[] points, int offset, int numberOfSegments, float tension)
 {
     lock (this)
     {
         graphics.Pen    = PenX.ToPenFP(pen);
         graphics.Matrix = matrix == null ? null : matrix.matrix;
         graphics.DrawCurves(Utils.ToPointFPArray(points), offset, numberOfSegments, SingleFP.FromFloat(tension));
     }
 }
Exemple #6
0
 public void DrawClosedCurve(PenX pen, Point[] points)
 {
     lock (this)
     {
         graphics.Pen    = PenX.ToPenFP(pen);
         graphics.Matrix = matrix == null ? null : matrix.matrix;
         graphics.DrawClosedCurves(Utils.ToPointFPArray(points), 0, points.Length - 1, SingleFP.One * 7 / 10);
     }
 }
Exemple #7
0
 public void DrawRectangle(PenX pen, float x, float y, float width, float height)
 {
     lock (this)
     {
         graphics.Pen    = PenX.ToPenFP(pen);
         graphics.Matrix = matrix == null ? null : matrix.matrix;
         graphics.DrawRect(
             SingleFP.FromFloat(x),
             SingleFP.FromFloat(y),
             SingleFP.FromFloat(x + width),
             SingleFP.FromFloat(y + height));
     }
 }
Exemple #8
0
 public void DrawLine(PenX pen, float x1, float y1, float x2, float y2)
 {
     lock (this)
     {
         graphics.Pen    = PenX.ToPenFP(pen);
         graphics.Matrix = matrix == null ? null : matrix.matrix;
         graphics.DrawLine(
             SingleFP.FromFloat(x1),
             SingleFP.FromFloat(y1),
             SingleFP.FromFloat(x2),
             SingleFP.FromFloat(y2));
     }
 }
Exemple #9
0
 public void DrawBezier(PenX pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
 {
     lock (this)
     {
         graphics.Pen = PenX.ToPenFP(pen);
         GraphicsPathFP path = new GraphicsPathFP();
         path.AddMoveTo(new PointFP(SingleFP.FromFloat(x1), SingleFP.FromFloat(y1)));
         path.AddCurveTo(
             new PointFP(SingleFP.FromFloat(x2), SingleFP.FromFloat(y2)),
             new PointFP(SingleFP.FromFloat(x3), SingleFP.FromFloat(y3)),
             new PointFP(SingleFP.FromFloat(x4), SingleFP.FromFloat(y4)));
         graphics.Matrix = matrix == null ? null : matrix.matrix;
         graphics.DrawPath(path);
     }
 }
Exemple #10
0
 public void DrawRectangle(PenX pen, Rectangle rect)
 {
     DrawRectangle(pen, rect.Left, rect.Top, rect.Width, rect.Height);
 }
Exemple #11
0
 public void DrawArc(PenX pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
 {
     DrawArc(pen, (float)x, (float)y, (float)width, (float)height, (float)startAngle, (float)sweepAngle);
 }
Exemple #12
0
 public void DrawEllipse(PenX pen, int x, int y, int width, int height)
 {
     DrawEllipse(pen, (float)x, (float)y, (float)width, (float)height);
 }
Exemple #13
0
 public void DrawEllipse(PenX pen, RectangleF rect)
 {
     DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
 }
Exemple #14
0
 public void DrawCurve(PenX pen, Point[] points, float tension)
 {
     DrawCurve(pen, points, 0, points.Length, tension);
 }
Exemple #15
0
 public void DrawCurve(PenX pen, Point[] points)
 {
     DrawCurve(pen, points, 1.0f);
 }
Exemple #16
0
 public void DrawRectangle(PenX pen, int x, int y, int width, int height)
 {
     DrawRectangle(pen, (float)x, (float)y, (float)width, (float)height);
 }
Exemple #17
0
 public void DrawArc(PenX pen, RectangleF rect, float startAngle, float sweepAngle)
 {
     DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
 }
Exemple #18
0
 public void DrawLine(PenX pen, Point pt1, Point pt2)
 {
     DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y);
 }
Exemple #19
0
 public static PenFP ToPenFP(PenX pen)
 {
     return(pen.pen);
 }
Exemple #20
0
 public void DrawLine(PenX pen, int x1, int y1, int x2, int y2)
 {
     DrawLine(pen, (float)x1, (float)y1, (float)x2, (float)y2);
 }