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


C# Canvas.DrawPoint方法代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:eweware,项目名称:zxingmod,代码行数:39,代码来源:ZXingSurfaceView.cs

示例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);
 }
开发者ID:sdhakal,项目名称:imageProject,代码行数:11,代码来源:MainActivity.cs


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