示例#1
0
        // Resizing Behavior
        public static void resizingBehaviorApply(ResizingBehavior behavior, RectF rect, RectF target, RectF result)
        {
            if (rect.Equals(target) || target == null)
            {
                result.Set(rect);
                return;
            }

            if (behavior == ResizingBehavior.Stretch)
            {
                result.Set(target);
                return;
            }

            float xRatio = Math.Abs(target.Width() / rect.Width());
            float yRatio = Math.Abs(target.Height() / rect.Height());
            float scale  = 0f;

            switch (behavior)
            {
            case ResizingBehavior.AspectFit:
            {
                scale = Math.Min(xRatio, yRatio);
                break;
            }

            case ResizingBehavior.AspectFill:
            {
                scale = Math.Max(xRatio, yRatio);
                break;
            }

            case ResizingBehavior.Center:
            {
                scale = 1f;
                break;
            }
            }

            float newWidth  = Math.Abs(rect.Width() * scale);
            float newHeight = Math.Abs(rect.Height() * scale);

            result.Set(target.CenterX() - newWidth / 2,
                       target.CenterY() - newHeight / 2,
                       target.CenterX() + newWidth / 2,
                       target.CenterY() + newHeight / 2);
        }
        public static SKRect ResizingBehaviorApply(ResizingBehavior behavior, SKRect rect, SKRect target)
        {
            if (rect.Equals(target) || target == null)
            {
                return(rect);
            }

            if (behavior == ResizingBehavior.Stretch)
            {
                return(target);
            }

            float xRatio = Math.Abs(target.Width / rect.Width);
            float yRatio = Math.Abs(target.Height / rect.Height);
            float scale  = 0f;

            switch (behavior)
            {
            case ResizingBehavior.AspectFit:
            {
                scale = Math.Min(xRatio, yRatio);
                break;
            }

            case ResizingBehavior.AspectFill:
            {
                scale = Math.Max(xRatio, yRatio);
                break;
            }

            case ResizingBehavior.Center:
            {
                scale = 1f;
                break;
            }
            }

            float newWidth  = Math.Abs(rect.Width * scale);
            float newHeight = Math.Abs(rect.Height * scale);

            return(new SKRect(target.MidX - newWidth / 2,
                              target.MidY - newHeight / 2,
                              target.MidX + newWidth / 2,
                              target.MidY + newHeight / 2));
        }
示例#3
0
        public static void DrawSharpCanvas(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int fillColor, float width, float height)
        {
            // General Declarations
            Paint paint = CacheForSharpCanvas.paint;

            // Resize to Target Frame
            canvas.Save();
            RectF resizedFrame = CacheForSharpCanvas.resizedFrame;

            SharpKit.resizingBehaviorApply(resizing, CacheForSharpCanvas.originalFrame, targetFrame, resizedFrame);
            canvas.Translate(resizedFrame.Left, resizedFrame.Top);
            canvas.Scale(resizedFrame.Width() / 100f, resizedFrame.Height() / 100f);

            // SharpFrame
            RectF sharpFrame = CacheForSharpCanvas.sharpFrame;

            sharpFrame.Set(0f, 0f, width, height);

            // SharpSymbol
            RectF sharpSymbolRect = CacheForSharpCanvas.sharpSymbolRect;

            sharpSymbolRect.Set(0f, 0f, 100f, 100f);
            Path sharpSymbolPath = CacheForSharpCanvas.sharpSymbolPath;

            sharpSymbolPath.Reset();
            sharpSymbolPath.MoveTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.00002f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.08245f, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.2f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width(), sharpFrame.Top + sharpFrame.Height() * 0.2f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width(), sharpFrame.Top + sharpFrame.Height() * 0.4f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.46586f, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.53414f, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.6f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width(), sharpFrame.Top + sharpFrame.Height() * 0.6f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width(), sharpFrame.Top + sharpFrame.Height() * 0.8f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.8f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.91755f, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height(), sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height());
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height());
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height(), sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.91755f, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.8f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.8f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.91755f, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height(), sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height());
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height());
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height(), sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.91755f, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.8f);
            sharpSymbolPath.LineTo(sharpFrame.Left, sharpFrame.Top + sharpFrame.Height() * 0.8f);
            sharpSymbolPath.LineTo(sharpFrame.Left, sharpFrame.Top + sharpFrame.Height() * 0.6f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.6f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.53414f, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.46586f, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
            sharpSymbolPath.LineTo(sharpFrame.Left, sharpFrame.Top + sharpFrame.Height() * 0.4f);
            sharpSymbolPath.LineTo(sharpFrame.Left, sharpFrame.Top + sharpFrame.Height() * 0.2f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.2f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.08245f, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.08245f, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.2f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.2f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.08245f, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.00002f);
            sharpSymbolPath.Close();
            sharpSymbolPath.MoveTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.46586f, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.53414f, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.6f);
            sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.6f);
            sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.53414f, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.46586f, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
            sharpSymbolPath.Close();

            paint.Reset();
            paint.Flags = PaintFlags.AntiAlias;
            paint.SetStyle(Paint.Style.Fill);
            paint.Color = new Color(fillColor);
            canvas.DrawPath(sharpSymbolPath, paint);

            canvas.Restore();
        }
        public static void drawClock(SKCanvas canvas, Context context, SKRect targetFrame, ResizingBehavior resizing, SKColor numbersColor, SKColor darkHandsColor, SKColor lightHandColor, SKColor rimColor, SKColor tickColor, SKColor faceColor, float hours, float minutes, float seconds)
        {
            // General Declarations
//         Stack<Matrix> currentTransformation = new Stack<Matrix>(); // skipping - we do not support Matrix yet
//         currentTransformation.push(new Matrix()); // skipping - we do not support Matrix yet
            SKPaint paint = CacheForClock.paint;

            // Local Variables
            String expression   = hours > 12f ? "PM" : "AM";
            float  secondsAngle = -seconds / 60f * 360f;
            float  minuteAngle  = -(minutes / 60f * 360f - secondsAngle / 60f);
            float  hourAngle    = -hours / 12f * 360f + minuteAngle / 12f;

            // Resize to Target Frame
            canvas.Save();
            var resizedFrame = Helpers.ResizingBehaviorApply(resizing, CacheForClock.originalFrame, targetFrame);

            canvas.Translate(resizedFrame.Left, resizedFrame.Top);
            canvas.Scale(resizedFrame.Width / 260f, resizedFrame.Height / 260f);

            // Oval 2
            canvas.Save();
            canvas.Translate(130f, 130f);
//         currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
            var    oval2Rect = new SKRect(-116f, -116f, 116f, 116f);
            SKPath oval2Path = CacheForClock.oval2Path;

            oval2Path.Reset();
            oval2Path.AddOval(oval2Rect, SKPathDirection.Clockwise);

            paint.Reset();
            paint.IsAntialias = true;
            paint.Style       = SKPaintStyle.Fill;
            paint.Color       = (SKColor)rimColor;
            canvas.DrawPath(oval2Path, paint);
            canvas.Restore();

            // Oval
            canvas.Save();
            canvas.Translate(130f, 130f);
//         currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
            var    ovalRect = new SKRect(-110f, -110f, 110f, 110f);
            SKPath ovalPath = CacheForClock.ovalPath;

            ovalPath.Reset();
            ovalPath.AddOval(ovalRect, SKPathDirection.Clockwise);

            paint.Reset();
            paint.IsAntialias = true;
            paint.Style       = SKPaintStyle.Fill;
            paint.Color       = (SKColor)faceColor;
            canvas.DrawPath(ovalPath, paint);
            canvas.Restore();

            // Text
            var    textRect = new SKRect(118.48f, 34.85f, 142.5f, 53f);
            SKPath textPath = CacheForClock.textPath;

            textPath.Reset();
            textPath.MoveTo(123.73f, 38.95f);
            textPath.LineTo(120.23f, 41.82f);
            textPath.LineTo(118.48f, 39.75f);
            textPath.LineTo(124f, 35.3f);
            textPath.LineTo(126.73f, 35.3f);
            textPath.LineTo(126.73f, 53f);
            textPath.LineTo(123.73f, 53f);
            textPath.LineTo(123.73f, 38.95f);
            textPath.Close();
            textPath.MoveTo(130.73f, 50.25f);
            textPath.LineTo(137.55f, 43.55f);
            textPath.CubicTo(138.1f, 43.02f, 138.54f, 42.48f, 138.86f, 41.94f);
            textPath.CubicTo(139.19f, 41.4f, 139.35f, 40.78f, 139.35f, 40.07f);
            textPath.CubicTo(139.35f, 39.24f, 139.08f, 38.58f, 138.54f, 38.09f);
            textPath.CubicTo(138f, 37.6f, 137.33f, 37.35f, 136.53f, 37.35f);
            textPath.CubicTo(135.67f, 37.35f, 134.99f, 37.64f, 134.48f, 38.21f);
            textPath.CubicTo(133.96f, 38.79f, 133.64f, 39.51f, 133.53f, 40.38f);
            textPath.LineTo(130.6f, 39.92f);
            textPath.CubicTo(130.68f, 39.19f, 130.89f, 38.52f, 131.23f, 37.9f);
            textPath.CubicTo(131.56f, 37.28f, 131.98f, 36.75f, 132.5f, 36.3f);
            textPath.CubicTo(133.02f, 35.85f, 133.62f, 35.5f, 134.31f, 35.24f);
            textPath.CubicTo(135f, 34.98f, 135.76f, 34.85f, 136.57f, 34.85f);
            textPath.CubicTo(137.34f, 34.85f, 138.08f, 34.96f, 138.79f, 35.17f);
            textPath.CubicTo(139.5f, 35.39f, 140.12f, 35.72f, 140.68f, 36.16f);
            textPath.CubicTo(141.23f, 36.6f, 141.66f, 37.15f, 141.99f, 37.79f);
            textPath.CubicTo(142.31f, 38.43f, 142.48f, 39.17f, 142.48f, 40.03f);
            textPath.CubicTo(142.48f, 40.59f, 142.4f, 41.12f, 142.25f, 41.61f);
            textPath.CubicTo(142.1f, 42.1f, 141.9f, 42.57f, 141.64f, 43f);
            textPath.CubicTo(141.38f, 43.43f, 141.08f, 43.85f, 140.74f, 44.24f);
            textPath.CubicTo(140.4f, 44.63f, 140.03f, 45.01f, 139.63f, 45.38f);
            textPath.LineTo(134.53f, 50.25f);
            textPath.LineTo(142.5f, 50.25f);
            textPath.LineTo(142.5f, 53f);
            textPath.LineTo(130.73f, 53f);
            textPath.LineTo(130.73f, 50.25f);
            textPath.Close();

            paint.Reset();
            paint.IsAntialias = true;
            paint.Style       = SKPaintStyle.Fill;
            paint.Color       = (SKColor)numbersColor;
            canvas.DrawPath(textPath, paint);

            // Bezier
            canvas.Save();
            canvas.Translate(130f, 130f);
//         currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
            canvas.RotateDegrees(-(minuteAngle + 90f));
//         currentTransformation.peek().postRotate(-(minuteAngle + 90f)); // skipping - we do not support Matrix yet
            var    bezierRect = new SKRect(-10f, -10f, 95f, 10f);
            SKPath bezierPath = CacheForClock.bezierPath;

            bezierPath.Reset();
            bezierPath.MoveTo(7.07f, -7.07f);
            bezierPath.CubicTo(8.25f, -5.89f, 9.07f, -4.49f, 9.54f, -3f);
            bezierPath.LineTo(95f, -3f);
            bezierPath.LineTo(95f, 3f);
            bezierPath.LineTo(9.54f, 3f);
            bezierPath.CubicTo(9.07f, 4.49f, 8.25f, 5.89f, 7.07f, 7.07f);
            bezierPath.CubicTo(3.17f, 10.98f, -3.17f, 10.98f, -7.07f, 7.07f);
            bezierPath.CubicTo(-10.98f, 3.17f, -10.98f, -3.17f, -7.07f, -7.07f);
            bezierPath.CubicTo(-3.17f, -10.98f, 3.17f, -10.98f, 7.07f, -7.07f);
            bezierPath.Close();

            paint.Reset();
            paint.IsAntialias = true;
            paint.Style       = SKPaintStyle.Fill;
            paint.Color       = (SKColor)darkHandsColor;
            canvas.DrawPath(bezierPath, paint);
            canvas.Restore();

            // Bezier 2
            canvas.Save();
            canvas.Translate(130f, 130f);
//         currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
            canvas.RotateDegrees(-(hourAngle + 90f));
//         currentTransformation.peek().postRotate(-(hourAngle + 90f)); // skipping - we do not support Matrix yet
            var    bezier2Rect = new SKRect(-10f, -10f, 56f, 10f);
            SKPath bezier2Path = CacheForClock.bezier2Path;

            bezier2Path.Reset();
            bezier2Path.MoveTo(7.07f, -7.07f);
            bezier2Path.CubicTo(7.7f, -6.44f, 8.24f, -5.74f, 8.66f, -5f);
            bezier2Path.LineTo(56f, -5f);
            bezier2Path.LineTo(56f, 5f);
            bezier2Path.LineTo(8.66f, 5f);
            bezier2Path.CubicTo(8.24f, 5.74f, 7.7f, 6.44f, 7.07f, 7.07f);
            bezier2Path.CubicTo(3.17f, 10.98f, -3.17f, 10.98f, -7.07f, 7.07f);
            bezier2Path.CubicTo(-10.98f, 3.17f, -10.98f, -3.17f, -7.07f, -7.07f);
            bezier2Path.CubicTo(-3.17f, -10.98f, 3.17f, -10.98f, 7.07f, -7.07f);
            bezier2Path.Close();

            paint.Reset();
            paint.IsAntialias = true;
            paint.Style       = SKPaintStyle.Fill;
            paint.Color       = (SKColor)darkHandsColor;
            canvas.DrawPath(bezier2Path, paint);
            canvas.Restore();

            // Bezier 3
            canvas.Save();
            canvas.Translate(130f, 130f);
//         currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
            canvas.RotateDegrees(-(secondsAngle + 90f));
//         currentTransformation.peek().postRotate(-(secondsAngle + 90f)); // skipping - we do not support Matrix yet
            var    bezier3Rect = new SKRect(-6f, -6f, 99f, 6f);
            SKPath bezier3Path = CacheForClock.bezier3Path;

            bezier3Path.Reset();
            bezier3Path.MoveTo(4.24f, -4.24f);
            bezier3Path.CubicTo(5.16f, -3.33f, 5.72f, -2.19f, 5.92f, -1f);
            bezier3Path.LineTo(99f, -1f);
            bezier3Path.LineTo(99f, 1f);
            bezier3Path.LineTo(5.92f, 1f);
            bezier3Path.CubicTo(5.72f, 2.19f, 5.16f, 3.33f, 4.24f, 4.24f);
            bezier3Path.CubicTo(1.9f, 6.59f, -1.9f, 6.59f, -4.24f, 4.24f);
            bezier3Path.CubicTo(-6.59f, 1.9f, -6.59f, -1.9f, -4.24f, -4.24f);
            bezier3Path.CubicTo(-1.9f, -6.59f, 1.9f, -6.59f, 4.24f, -4.24f);
            bezier3Path.Close();

            paint.Reset();
            paint.IsAntialias = true;
            paint.Style       = SKPaintStyle.Fill;
            paint.Color       = (SKColor)lightHandColor;
            canvas.DrawPath(bezier3Path, paint);
            canvas.Restore();

            // Group
            {
                // Rectangle
                var    rectangleRect = new SKRect(127f, 20f, 133f, 28f);
                SKPath rectanglePath = CacheForClock.rectanglePath;
                rectanglePath.Reset();
                rectanglePath.AddRect(rectangleRect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectanglePath, paint);

                // Rectangle 2
                var    rectangle2Rect = new SKRect(127f, 232f, 133f, 240f);
                SKPath rectangle2Path = CacheForClock.rectangle2Path;
                rectangle2Path.Reset();
                rectangle2Path.AddRect(rectangle2Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle2Path, paint);
            }

            // Group 2
            {
                canvas.Save();
                canvas.Translate(130f, 130f);
//             currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
                canvas.RotateDegrees(90f);
//             currentTransformation.peek().postRotate(90f); // skipping - we do not support Matrix yet

                // Rectangle 3
                var    rectangle3Rect = new SKRect(-3f, -110f, 3f, -102f);
                SKPath rectangle3Path = CacheForClock.rectangle3Path;
                rectangle3Path.Reset();
                rectangle3Path.AddRect(rectangle3Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle3Path, paint);

                // Rectangle 4
                var    rectangle4Rect = new SKRect(-3f, 102f, 3f, 110f);
                SKPath rectangle4Path = CacheForClock.rectangle4Path;
                rectangle4Path.Reset();
                rectangle4Path.AddRect(rectangle4Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle4Path, paint);

                canvas.Restore();
            }

            // Group 3
            {
                canvas.Save();
                canvas.Translate(130f, 130f);
//             currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
                canvas.RotateDegrees(-30f);
//             currentTransformation.peek().postRotate(-30f); // skipping - we do not support Matrix yet

                // Rectangle 5
                var    rectangle5Rect = new SKRect(-3f, -110f, 3f, -102f);
                SKPath rectangle5Path = CacheForClock.rectangle5Path;
                rectangle5Path.Reset();
                rectangle5Path.AddRect(rectangle5Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle5Path, paint);

                // Rectangle 6
                var    rectangle6Rect = new SKRect(-3f, 102f, 3f, 110f);
                SKPath rectangle6Path = CacheForClock.rectangle6Path;
                rectangle6Path.Reset();
                rectangle6Path.AddRect(rectangle6Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle6Path, paint);

                canvas.Restore();
            }

            // Group 4
            {
                canvas.Save();
                canvas.Translate(130f, 130f);
//             currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
                canvas.RotateDegrees(-60f);
//             currentTransformation.peek().postRotate(-60f); // skipping - we do not support Matrix yet

                // Rectangle 7
                var    rectangle7Rect = new SKRect(-3f, -110f, 3f, -102f);
                SKPath rectangle7Path = CacheForClock.rectangle7Path;
                rectangle7Path.Reset();
                rectangle7Path.AddRect(rectangle7Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle7Path, paint);

                // Rectangle 8
                var    rectangle8Rect = new SKRect(-3f, 102f, 3f, 110f);
                SKPath rectangle8Path = CacheForClock.rectangle8Path;
                rectangle8Path.Reset();
                rectangle8Path.AddRect(rectangle8Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle8Path, paint);

                canvas.Restore();
            }

            // Group 5
            {
                canvas.Save();
                canvas.Translate(130f, 130f);
//             currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
                canvas.RotateDegrees(-120f);
//             currentTransformation.peek().postRotate(-120f); // skipping - we do not support Matrix yet

                // Rectangle 9
                var    rectangle9Rect = new SKRect(-3f, -110f, 3f, -102f);
                SKPath rectangle9Path = CacheForClock.rectangle9Path;
                rectangle9Path.Reset();
                rectangle9Path.AddRect(rectangle9Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle9Path, paint);

                // Rectangle 10
                var    rectangle10Rect = new SKRect(-3f, 102f, 3f, 110f);
                SKPath rectangle10Path = CacheForClock.rectangle10Path;
                rectangle10Path.Reset();
                rectangle10Path.AddRect(rectangle10Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle10Path, paint);

                canvas.Restore();
            }

            // Group 6
            {
                canvas.Save();
                canvas.Translate(130f, 130f);
//             currentTransformation.peek().postTranslate(130f, 130f); // skipping - we do not support Matrix yet
                canvas.RotateDegrees(-150f);
//             currentTransformation.peek().postRotate(-150f); // skipping - we do not support Matrix yet

                // Rectangle 11
                var    rectangle11Rect = new SKRect(-3f, -110f, 3f, -102f);
                SKPath rectangle11Path = CacheForClock.rectangle11Path;
                rectangle11Path.Reset();
                rectangle11Path.AddRect(rectangle11Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle11Path, paint);

                // Rectangle 12
                var    rectangle12Rect = new SKRect(-3f, 102f, 3f, 110f);
                SKPath rectangle12Path = CacheForClock.rectangle12Path;
                rectangle12Path.Reset();
                rectangle12Path.AddRect(rectangle12Rect, SKPathDirection.Clockwise);

                paint.Reset();
                paint.IsAntialias = true;
                paint.Style       = SKPaintStyle.Fill;
                paint.Color       = (SKColor)tickColor;
                canvas.DrawPath(rectangle12Path, paint);

                canvas.Restore();
            }

            // Text 2
            var text2Rect      = new SKRect(111f, 198f, 149f, 238f);
            var text2TextPaint = CacheForClock.text2TextPaint;

            text2TextPaint.Reset();
            text2TextPaint.IsAntialias = true;
            text2TextPaint.Color       = (SKColor)numbersColor;
            text2TextPaint.Typeface    = TypefaceManager.GetTypeface("Avenir Next.ttc");
            text2TextPaint.TextSize    = 25f;
            StaticLayout text2StaticLayout = CacheForClock.text2StaticLayout.get((int)text2Rect.Width, SKTextAlign.Center, "6", text2TextPaint);

            canvas.Save();
            canvas.ClipRect(text2Rect);
            canvas.Translate(text2Rect.Left, text2Rect.Top + (text2Rect.Height - text2StaticLayout.getHeight()) / 2f);
            text2StaticLayout.draw(canvas);
            canvas.Restore();

            // Text 3
            var text3Rect      = new SKRect(201f, 110f, 239f, 150f);
            var text3TextPaint = CacheForClock.text3TextPaint;

            text3TextPaint.Reset();
            text3TextPaint.IsAntialias = true;
            text3TextPaint.Color       = (SKColor)numbersColor;
            text3TextPaint.Typeface    = TypefaceManager.GetTypeface("Avenir Next.ttc");
            text3TextPaint.TextSize    = 25f;
            StaticLayout text3StaticLayout = CacheForClock.text3StaticLayout.get((int)text3Rect.Width, SKTextAlign.Center, "3", text3TextPaint);

            canvas.Save();
            canvas.ClipRect(text3Rect);
            canvas.Translate(text3Rect.Left, text3Rect.Top + (text3Rect.Height - text3StaticLayout.getHeight()) / 2f);
            text3StaticLayout.draw(canvas);
            canvas.Restore();

            // Text 4
            var text4Rect      = new SKRect(22f, 110f, 60f, 150f);
            var text4TextPaint = CacheForClock.text4TextPaint;

            text4TextPaint.Reset();
            text4TextPaint.IsAntialias = true;
            text4TextPaint.Color       = (SKColor)numbersColor;
            text4TextPaint.Typeface    = TypefaceManager.GetTypeface("Avenir Next.ttc");
            text4TextPaint.TextSize    = 25f;
            StaticLayout text4StaticLayout = CacheForClock.text4StaticLayout.get((int)text4Rect.Width, SKTextAlign.Center, "9", text4TextPaint);

            canvas.Save();
            canvas.ClipRect(text4Rect);
            canvas.Translate(text4Rect.Left, text4Rect.Top + (text4Rect.Height - text4StaticLayout.getHeight()) / 2f);
            text4StaticLayout.draw(canvas);
            canvas.Restore();

            // Text 13
            var text13Rect      = new SKRect(99f, 144f, 161f, 178f);
            var text13TextPaint = CacheForClock.text13TextPaint;

            text13TextPaint.Reset();
            text13TextPaint.IsAntialias = true;
            text13TextPaint.Color       = (SKColor)numbersColor;
            text13TextPaint.Typeface    = TypefaceManager.GetTypeface("Avenir Next.ttc");
            text13TextPaint.TextSize    = 20f;
            StaticLayout text13StaticLayout = CacheForClock.text13StaticLayout.get((int)text13Rect.Width, SKTextAlign.Center, expression, text13TextPaint);

            canvas.Save();
            canvas.ClipRect(text13Rect);
            canvas.Translate(text13Rect.Left, text13Rect.Top + (text13Rect.Height - text13StaticLayout.getHeight()) / 2f);
            text13StaticLayout.draw(canvas);
            canvas.Restore();

            canvas.Restore();
        }