public void SetColor(Color c)
        {
            var tpaints = c.Tag as ColPaints;

            if (tpaints == null)
            {
                var stroke = new Paint();
                stroke.Color     = global::Android.Graphics.Color.Argb(c.Alpha, c.Red, c.Green, c.Blue);
                stroke.AntiAlias = true;
                stroke.SetStyle(Paint.Style.Stroke);
                var fill = new Paint();
                fill.Color     = global::Android.Graphics.Color.Argb(c.Alpha, c.Red, c.Green, c.Blue);
                fill.AntiAlias = true;
                fill.SetStyle(Paint.Style.Fill);
                var paints = new ColPaints()
                {
                    Fill   = fill,
                    Stroke = stroke
                };
                c.Tag   = paints;
                _paints = paints;
            }
            else
            {
                _paints = tpaints;
            }
        }
Beispiel #2
0
        public void SetColor(Color c)
        {
            if (c.Tag is ColPaints paints)
            {
                _paints = paints;
                return;
            }

            var stroke = new SKPaint();

            stroke.Color       = c.ToSkiaColor();
            stroke.IsAntialias = true;
            stroke.Style       = SKPaintStyle.Stroke;
            stroke.StrokeCap   = SKStrokeCap.Round;
            stroke.StrokeJoin  = SKStrokeJoin.Round;
            var fill = new SKPaint();

            fill.Color       = stroke.Color;
            fill.IsAntialias = true;
            fill.Style       = SKPaintStyle.Fill;
            paints           = new ColPaints {
                Fill   = fill,
                Stroke = stroke
            };
            c.Tag   = paints;
            _paints = paints;
        }
Beispiel #3
0
        public AndroidGraphics(Canvas canvas)
        {
            _c         = canvas;
            _offscreen = null;

            _paints = new ColPaints();

            _paints.Fill           = new Paint();
            _paints.Fill.AntiAlias = true;
            _paints.Fill.SetStyle(Paint.Style.Fill);

            _paints.Stroke           = new Paint();
            _paints.Stroke.AntiAlias = true;
            _paints.Stroke.SetStyle(Paint.Style.Stroke);

            _paints.Text           = new Paint();
            _paints.Text.AntiAlias = true;
            _paints.Text.SetStyle(Paint.Style.Fill);

            SetColor(Colors.Black);
        }
		public void SetColor (Color c)
		{
			if (c.Tag == null) {
				var stroke = new Paint ();
				stroke.Color = global::Android.Graphics.Color.Argb (c.Alpha, c.Red, c.Green, c.Blue);
				stroke.AntiAlias = true;
				stroke.SetStyle (Paint.Style.Stroke);
				var fill = new Paint ();
				fill.Color = global::Android.Graphics.Color.Argb (c.Alpha, c.Red, c.Green, c.Blue);
				fill.AntiAlias = true;
				fill.SetStyle (Paint.Style.Fill);
				var paints = new ColPaints () {
					Fill = fill,
					Stroke = stroke
				};
				c.Tag = paints;
				_paints = paints;
			}
			else {
				_paints = (ColPaints)c.Tag;
			}
		}
Beispiel #5
0
        void BuildDroidColPaints()
        {
            if (_color.Tag == null)
            {
                var stroke = BuildDroidPaint(_font, _color, Paint.Style.Stroke);
                var fill = BuildDroidPaint(_font, _color, Paint.Style.Fill);

                var paints = new ColPaints () {
                    Fill = fill,
                    Stroke = stroke
                };
                _color.Tag = paints;
                _paints = paints;
            }
            else {
                _paints = (ColPaints)_color.Tag;
            }
        }