Ejemplo n.º 1
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)));
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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));
     }
 }
Ejemplo n.º 4
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));
     }
 }
Ejemplo n.º 5
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);
     }
 }
Ejemplo n.º 6
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));
     }
 }
Ejemplo n.º 7
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));
     }
 }
Ejemplo n.º 8
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);
     }
 }