コード例 #1
0
        private static CircleShape[] GetOuterPegPoints(SKImageInfo info, SKCanvas canvas, float outerRingPercentageWidth)
        {
            var outerRingTemplate  = ElementDrawer.CreateRing(info, canvas, Utility.GetWidthValueFromPercentage(info, outerRingPercentageWidth), new Color(0, 0, 0), false);
            var outerRingPegPoints = ElementDrawer.CreatePegPoints(info, canvas, outerRingTemplate, 30);

            return(outerRingPegPoints);
        }
コード例 #2
0
        private static void DrawYearRing(SKImageInfo info, SKCanvas canvas, IMetonicYearModel year)
        {
            var yearRing      = ElementDrawer.CreateRing(info, canvas, Utility.GetWidthValueFromPercentage(info, (float)6), new Color(0, 0, 0), true);
            var yearRing2     = ElementDrawer.CreateRing(info, canvas, Utility.GetWidthValueFromPercentage(info, (float)6), new Color(255, 255, 255), true, true);
            var yearPegPoints = ElementDrawer.CreatePegPoints(info, canvas, yearRing, 19);

            yearPegPoints[year.GetMetonicYear() - 1].FillColor = new Color(255, 0, 0);
            foreach (var p in yearPegPoints)
            {
                canvas.DrawCircle(p.x, p.y, p.Radius, GetPointPainter(p));
            }
        }
コード例 #3
0
        private static void DrawSunRing(SKImageInfo info, SKCanvas canvas, ISunModel sun)
        {
            var sunRing = ElementDrawer.CreateRing(info, canvas, Utility.GetWidthValueFromPercentage(info, (float)37.5), new Color(255, 255, 255, 0), true);

            sunRing.FillColor = new Color(255, 255, 0, 0);
            var sunPegPoints = ElementDrawer.CreatePegPoints(info, canvas, sunRing, 56);

            sunPegPoints[sun.Get() - 1].FillColor = new Color(255, 0, 0);
            foreach (var p in sunPegPoints)
            {
                canvas.DrawCircle(p.x, p.y, p.Radius, GetPointPainter(p));
            }
        }
コード例 #4
0
        private static void DrawNodeRing(SKImageInfo info, SKCanvas canvas, INodesModel nodes)
        {
            var nodeRing = ElementDrawer.CreateRing(info, canvas, Utility.GetWidthValueFromPercentage(info, (float)39.4), new Color(255, 255, 255, 0), true);

            nodeRing.FillColor = new Color(255, 255, 0, 0);
            var nodePegPoints = ElementDrawer.CreatePegPoints(info, canvas, nodeRing, 56);

            nodePegPoints[nodes.GetNode1Position() - 1].FillColor = new Color(255, 0, 0);
            nodePegPoints[nodes.GetNode2Position() - 1].FillColor = new Color(255, 0, 0);
            foreach (var p in nodePegPoints)
            {
                canvas.DrawCircle(p.x, p.y, p.Radius, GetPointPainter(p));
            }
        }
コード例 #5
0
        private static void DrawSunCountRing(SKImageInfo info, SKCanvas canvas, ISunCountModel sunCount)
        {
            var sunCountRing      = ElementDrawer.CreateRing(info, canvas, Utility.GetWidthValueFromPercentage(info, (float)22.5), new Color(0, 0, 0), true);
            var sunCountPegPoints = ElementDrawer.CreatePegPoints(info, canvas, sunCountRing, 13);

            foreach (var p in sunCountPegPoints)
            {
                DrawMonthLine(info, canvas, p);
            }

            sunCountPegPoints[sunCount.GetPosition() - 1].FillColor = new Color(255, 0, 0);
            foreach (var p in sunCountPegPoints)
            {
                canvas.DrawCircle(p.x, p.y, p.Radius, GetPointPainter(p));
            }
        }
コード例 #6
0
        private static void DrawMonthRing(SKImageInfo info, SKCanvas canvas, IMonthModel month)
        {
            var monthRing = ElementDrawer.CreateRing(info, canvas, Utility.GetWidthValueFromPercentage(info, (float)21), new Color(255, 255, 255), false);

            monthRing.FillColor = new Color(255, 255, 0, 0);
            var monthPegPoints = ElementDrawer.CreatePegPoints(info, canvas, monthRing, 13, ((Math.PI * 2) / 13) / 2);

            var monthLabelRing = ElementDrawer.CreateRing(info, canvas, Utility.GetWidthValueFromPercentage(info, (float)19.5), new Color(255, 255, 255), false);

            var   monthLabelPoints = ElementDrawer.CreatePegPoints(info, canvas, monthLabelRing, 13, ((Math.PI * 2) / 13) / 2);
            float rotation         = 74;

            monthPegPoints[month.Get() - 1].FillColor = new Color(255, 0, 0);
            for (int i = 0; i <= monthPegPoints.Length - 1; i++)
            {
                SKPaint txtPaint1 = new SKPaint()
                {
                    Color       = Color.FromRgb(255, 255, 255).ToSKColor(),
                    Style       = SKPaintStyle.Fill,
                    StrokeWidth = 1,
                    TextSize    = Utility.GetWidthValueFromPercentage(info, 2.2f)
                };
                SKPaint txtPaint2 = new SKPaint()
                {
                    Color       = Color.FromRgb(0, 0, 0).ToSKColor(),
                    Style       = SKPaintStyle.Stroke,
                    StrokeWidth = 2,
                    TextSize    = Utility.GetWidthValueFromPercentage(info, 2.2f)
                };

                canvas.DrawCircle(monthPegPoints[i].x, monthPegPoints[i].y, monthPegPoints[i].Radius, GetPointPainter(monthPegPoints[i]));
                SKRect textbounds = new SKRect();
                var    labelText  = month.GetMonthName(i + 1);
                txtPaint1.MeasureText(labelText, ref textbounds);
                canvas.Save();
                canvas.RotateDegrees(rotation, monthLabelPoints[i].x, monthLabelPoints[i].y);
                canvas.DrawText(labelText, monthLabelPoints[i].x, monthLabelPoints[i].y + (textbounds.Height / 2), txtPaint1);
                canvas.DrawText(labelText, monthLabelPoints[i].x, monthLabelPoints[i].y + (textbounds.Height / 2), txtPaint2);
                canvas.Restore();
                rotation = rotation - 27.69f;
            }
        }