当前位置: 首页>>代码示例>>C#>>正文


C# Canvas.DrawPaint方法代码示例

本文整理汇总了C#中Android.Graphics.Canvas.DrawPaint方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.DrawPaint方法的具体用法?C# Canvas.DrawPaint怎么用?C# Canvas.DrawPaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Graphics.Canvas的用法示例。


在下文中一共展示了Canvas.DrawPaint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDraw

        protected override void OnDraw(Canvas canvas)
        {
            base.OnDraw(canvas);
            float middle = canvas.Width * (float)_position;

            canvas.DrawPaint(_negativePaint);

            canvas.DrawRect(0, 0, middle, canvas.Height, _positivePaint);
        }
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:9,代码来源:KarmaMeter.cs

示例2: OnDraw

        protected override void OnDraw(Canvas canvas)
        {
            base.OnDraw(canvas);
            
            var paint = new Paint
            {
                Color = new Color(45, 45, 45)
            };

            canvas.DrawPaint(paint);

            DrawStopwatch(canvas);
            DrawSecondsHand(canvas);
            DrawMinutesHand(canvas);
        }
开发者ID:adolfo7x,项目名称:Play.Stopwatch,代码行数:15,代码来源:StopwatchView.cs

示例3: OnElementSizeChanged

        void OnElementSizeChanged(object sender, EventArgs e)
        {
            var elem = sender as View;
            if (elem == null)
                return;
            using (var imageBitmap = Bitmap.CreateBitmap((int)elem.Width, (int)elem.Height, Bitmap.Config.Argb8888))
            using (var canvas = new Canvas(imageBitmap))
            using (var gradient = new RadialGradient(0, 250, 1000, currentElement.StartColor.ToAndroid(), currentElement.EndColor.ToAndroid(), Shader.TileMode.Clamp))
            using (var paint = new Paint() { Dither = true })
            {
                paint.SetShader(gradient);
                canvas.DrawPaint(paint);

                Container.Background = new BitmapDrawable(imageBitmap);
            }
        }
开发者ID:antixaker,项目名称:GradientTestApp,代码行数:16,代码来源:GradientEffect.cs

示例4: OnDraw

        protected override void OnDraw(Canvas c)
        {
            Init(c);

            _p.SetStyle (Paint.Style.Fill);
            _p.Color = Color.White;
            c.DrawPaint(_p);

            float scale = (float) _cat.Width / (float) _cat.Height;
            int new_height = c.Height * 3 / 4;
            int new_width = (int) (new_height * scale);
            c.DrawBitmap(
                _cat,
                new Rect(0, 0, _cat.Width, _cat.Height),
                new Rect(0, c.Width / 4, new_width, new_height + c.Width / 4),
                //new Rect(0, (int) (c.Height-new_height), (int) new_width, (int) c.Height),
                _p
            );

            foreach (var purr in _purrs) {
                purr.Render(c, _p);
            }
        }
开发者ID:shadowmint,项目名称:monodroid-hello-cats,代码行数:23,代码来源:CatsView.cs

示例5: OnDraw

		protected override void OnDraw (Canvas canvas)
		{
			base.OnDraw (canvas);

			// Clear screen to pink.
			paint.Color = new Color (255, 204, 204);
			canvas.DrawPaint (paint);

			// Overall transforms to shift (0, 0) to center and scale.
			canvas.Translate (this.Width / 2, this.Height / 2);
			float scale = Math.Min (this.Width, this.Height) / 2.0f / 100;
			canvas.Scale (scale, scale);

			// Attributes for tick marks.
			paint.Color = Color.Black;
			paint.StrokeCap = Paint.Cap.Round;
			paint.SetStyle (Paint.Style.Stroke);

			// Set line dash to draw tick marks for every minute.
			paint.StrokeWidth = 3;
			paint.SetPathEffect (minuteTickDashEffect);
			canvas.DrawPath (tickMarks, paint);

			// Set line dash to draw tick marks for every hour.
			paint.StrokeWidth = 6;
			paint.SetPathEffect (hourTickDashEffect);
			canvas.DrawPath (tickMarks, paint);

			// Set attributes common to all clock hands.
			Color strokeColor = Color.Black;
			Color fillColor = Color.Blue;
			paint.StrokeWidth = 2;
			paint.SetPathEffect (null);

			// Draw hour hand.
			canvas.Save ();
			canvas.Rotate (this.hourAngle);
			paint.Color = fillColor;
			paint.SetStyle (Paint.Style.Fill);
			canvas.DrawPath (hourHand, paint);
			paint.Color = strokeColor;
			paint.SetStyle (Paint.Style.Stroke);
			canvas.DrawPath (hourHand, paint);
			canvas.Restore ();

			// Draw minute hand.
			canvas.Save ();
			canvas.Rotate (this.minuteAngle);
			paint.Color = fillColor;
			paint.SetStyle (Paint.Style.Fill);
			canvas.DrawPath (minuteHand, paint);
			paint.Color = strokeColor;
			paint.SetStyle (Paint.Style.Stroke);
			canvas.DrawPath (minuteHand, paint);
			canvas.Restore ();

			// Draw second hand.
			canvas.Save ();
			canvas.Rotate (this.secondAngle);
			paint.Color = strokeColor;
			paint.SetStyle (Paint.Style.Stroke);
			canvas.DrawPath (secondHand, paint);
			canvas.Restore ();
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:64,代码来源:ClockView.cs


注:本文中的Android.Graphics.Canvas.DrawPaint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。