本文整理汇总了C#中Android.Graphics.Canvas.DrawPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.DrawPoint方法的具体用法?C# Canvas.DrawPoint怎么用?C# Canvas.DrawPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Graphics.Canvas
的用法示例。
在下文中一共展示了Canvas.DrawPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: drawResultPoints
private void drawResultPoints(Bitmap barcode, ZXing.Result rawResult)
{
var points = rawResult.ResultPoints;
if (points != null && points.Length > 0)
{
var canvas = new Canvas(barcode);
Paint paint = new Paint();
paint.Color = Android.Graphics.Color.White;
paint.StrokeWidth = 3.0f;
paint.SetStyle(Paint.Style.Stroke);
var border = new RectF(2, 2, barcode.Width - 2, barcode.Height - 2);
canvas.DrawRect(border, paint);
paint.Color = Android.Graphics.Color.Purple;
if (points.Length == 2)
{
paint.StrokeWidth = 4.0f;
drawLine(canvas, paint, points[0], points[1]);
}
else if (points.Length == 4 &&
(rawResult.BarcodeFormat == BarcodeFormat.UPC_A ||
rawResult.BarcodeFormat == BarcodeFormat.EAN_13))
{
// Hacky special case -- draw two lines, for the barcode and metadata
drawLine(canvas, paint, points[0], points[1]);
drawLine(canvas, paint, points[2], points[3]);
}
else
{
paint.StrokeWidth = 10.0f;
foreach (ResultPoint point in points)
canvas.DrawPoint(point.X, point.Y, paint);
}
}
}
示例2: DrawPoint
private void DrawPoint(Canvas canvas)
{
var metrics = Resources.DisplayMetrics;
var widthInPixels = metrics.WidthPixels;
var heightInPixels = metrics.HeightPixels;
var x = canvas.Width;
var y = canvas.Height;
_StartPt.X = (_StartPt.X*x)/widthInPixels ;
_StartPt.Y = (_StartPt.Y*y)/heightInPixels ;
canvas.DrawPoint(_StartPt.X,_StartPt.Y, _Paint);
}