Пример #1
0
        private void DrawSocket(SKCanvas canvas, float radius)
        {
            canvas.Save();

            _paint.Style = SKPaintStyle.Fill;

            _paint.Color = BackgroundColor.ToBaseGradientColors(IsEnabled)[0];

            canvas.DrawCircle(0, 0, radius.Scale(0.70f), _paint);

            canvas.Save();

            canvas.Scale(1, -1);

            _textPaint.StrokeWidth = 2;

            _textPaint.Style = SKPaintStyle.StrokeAndFill;

            _textPaint.TextSize = radius.Scale(0.5f);

            _textPaint.Typeface = _typeface;

            _textPaint.Color = IndicatorsColor.ToSKColor();


            canvas.DrawText(Value.ToString("000."), new SKPoint(-radius.Scale(0.45f), radius.Scale(0.20f)), _textPaint);

            canvas.Restore();

            DrawStroke(radius);

            canvas.DrawCircle(0, 0, radius.Scale(0.70f), _paint);

            canvas.Restore();
        }
Пример #2
0
        private void DrawBase(SKCanvas canvas, float radius)
        {
            canvas.Save();

            _paint.Style = SKPaintStyle.Fill;

            _paint.Shader = SKShader.CreateLinearGradient(new SKPoint(-radius.Scale(1.2f), radius.Scale(1.2f)),
                                                          new SKPoint(radius.Scale(1.2f), -radius.Scale(1.2f)),
                                                          BackgroundColor.ToBaseGradientColors(IsEnabled),
                                                          new float[] { 0f, 0.6f, 1f },
                                                          SKShaderTileMode.Clamp);

            _paint.ImageFilter = null;

            canvas.DrawCircle(0, 0, radius.Scale(0.95f), _paint);

            DrawStroke(radius);

            canvas.DrawCircle(0, 0, radius.Scale(0.95f), _paint);

            canvas.Restore();
        }
Пример #3
0
        private void DrawIndicators(SKCanvas canvas, float radius)
        {
            canvas.Save();

            var baseRadius = radius.Scale(0.75f);

            var size = radius.Scale(0.15f);


            _indicatorPaint.Style = SKPaintStyle.Stroke;

            _indicatorPaint.StrokeCap = SKStrokeCap.Round;

            _indicatorPaint.ImageFilter = SKImageFilter.CreateDropShadow(0, 0, 0.5f, 0.5f, SKColors.Black);

            _indicatorPaint.StrokeWidth = radius.Scale(0.04f);


            for (int i = 0; i < 25; i++)
            {
                canvas.RotateDegrees(10);

                canvas.Save();

                canvas.RotateDegrees(230);

                canvas.Translate(0, baseRadius);

                _indicatorPaint.Color = i <= Value.Map(0, 99, 25, 0) ? BackgroundColor.ToBaseGradientColors(IsEnabled)[1] : IndicatorsColor.ToSKColor();

                canvas.DrawLine(0, 0, 0, size, _indicatorPaint);

                canvas.Restore();
            }


            canvas.Restore();
        }