コード例 #1
0
ファイル: SkiaCanvas.cs プロジェクト: ebatianoSoftware/CrossX
        public override void DrawArc(RectangleF rect, float angle, float sweep, Color color, bool close, float thickness)
        {
            PreparePaint(skPaint);
            skPaint.Color       = color.ToSkia();
            skPaint.IsStroke    = true;
            skPaint.StrokeWidth = thickness;

            skCanvas.DrawArc(rect.ToSkia(), angle, sweep, close, skPaint);
        }
コード例 #2
0
        void draw_bird_head(SKCanvas canvas, SKColor pc, SKColor dc)
        {
            paint.Style = SKPaintStyle.StrokeAndFill;
            paint.Color = SKColors.White;
            canvas.DrawCircle(head_x, head_y, head_radius, paint);

            if (RandomUtility.CreateRandom() < arc_chance)
            {
                paint.Style = SKPaintStyle.Fill;
                paint.Color = pc;
                // arc(head_x, head_y, head_size, head_size, random(.7, 1)*PI, 1.8*PI, PIE);
                double startAngle = RandomUtility.CreateRandom(0.7, 1) * Math.PI;
                double sweepAngle = 1.8 * Math.PI;
                canvas.DrawArc(new SKRect(head_x, head_y, head_x + head_radius, head_y + head_radius), (float)startAngle, (float)sweepAngle, true, paint);
            }

            paint.Color = dc;
            if (RandomUtility.CreateRandom() < head_fill_chance)
            {
                paint.Style = SKPaintStyle.StrokeAndFill;
            }
            else
            {
                paint.Style = SKPaintStyle.Stroke;
            }
            canvas.DrawCircle(head_x, head_y, head_radius, paint);
        }
コード例 #3
0
        private void DrawArc(SKCanvas canvas, CoreCircle circle, Func <float> progress, float strokewidth, SKColor color)
        {
            var angle = progress.Invoke() * 3.6f;

            canvas.DrawArc(circle.Rect, 180, angle, false,
                           new SKPaint()
            {
                StrokeWidth = strokewidth, Color = color, IsStroke = true, StrokeCap = SKStrokeCap.Round
            });
        }