本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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 ();
}