Exemplo n.º 1
0
        public override void Draw(ICanvas canvas)
        {
            canvas.SaveState();

            canvas.StrokeColor = Colors.Black;
            canvas.StrokeSize  = 10;
            canvas.Translate(0, -350);

            //
            // StrokeLocation.CENTER
            //
            canvas.StrokeSize = 10;
            canvas.DrawRectangle(50, 400, 100, 50);
            canvas.DrawEllipse(200, 400, 100, 50);
            canvas.DrawRoundedRectangle(350, 400, 100, 50, 25);

            var path = new PathF();

            path.MoveTo(550, 400);
            path.LineTo(500, 450);
            path.LineTo(600, 450);
            path.Close();
            canvas.DrawPath(path);

            canvas.RestoreState();
        }
        public override void Draw(ICanvas canvas)
        {
            canvas.SaveState();

            canvas.SetShadow(
                CanvasDefaults.DefaultShadowOffset,
                CanvasDefaults.DefaultShadowBlur,
                CanvasDefaults.DefaultShadowColor);

            canvas.FillColor = Colors.Blue;
            var path = new PathF(10, 10);

            path.LineTo(30, 10);
            path.LineTo(20, 30);
            path.Close();
            canvas.FillPath(path);

            canvas.FillColor = Colors.Salmon;
            canvas.FillRectangle(100, 100, 100, 100);

            canvas.FillColor = Colors.Beige;
            canvas.FillOval(100, 300, 100, 50);

            canvas.RestoreState();
        }
Exemplo n.º 3
0
        private void SKElement_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs e)
        {
            ICanvas canvas = new SkiaCanvas()
            {
                Canvas = e.Surface.Canvas
            };

            //canvas.FillColor = Colors.Transparent;
            //canvas.FillColor = Colors.White.WithAlpha(0.9f);
            //canvas.FillRectangle(0, 0, (float)DrawSurface.ActualWidth, (float)DrawSurface.ActualHeight);


            //canvas.StrokeColor = Colors.Red.WithAlpha(.5f);
            canvas.StrokeColor = Colors.Red;
            canvas.StrokeSize  = 2;
            var path = new PathF();

            if (_points.Count > 0)
            {
                path.MoveTo(_points[0].X, _points[0].Y);
                for (int i = 1; i < _points.Count; i++)
                {
                    path.LineTo(_points[i].X, _points[i].Y);
                }
                //path.Close();
                canvas.DrawPath(path);
            }
        }
Exemplo n.º 4
0
        private static void DrawStrokes(ICanvas canvas)
        {
            //
            // DrawXXXX Methods
            //
            canvas.DrawLine(0, 0, 100, 100);
            canvas.Translate(100, 0);
            canvas.DrawRectangle(0, 0, 100, 100);
            canvas.Translate(100, 0);
            canvas.DrawEllipse(0, 0, 100, 100);
            canvas.Translate(100, 0);
            canvas.DrawRoundedRectangle(0, 0, 100, 100, 25);

            var vPath = new PathF();

            vPath.MoveTo(0, 0);
            vPath.LineTo(0, 100);
            vPath.QuadTo(100, 100, 100, 0);
            vPath.CurveTo(50, 0, 100, 50, 50, 50);
            canvas.Translate(100, 0);
            canvas.DrawPath(vPath);

            canvas.Translate(100, 0);
            canvas.DrawRectangle(0, 0, 100, 50);
            canvas.Translate(100, 0);
            canvas.DrawEllipse(0, 0, 100, 50);
            canvas.Translate(100, 0);
            canvas.DrawRoundedRectangle(0, 0, 100, 50, 25);
            canvas.Translate(100, 0);
            canvas.DrawRoundedRectangle(0, 0, 100, 25, 25);
        }
Exemplo n.º 5
0
 void AddPolyLine(PathF path, PolyLineSegment polyLineSegment)
 {
     foreach (var p in polyLineSegment.Points)
     {
         path.LineTo((float)p.X, (float)p.Y);
     }
 }
Exemplo n.º 6
0
        public override void Draw(ICanvas canvas)
        {
            canvas.SaveState();

            canvas.StrokeColor = Colors.Black;
            canvas.StrokeSize  = 10;
            canvas.Translate(-300, -60);

            var path = new PathF();

            path.MoveTo(350, 120);
            path.LineTo(370, 180);
            path.LineTo(390, 120);
            canvas.DrawPath(path);

            canvas.StrokeLineJoin = LineJoin.Miter;
            path = new PathF();
            path.MoveTo(400, 120);
            path.LineTo(420, 180);
            path.LineTo(440, 120);
            canvas.DrawPath(path);

            canvas.StrokeLineJoin = LineJoin.Round;
            path = new PathF();
            path.MoveTo(450, 120);
            path.LineTo(470, 180);
            path.LineTo(490, 120);
            canvas.DrawPath(path);

            canvas.StrokeLineJoin = LineJoin.Bevel;
            path = new PathF();
            path.MoveTo(500, 120);
            path.LineTo(520, 180);
            path.LineTo(540, 120);
            canvas.DrawPath(path);

            canvas.StrokeLineJoin = LineJoin.Miter;
            canvas.MiterLimit     = 2;
            path = new PathF();
            path.MoveTo(550, 120);
            path.LineTo(570, 180);
            path.LineTo(590, 120);
            canvas.DrawPath(path);

            canvas.RestoreState();
        }
Exemplo n.º 7
0
        public PathF PathForBounds(Rectangle rect)
        {
            var path = new PathF();

            path.MoveTo((float)X1, (float)Y1);
            path.LineTo((float)X2, (float)Y2);

            return(path.AsScaledPath((float)Width / (float)rect.Width));
        }
Exemplo n.º 8
0
 void AddPolyLine(PathF path, PolyLineSegment polyLineSegment, double density)
 {
     foreach (var p in polyLineSegment.Points)
     {
         path.LineTo(
             (float)(density * p.X),
             (float)(density * p.Y));
     }
 }
Exemplo n.º 9
0
        public override PathF GetPath()
        {
            var path = new PathF();

            path.MoveTo((float)X1, (float)Y1);
            path.LineTo((float)X2, (float)Y2);

            return(path);
        }
Exemplo n.º 10
0
        private void DrawLineSegment(ICanvas canvas)
        {
            canvas.StrokeColor = Colors.LightGrey;
            canvas.DrawRectangle(50.5f, 50.5f, 50, 50);
            var path = new PathF(50.5f, 50.5f);

            path.LineTo(100.5f, 100.5f);
            canvas.StrokeColor = Colors.Black;
            canvas.DrawPath(path);
        }
Exemplo n.º 11
0
        void DrawArrowhead(ICanvas canvas, RectF dirtyRect)
        {
            if (View.PullDistance < 0.3)
            {
                return;
            }

            float arrowheadScale = Math.Min(1f, View.PullDistance * 1.2f);

            canvas.SaveState();

            // translate center
            canvas.Translate(dirtyRect.Width / 2f, dirtyRect.Height / 2f);

            var startArc = 45 - 80 * Math.Min(1, View.PullDistance * 2f);

            var sweepArc = -startArc + View.PullDistance * 300;

            var radius = ArcSize / 2f;
            var arc    = (float)((sweepArc) * Math.PI / 180f);
            var ux     = (float)Math.Cos(arc);
            var uy     = (float)Math.Sin(arc);


            float arrowheadRadius = StrokeWidth * 2.0f * arrowheadScale;
            float innerRadius     = radius - arrowheadRadius;
            float outerRadius     = radius + arrowheadRadius;

            float arrowheadPointX = ux * radius + -uy * StrokeWidth * 1.5f * arrowheadScale;
            float arrowheadPointY = uy * radius + ux * StrokeWidth * 1.5f * arrowheadScale;

            canvas.FillColor = ForegroundColor;

            using PathF path = new PathF();
            path.MoveTo(ux * innerRadius, uy * innerRadius);
            path.LineTo(ux * outerRadius, uy * outerRadius);
            path.LineTo(arrowheadPointX, arrowheadPointY);
            path.Close();
            canvas.FillPath(path);

            canvas.RestoreState();
        }
Exemplo n.º 12
0
        /// <include file="../../../docs/Microsoft.Maui.Controls.Shapes/LineGeometry.xml" path="//Member[@MemberName='AppendPath']/Docs" />
        public override void AppendPath(PathF path)
        {
            float startPointX = (float)StartPoint.X;
            float startPointY = (float)StartPoint.Y;

            float endPointX = (float)EndPoint.X;
            float endPointY = (float)EndPoint.Y;

            path.Move(startPointX, startPointY);
            path.LineTo(endPointX, endPointY);
        }
Exemplo n.º 13
0
        private void FillPie(ICanvas canvas)
        {
            canvas.StrokeColor = Colors.LightGrey;
            canvas.DrawRectangle(350.5f, 150.5f, 50, 50);
            var path = new PathF();

            path.AddArc(350.5f, 150.5f, 400.5f, 200.5f, 45f, 135, false);
            path.LineTo(375.5f, 200.5f);
            path.Close();
            canvas.FillColor = Colors.Black;
            canvas.FillPath(path);
        }
Exemplo n.º 14
0
        private static void DrawFills(ICanvas canvas)
        {
            canvas.FillColor = Colors.Red;
            canvas.FillRectangle(10, 10, 80, 80);

            canvas.FillColor = Colors.Green;
            canvas.Translate(100, 0);
            canvas.FillEllipse(10, 10, 80, 80);

            canvas.FillColor = Colors.Blue;
            canvas.Translate(100, 0);
            canvas.FillRoundedRectangle(10, 10, 80, 80, 10);

            canvas.FillColor = Colors.CornflowerBlue;
            var path = new PathF();

            path.MoveTo(10, 10);
            path.LineTo(50, 90);
            path.LineTo(90, 10);
            path.Close();
            canvas.Translate(100, 0);
            canvas.FillPath(path);
        }
Exemplo n.º 15
0
        public PathF PathForBounds(Rect rect)
        {
            var path = new PathF();

            if (Points?.Count > 0)
            {
                path.MoveTo((float)Points[0].X, (float)Points[0].Y);

                for (int index = 1; index < Points.Count; index++)
                {
                    path.LineTo((float)Points[index].X, (float)Points[index].Y);
                }
            }

            return(path.AsScaledPath((float)Width / (float)rect.Width));
        }
Exemplo n.º 16
0
        public override PathF GetPath()
        {
            var path = new PathF();

            if (Points?.Count > 0)
            {
                path.MoveTo((float)Points[0].X, (float)Points[0].Y);

                for (int index = 1; index < Points.Count; index++)
                {
                    path.LineTo((float)Points[index].X, (float)Points[index].Y);
                }
            }

            return(path);
        }
Exemplo n.º 17
0
        /// <include file="../../../docs/Microsoft.Maui.Controls.Shapes/LineGeometry.xml" path="//Member[@MemberName='AppendPath']/Docs" />
        public override void AppendPath(PathF path)
        {
            double density = 1.0d;

#if ANDROID
            density = DeviceDisplay.MainDisplayInfo.Density;
#endif

            float startPointX = (float)(density * StartPoint.X);
            float startPointY = (float)(density * StartPoint.Y);

            float endPointX = (float)(density * EndPoint.X);
            float endPointY = (float)(density * EndPoint.Y);

            path.Move(startPointX, startPointY);
            path.LineTo(endPointX, endPointY);
        }
Exemplo n.º 18
0
        void AddArc(PathF path, ArcSegment arcSegment)
        {
            List <Point> points = new List <Point>();

            GeometryHelper.FlattenArc(
                points,
                path.LastPoint,
                arcSegment.Point,
                arcSegment.Size.Width,
                arcSegment.Size.Height,
                arcSegment.RotationAngle,
                arcSegment.IsLargeArc,
                arcSegment.SweepDirection == SweepDirection.CounterClockwise,
                1);

            for (int i = 0; i < points.Count; i++)
            {
                path.LineTo(
                    (float)points[i].X,
                    (float)points[i].Y);
            }
        }
Exemplo n.º 19
0
        private void SKElement_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs e)
        {
            ICanvas canvas = new SkiaCanvas()
            {
                Canvas = e.Surface.Canvas
            };

            canvas.StrokeColor = Colors.Red;
            canvas.StrokeSize  = 2;
            //draw many points
            var path = new PathF();

            if (_points.Count > 0)
            {
                path.MoveTo(_points[0].X, _points[0].Y);
                for (int i = 1; i < _points.Count; i++)
                {
                    path.LineTo(_points[i].X, _points[i].Y);
                }
                canvas.DrawPath(path);
            }
        }
Exemplo n.º 20
0
 public void ApplyCGPathFunction(CGPathElement element)
 {
     if (element.Type == CGPathElementType.MoveToPoint)
     {
         _path.MoveTo(element.Point1.AsPointF());
     }
     else if (element.Type == CGPathElementType.AddLineToPoint)
     {
         _path.LineTo(element.Point1.AsPointF());
     }
     else if (element.Type == CGPathElementType.AddQuadCurveToPoint)
     {
         _path.QuadTo(element.Point1.AsPointF(), element.Point2.AsPointF());
     }
     else if (element.Type == CGPathElementType.AddCurveToPoint)
     {
         _path.CurveTo(element.Point1.AsPointF(), element.Point2.AsPointF(), element.Point3.AsPointF());
     }
     else if (element.Type == CGPathElementType.CloseSubpath)
     {
         _path.Close();
     }
 }
Exemplo n.º 21
0
 void AddLine(PathF path, LineSegment lineSegment)
 {
     path.LineTo(
         (float)(lineSegment.Point.X),
         (float)(lineSegment.Point.Y));
 }
Exemplo n.º 22
0
 void AddLine(PathF path, LineSegment lineSegment, double density)
 {
     path.LineTo(
         (float)(density * lineSegment.Point.X),
         (float)(density * lineSegment.Point.Y));
 }
Exemplo n.º 23
0
 public override void AppendPath(PathF path)
 {
     path.Move((float)StartPoint.X, (float)StartPoint.Y);
     path.LineTo((float)EndPoint.X, (float)EndPoint.Y);
 }
Exemplo n.º 24
0
        public override void Draw(ICanvas canvas)
        {
            canvas.SaveState();

            //
            // DrawXXXX Methods
            //
            canvas.StrokeColor = Colors.Grey;
            canvas.DrawLine(0, 0, 100, 100);
            canvas.DrawRectangle(100, 0, 100, 100);
            canvas.DrawEllipse(200, 0, 100, 100);
            canvas.DrawRoundedRectangle(300, 0, 100, 100, 25);

            var path = new PathF();

            path.MoveTo(400, 0);
            path.LineTo(400, 100);
            path.QuadTo(500, 100, 500, 0);
            path.CurveTo(450, 0, 500, 50, 450, 50);
            canvas.DrawPath(path);

            canvas.DrawRectangle(500, 0, 100, 50);
            canvas.DrawEllipse(600, 0, 100, 50);
            canvas.DrawRoundedRectangle(700, 0, 100, 50, 25);
            canvas.DrawRoundedRectangle(800, 0, 100, 25, 25);

            //
            // FillXXXX Methods
            //

            canvas.FillColor = Colors.Red;
            canvas.FillRectangle(210, 210, 80, 80);

            canvas.FillColor = Colors.Green;
            canvas.FillEllipse(310, 210, 80, 80);

            canvas.FillColor = Colors.Blue;
            canvas.FillRoundedRectangle(410, 210, 80, 80, 10);

            canvas.FillColor = Colors.CornflowerBlue;
            path             = new PathF();
            path.MoveTo(510, 210);
            path.LineTo(550, 290);
            path.LineTo(590, 210);
            path.Close();
            canvas.FillPath(path);

            canvas.FillColor = Colors.White;

            //
            //StrokeLocation.CENTER
            //
            canvas.StrokeSize = 10;
            canvas.DrawRectangle(50, 400, 100, 50);
            canvas.DrawEllipse(200, 400, 100, 50);
            canvas.DrawRoundedRectangle(350, 400, 100, 50, 25);

            path = new PathF();
            path.MoveTo(550, 400);
            path.LineTo(500, 450);
            path.LineTo(600, 450);
            path.Close();
            canvas.DrawPath(path);

            //
            // Stroke Color and Line Caps
            //

            canvas.StrokeColor = Colors.CornflowerBlue;
            canvas.DrawLine(100, 120, 300, 120);

            canvas.StrokeColor   = Colors.Red;
            canvas.StrokeLineCap = LineCap.Butt;
            canvas.DrawLine(100, 140, 300, 140);

            canvas.StrokeColor   = Colors.Green;
            canvas.StrokeLineCap = LineCap.Round;
            canvas.DrawLine(100, 160, 300, 160);

            canvas.StrokeColor   = Colors.Blue;
            canvas.StrokeLineCap = LineCap.Square;
            canvas.DrawLine(100, 180, 300, 180);

            canvas.StrokeLineCap = LineCap.Butt;

            //
            // Line Joins
            //

            canvas.StrokeColor = Colors.Black;

            path = new PathF();
            path.MoveTo(350, 120);
            path.LineTo(370, 180);
            path.LineTo(390, 120);
            canvas.DrawPath(path);

            canvas.StrokeLineJoin = LineJoin.Miter;
            path = new PathF();
            path.MoveTo(400, 120);
            path.LineTo(420, 180);
            path.LineTo(440, 120);
            canvas.DrawPath(path);

            canvas.StrokeLineJoin = LineJoin.Round;
            path = new PathF();
            path.MoveTo(450, 120);
            path.LineTo(470, 180);
            path.LineTo(490, 120);
            canvas.DrawPath(path);

            canvas.StrokeLineJoin = LineJoin.Bevel;
            path = new PathF();
            path.MoveTo(500, 120);
            path.LineTo(520, 180);
            path.LineTo(540, 120);
            canvas.DrawPath(path);

            canvas.StrokeLineJoin = LineJoin.Miter;
            canvas.MiterLimit     = 2;
            path = new PathF();
            path.MoveTo(550, 120);
            path.LineTo(570, 180);
            path.LineTo(590, 120);
            canvas.DrawPath(path);

            canvas.MiterLimit = CanvasDefaults.DefaultMiterLimit;

            //
            // Stroke Dash Pattern
            //
            canvas.StrokeSize        = 1;
            canvas.StrokeDashPattern = DOTTED;
            canvas.DrawLine(650, 120, 800, 120);

            canvas.StrokeSize        = 3;
            canvas.StrokeDashPattern = DOTTED;
            canvas.DrawLine(650, 140, 800, 140);

            canvas.StrokeDashPattern = DASHED_DOT;
            canvas.DrawLine(650, 160, 800, 160);

            canvas.StrokeDashPattern = SOLID;
            canvas.DrawLine(650, 180, 800, 180);

            canvas.StrokeLineCap = LineCap.Butt;

            //
            // Linear Gradient Fill
            //

            //var vPaint = new Paint
            //{
            //    PaintType = PaintType.LinearGradient,
            //    StartColor = Colors.White,
            //    EndColor = Colors.Black
            //};

            //canvas.SetFillPaint(vPaint, 50, 700, 150, 750);
            //canvas.FillRectangle(50, 700, 100, 50);

            //canvas.SetFillPaint(vPaint, 200, 700, 300, 700);
            //canvas.FillEllipse(200, 700, 100, 50);

            //vPaint.AddOffset(.5f, Colors.IndianRed);
            //canvas.SetFillPaint(vPaint, 350, 700, 450, 700);
            //canvas.FillRoundedRectangle(350, 700, 100, 50, 25);

            //path = new PathF();
            //path.MoveTo(550, 700);
            //path.LineTo(500, 750);
            //path.LineTo(600, 750);
            //path.Close();

            //canvas.SetFillPaint(vPaint, 500, 700, 600, 700);
            //canvas.FillPath(path);

            //
            // Radial Gradient Fill
            //

            //vPaint = new Paint
            //{
            //    PaintType = PaintType.RadialGradient,
            //    StartColor = Colors.White,
            //    EndColor = Colors.Black
            //};

            //canvas.SetFillPaint(vPaint, 100, 825, 150, 850);
            //canvas.FillRectangle(50, 800, 100, 50);

            //canvas.SetFillPaint(vPaint, 250, 825, 300, 800);
            //canvas.FillEllipse(200, 800, 100, 50);

            //vPaint.AddOffset(.5f, Colors.IndianRed);
            //canvas.SetFillPaint(vPaint, 400, 825, 450, 800);
            //canvas.FillRoundedRectangle(350, 800, 100, 50, 25);

            //path = new PathF();
            //path.MoveTo(550, 800);
            //path.LineTo(500, 850);
            //path.LineTo(600, 850);
            //path.Close();

            //canvas.SetFillPaint(vPaint, 550, 825, 600, 800);
            //canvas.FillPath(path);

            //
            // Solid Fill With Shadow
            //

            canvas.SaveState();
            canvas.FillColor = Colors.CornflowerBlue;
            //canvas.SetShadow(new SizeF(5, 5), 0, Colors.Grey);
            canvas.FillRectangle(50, 900, 100, 50);

            //canvas.SetShadow(new SizeF(5, 5), 2, Colors.Red);
            canvas.FillEllipse(200, 900, 100, 50);

            //canvas.SetShadow(new SizeF(5, 5), 5, Colors.Green);
            canvas.FillRoundedRectangle(350, 900, 100, 50, 25);

            //canvas.SetShadow(new SizeF(10, 10), 5, Colors.Blue);

            path = new PathF();
            path.MoveTo(550, 900);
            path.LineTo(500, 950);
            path.LineTo(600, 950);
            path.Close();

            canvas.FillPath(path);

            //
            // Draw With Shadow
            //

            canvas.StrokeColor = Colors.Black;
            //canvas.SetShadow(new SizeF(5, 5), 0, Colors.Grey);
            canvas.DrawRectangle(50, 1000, 100, 50);

            //canvas.SetShadow(new SizeF(5, 5), 2, Colors.Red);
            canvas.DrawEllipse(200, 1000, 100, 50);

            //canvas.SetShadow(new SizeF(5, 5), 5, Colors.Green);
            canvas.DrawRoundedRectangle(350, 1000, 100, 50, 25);

            //canvas.SetShadow(new SizeF(10, 10), 5, Colors.Blue);
            path = new PathF();
            path.MoveTo(550, 1000);
            path.LineTo(500, 1050);
            path.LineTo(600, 1050);
            path.Close();

            canvas.DrawPath(path);

            canvas.RestoreState();

            //
            // Solid Fill Without Shadow
            //

            canvas.FillColor = Colors.DarkOliveGreen;
            canvas.FillRectangle(50, 1100, 100, 50);
            canvas.FillEllipse(200, 1100, 100, 50);
            canvas.FillRoundedRectangle(350, 1100, 100, 50, 25);

            path = new PathF();
            path.MoveTo(550, 1100);
            path.LineTo(500, 1150);
            path.LineTo(600, 1150);
            path.Close();

            canvas.FillPath(path);

            //
            // FILL WITH SHADOW USING ALPHA
            //

            canvas.SaveState();

            canvas.Alpha     = .25f;
            canvas.FillColor = Colors.CornflowerBlue;
            //canvas.SetShadow(new SizeF(5, 5), 0, Colors.Grey);
            canvas.FillRectangle(50, 1200, 100, 50);

            canvas.Alpha = .5f;
            //canvas.SetShadow(new SizeF(5, 5), 2, Colors.Red);
            canvas.FillEllipse(200, 1200, 100, 50);

            canvas.Alpha = .75f;
            //canvas.SetShadow(new SizeF(5, 5), 5, Colors.Green);
            canvas.FillRoundedRectangle(350, 1200, 100, 50, 25);

            canvas.Alpha = 1;
            //canvas.SetShadow(new SizeF(10, 10), 5, Colors.Blue);

            path = new PathF();
            path.MoveTo(550, 1200);
            path.LineTo(500, 1250);
            path.LineTo(600, 1250);
            path.Close();

            canvas.FillPath(path);
            canvas.RestoreState();

            //
            // Test Scaling
            //

            canvas.StrokeSize  = 1;
            canvas.StrokeColor = Colors.Black;
            canvas.DrawLine(10, 0, 0, 10);

            canvas.SaveState();

            canvas.Scale(2, 2);
            canvas.DrawLine(10, 0, 0, 10);

            canvas.Scale(2, 2);
            canvas.DrawLine(10, 0, 0, 10);

            canvas.RestoreState();

            //
            // Test simple rotation relative to 0,0
            //

            canvas.SaveState();
            //canvas.SetShadow(new SizeF(2, 0), 2, Colors.Black);
            canvas.StrokeColor = Colors.CornflowerBlue;
            canvas.Rotate(15);
            canvas.DrawEllipse(60, 60, 10, 10);
            canvas.Rotate(15);
            canvas.DrawEllipse(60, 60, 10, 10);
            canvas.Rotate(15);
            canvas.DrawEllipse(60, 60, 10, 10);
            canvas.StrokeColor = Colors.DarkSeaGreen;
            canvas.Rotate(-60);
            canvas.DrawEllipse(60, 60, 10, 10);
            canvas.Rotate(-15);
            canvas.DrawEllipse(60, 60, 10, 10);
            canvas.RestoreState();

            canvas.DrawRectangle(60, 60, 10, 10);

            //
            // Test rotation relative to a point
            //

            canvas.DrawRectangle(25, 125, 50, 50);

            canvas.SaveState();
            canvas.Rotate(5, 50, 150);
            canvas.DrawRectangle(25, 125, 50, 50);
            canvas.RestoreState();

            canvas.SaveState();
            canvas.Rotate(-5, 50, 150);
            canvas.DrawRectangle(25, 125, 50, 50);
            canvas.RestoreState();

            //
            // Test text
            //

            canvas.StrokeSize  = 1;
            canvas.StrokeColor = Colors.Blue;

            const string vTextLong =
                "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
            const string vTextShort = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ";

            for (int x = 0; x < 4; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    float dx = 1000 + x * 200;
                    float dy = 0 + y * 150;

                    canvas.DrawRectangle(dx, dy, 190, 140);

                    var vHorizontalAlignment = (HorizontalAlignment)x;
                    var vVerticalAlignment   = (VerticalAlignment)y;

                    canvas.FontName = "Arial";
                    canvas.FontSize = 12f;
                    canvas.DrawString(vTextLong, dx, dy, 190, 140, vHorizontalAlignment, vVerticalAlignment);
                }
            }

            canvas.SaveState();
            //canvas.SetShadow(new SizeF(2, 2), 2, Colors.DarkGrey);

            for (int x = 0; x < 4; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    float dx = 1000 + x * 200;
                    float dy = 450 + y * 150;

                    canvas.DrawRectangle(dx, dy, 190, 140);

                    var vHorizontalAlignment = (HorizontalAlignment)x;
                    var vVerticalAlignment   = (VerticalAlignment)y;

                    canvas.FontName = "Arial";
                    canvas.FontSize = 12f;
                    canvas.DrawString(vTextShort, dx, dy, 190, 140, vHorizontalAlignment, vVerticalAlignment);
                }
            }

            canvas.RestoreState();

            for (int y = 0; y < 3; y++)
            {
                float       dx = 1000 + y * 200;
                const float dy = 1050;

                canvas.DrawRectangle(dx, dy, 190, 140);

                const HorizontalAlignment vHorizontalAlignment = HorizontalAlignment.Left;
                var vVerticalAlignment = (VerticalAlignment)y;

                canvas.FontName = "Arial";
                canvas.FontSize = 12f;
                canvas.DrawString(
                    vTextLong,
                    dx,
                    dy,
                    190,
                    140,
                    vHorizontalAlignment,
                    vVerticalAlignment,
                    TextFlow.OverflowBounds);
            }

            //
            // Test simple drawing string
            //
            canvas.DrawLine(1000, 1300, 1200, 1300);
            canvas.DrawLine(1000, 1325, 1200, 1325);
            canvas.DrawLine(1000, 1350, 1200, 1350);
            canvas.DrawLine(1000, 1375, 1200, 1375);
            canvas.DrawLine(1100, 1300, 1100, 1400);
            canvas.DrawString("This is a test.", 1100, 1300, HorizontalAlignment.Left);
            canvas.DrawString("This is a test.", 1100, 1325, HorizontalAlignment.Center);
            canvas.DrawString("This is a test.", 1100, 1350, HorizontalAlignment.Right);
            canvas.DrawString("This is a test.", 1100, 1375, HorizontalAlignment.Justified);

            //
            // Test inverse clipping area
            //

            canvas.SaveState();
            canvas.DrawRectangle(200, 1300, 200, 50);
            canvas.SubtractFromClip(200, 1300, 200, 50);
            canvas.DrawLine(100, 1325, 500, 1325);
            canvas.DrawLine(300, 1275, 300, 1375);
            canvas.RestoreState();

            var graphicsPlatform = GraphicsPlatform.CurrentService;

            if (graphicsPlatform != null)
            {
                //
                // Test String Measuring
                //

                canvas.StrokeColor = Colors.Blue;
                for (int i = 0; i < 4; i++)
                {
                    canvas.FontSize = 12 + i * 6;
                    canvas.DrawString("Test String Length", 650, 400 + (100 * i), HorizontalAlignment.Left);

                    var size = graphicsPlatform.GetStringSize("Test String Length", "Arial", 12 + i * 6);
                    canvas.DrawRectangle(650, 400 + (100 * i), size.Width, size.Height);
                }

                //
                // Test Path Measuring
                //

                var vBuilder = new PathBuilder();
                path =
                    vBuilder.BuildPath(
                        "M0 52.5 C60 -17.5 60 -17.5 100 52.5 C140 122.5 140 122.5 100 152.5 Q60 182.5 0 152.5 Z");

                canvas.SaveState();
                canvas.Translate(650, 900);
                canvas.StrokeColor = Colors.Black;
                canvas.DrawPath(path);

                canvas.RestoreState();
            }

            canvas.RestoreState();

            GlobalVariables.TotalPasses += 1;
        }