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


C# Paint.SetARGB方法代码示例

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


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

示例1: Draw

        public override void Draw(Android.Graphics.Canvas canvas)
        {
            base.Draw (canvas);

            Paint mBgPaints = new Paint ();
            mBgPaints.AntiAlias = true;
            mBgPaints.SetStyle (Paint.Style.Fill);
            mBgPaints.Color = Color.Blue;
            mBgPaints.StrokeWidth = 0.5f;

            Paint tPaint = new Paint ();
            tPaint.Alpha = 0;
            canvas.DrawColor (tPaint.Color);

            RectF mOvals = new RectF (40, 40, layout.MeasuredWidth - 40, layout.MeasuredHeight - 40);

            decimal total = 0;
            foreach (SecuritiesViewModel.PieChartValue value in securitiesViewModel.DataForPieChart ()) {
                total += value.amount;
            }

            if (total == 0) {
                return;
            }

            decimal degressPerAmount = 360 / total;
            decimal currentAngle = 0;
            foreach (SecuritiesViewModel.PieChartValue value in securitiesViewModel.DataForPieChart ()) {
                canvas.DrawArc (mOvals, (float)currentAngle, (float)(degressPerAmount * value.amount), true, mBgPaints);
                currentAngle += (degressPerAmount * value.amount);
                mBgPaints.SetARGB (255, new Random ().Next (256), new Random ().Next (256), new Random ().Next (256));
            }
        }
开发者ID:sadiq81,项目名称:Pengeplan_Xamarin,代码行数:33,代码来源:PieView.cs

示例2: ApplyCustomTypeFace

        private static void ApplyCustomTypeFace(Paint paint, Typeface tf, Android.Graphics.Color color)
        {
            int oldStyle;
            Typeface old = paint.Typeface;
            if (old == null)
            {
                oldStyle = 0;
            }
            else
            {
                oldStyle = (int)old.Style;
            }

            int fake = oldStyle & ~(int)tf.Style;
            if ((fake & (int)TypefaceStyle.Bold) != 0)
            {
                paint.FakeBoldText = true;
            }

            if ((fake & (int)TypefaceStyle.Italic) != 0)
            {
                paint.TextSkewX = -0.25f;
            }



            paint.SetARGB(color.A, color.R, color.G, color.B);

            paint.SetTypeface(tf);
        }
开发者ID:renatojunior2009,项目名称:Xamarin-Forms-Labs,代码行数:30,代码来源:CustomTypeFaceSpan.cs

示例3: InitStepCountPaint

			void InitStepCountPaint()
			{
				stepcountPaint = new Paint();
				//stepcountPaint.Color = Color.White;
				stepcountPaint.SetARGB(255, 50, 151, 218);
				stepcountPaint.SetTypeface(Typeface.Create(Typeface.SansSerif, TypefaceStyle.Normal));
				stepcountPaint.AntiAlias = true;
				stepcountPaint.TextSize = owner.Resources.GetDimension(Resource.Dimension.StepCountTextSize);
			}
开发者ID:chrisriesgo,项目名称:mini-hacks,代码行数:9,代码来源:XFitWatchfaceServiceStepCount.cs

示例4: OnDraw

        protected override void OnDraw(Canvas canvas)
        {
            var paint = new Paint();
            paint.SetARGB(255, 200, 255, 0);
            paint.SetStyle(Paint.Style.Stroke);
            paint.StrokeWidth = 4;

            canvas.DrawCircle (200, 200, 180, paint);
        }
开发者ID:pavlinap,项目名称:BullshitBingo,代码行数:9,代码来源:BoardView.cs

示例5: CreateRectangle

 private ShapeDrawable CreateRectangle(Color color)
 {
     ShapeDrawable rect = new ShapeDrawable(new RectShape());
     var paint = new Paint();
     paint.SetARGB(255,color.R,color.G,color.B);
     paint.SetStyle(Paint.Style.Fill);
     paint.StrokeWidth = 4;
     rect.Paint.Set(paint);
     return rect;
 }
开发者ID:perfp,项目名称:Chip8,代码行数:10,代码来源:Chip8View.cs

示例6: MyOvalShape

        public MyOvalShape(Context context)
            : base(context)
        {
            var paint = new Paint();
            paint.SetARGB(255, 200, 255, 0);
            paint.SetStyle(Paint.Style.Stroke);
            paint.StrokeWidth = 4;

            _shape = new ShapeDrawable(new OvalShape());
            _shape.Paint.Set(paint);

            _shape.SetBounds(20, 20, 300, 200);
        }
开发者ID:yofanana,项目名称:recipes,代码行数:13,代码来源:MyOvalShape.cs

示例7: CreateAnimationDrawer

        public CreateAnimationDrawer(Context c, BrushItem brush, Canvas canvas, Bitmap myBmp, bool tooAdd = false, int cell = 1, string DrawerState = "brush_selection", Path pathToUse = null)
            : base(c)
        {
            myBitmap = myBmp;
            myCanvas = canvas;
            DrawerStateInternal = DrawerState;
            addOnly = tooAdd;
            status = 0;
            myPath = new Path();
            myPaint = new Paint(PaintFlags.Dither);
            myPaint.AntiAlias = true;
            myPaint.Dither = true;
            myPaint.SetStyle(Paint.Style.Stroke);
            myPaint.StrokeJoin = Paint.Join.Round;
            myPaint.StrokeWidth = brush.Thickness;
            myPaint.StrokeCap = Paint.Cap.Round;
            myPaint.SetARGB(colorUtil.a, colorUtil.r, colorUtil.g, colorUtil.b);

            if (brush.BrushType == AnimationTypesBrushType.Spray)
                myPaint.SetShadowLayer(brush.Thickness, 0, 0, ImageHelper.convWZColorToColor(brush.BrushColor));

            if (DrawerState == "brush_selection")
            {
                if (pathToUse != null)
                {
                    myBoundsPaint = new Paint();
                    myBoundsPaint = new Paint(PaintFlags.Dither);
                    myBoundsPaint.AntiAlias = true;
                    myBoundsPaint.Dither = true;
                    myBoundsPaint.SetStyle(Paint.Style.Stroke);
                    myBoundsPaint.StrokeJoin = Paint.Join.Round;
                    myBoundsPaint.StrokeWidth = 10f;
                    myBoundsPaint.StrokeCap = Paint.Cap.Round;
                    myBoundsPaint.SetARGB(255, 0, 0, 0);
                    myBoundsPaint.SetPathEffect(new DashPathEffect(new float[]
                    {
                        10f,
                        20f
                    }, 0));

                    myPath = pathToUse;
                    AnimationUtil.theCanvas.DrawPath(myPath, myPaint);
                    AnimationUtil.theCanvas.DrawPath(myPath, myPaint);

                    myBoundsRect = new RectF();
                    myPath.ComputeBounds(myBoundsRect, true);
                    AnimationUtil.theCanvas.DrawRect(myBoundsRect, myBoundsPaint);
                }
            }
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:50,代码来源:CreateAnimationDrawer.cs

示例8: Draw

        public override void Draw(Canvas canvas)
        {
            var box = Element as CustomRoundedBox;
            var rect = new Rect();
            var paint = new Paint
            {
                AntiAlias = true,
            };
            paint.SetARGB((int)box.BackgroundColor.A, (int)box.BackgroundColor.R, (int)box.BackgroundColor.G, (int)box.BackgroundColor.B);

            GetDrawingRect(rect);

            var radius = (float)(rect.Width() / box.Width * box.CornerRadius);

            canvas.DrawRoundRect(new RectF(rect), radius, radius, paint);
        }
开发者ID:nodoid,项目名称:custommap2,代码行数:16,代码来源:CustomRoundedBoxRenderer.cs

示例9: OverallView

        public OverallView(Context context)
            : base(context)
        {
            SetOnTouchListener(this);
            SetBackgroundColor(Color.White);

            var paint = new Paint();
            paint.SetARGB(255, 200, 255, 0);
            paint.SetStyle(Paint.Style.Stroke);
            paint.StrokeWidth = 4;

            _shape = new ShapeDrawable(new OvalShape());
            _shape.Paint.Set(paint);

            //_shape.SetBounds(20, 20, 300, 200);
        }
开发者ID:Roflmao100,项目名称:BluetoothControl,代码行数:16,代码来源:OverallView.cs

示例10: Draw

        public override void Draw(Canvas canvas)
        {
            var box = Element as RoundedBox;
            var rect = new Rect();
            var androidColor = box.BackgroundColor.ToAndroid();
            var paint = new Paint()
                {
                    AntiAlias = true,
                };

            paint.SetARGB(Convert.ToInt32(box.Opacity * 255), (int)androidColor.R, (int)androidColor.G, (int)androidColor.B);

            GetDrawingRect(rect);

            var radius = (float)(rect.Width() / box.Width * box.CornerRadius);

            canvas.DrawRoundRect(new RectF(rect), radius, radius, paint);
        }
开发者ID:Manne990,项目名称:PhotoViewerTest,代码行数:18,代码来源:RoundedBoxRenderer.cs

示例11: InitDrawShape

        void InitDrawShape()
        {
            _shape = null;
            var paint = new Paint ();
            paint.SetARGB (
                _shapeViewModel.Shape.FilledColor.A,
                _shapeViewModel.Shape.FilledColor.R,
                _shapeViewModel.Shape.FilledColor.G,
                _shapeViewModel.Shape.FilledColor.B);
            paint.SetStyle (Paint.Style.FillAndStroke);
            paint.StrokeWidth = 4;

            _shape = new ShapeDrawable (new OvalShape ());
            _shape.Paint.Set (paint);

            _shape.SetBounds (
                0,
                0,
                _shapeViewModel.Shape.Radius * 2,
                _shapeViewModel.Shape.Radius * 2);
        }
开发者ID:jessejiang0214,项目名称:SwitchMediaTest,代码行数:21,代码来源:CircleShapeView.cs

示例12: SetColorShapes

        private static Paint[] SetColorShapes()
        {
            //Enemy Color
            Paint red = new Paint();
            red.SetARGB(255, 255, 0, 0);
            red.SetStyle(Paint.Style.FillAndStroke);
            red.StrokeWidth = 1;

            //Player Color
            Paint green = new Paint();
            green.SetARGB(255, 0, 255, 0);
            green.SetStyle(Paint.Style.FillAndStroke);
            green.StrokeWidth = 1;

            //Background Color
            Paint white = new Paint();
            white.SetARGB(255, 255, 255, 255);
            white.SetStyle(Paint.Style.FillAndStroke);
            white.StrokeWidth = 1;

            return new Paint[] { red, green, white };
        }
开发者ID:Z3R0X92,项目名称:XAMARIN,代码行数:22,代码来源:CustomUtil.cs

示例13: OnCreate

			public override void OnCreate(ISurfaceHolder surfaceHolder)
			{
				SetWatchFaceStyle(new WatchFaceStyle.Builder(owner)
								  .SetCardPeekMode(WatchFaceStyle.PeekModeShort)
								  .SetBackgroundVisibility(WatchFaceStyle.BackgroundVisibilityInterruptive)
								  .SetShowSystemUiTime(true) // TODO: hide digital time display
								  .Build()
								 );
				base.OnCreate(surfaceHolder);

				var backgroundDrawable = ContextCompat.GetDrawable(owner, Resource.Drawable.XamarinWatchFaceBackground);
				backgroundBitmap = (backgroundDrawable as BitmapDrawable).Bitmap;

				hourPaint = new Paint();
				hourPaint.SetARGB(255, 200, 200, 200);
				hourPaint.StrokeWidth = 5.0f;
				hourPaint.AntiAlias = true;
				hourPaint.StrokeCap = Paint.Cap.Round;

				minutePaint = new Paint();
				minutePaint.SetARGB(255, 200, 200, 200);
				minutePaint.StrokeWidth = 3.0f;
				minutePaint.AntiAlias = true;
				minutePaint.StrokeCap = Paint.Cap.Round;

				secondPaint = new Paint();
				secondPaint.SetARGB(255, 50, 151, 218);
				//secondPaint.SetARGB(255, 255, 0, 0);
				secondPaint.StrokeWidth = 2.0f;
				secondPaint.AntiAlias = true;
				secondPaint.StrokeCap = Paint.Cap.Round;

				tickPaint = new Paint();
				tickPaint.SetARGB(100, 200, 200, 200);
				tickPaint.StrokeWidth = 2.0f;
				tickPaint.AntiAlias = true;

				calendar = new GregorianCalendar();
			}
开发者ID:chrisriesgo,项目名称:mini-hacks,代码行数:39,代码来源:XFitWatchfaceService.cs

示例14: AddBrushPaint

        private void AddBrushPaint(Paint paint, BaseBrush brush, Rect frame)
        {
            paint.SetStyle(Paint.Style.Fill);

              var sb = brush as SolidBrush;

              if (sb != null)
              {
            paint.SetARGB(sb.Color.A, sb.Color.R, sb.Color.G, sb.Color.B);
            return;
              }

              var lgb = brush as LinearGradientBrush;
              if (lgb != null)
              {
            var n = lgb.Stops.Count;
            if (n >= 2)
            {
              var locs = new float[n];
              var comps = new int[n];
              for (var i = 0; i < n; i++)
              {
            var s = lgb.Stops[i];
            locs[i] = (float) s.Offset;
            comps[i] = s.Color.Argb;
              }
              var p1 = lgb.Absolute ? lgb.Start : frame.Position + lgb.Start*frame.Size;
              var p2 = lgb.Absolute ? lgb.End : frame.Position + lgb.End*frame.Size;
              var lg = new LinearGradient(
            (float) p1.X, (float) p1.Y,
            (float) p2.X, (float) p2.Y,
            comps,
            locs,
            Shader.TileMode.Clamp);
              paint.SetShader(lg);
            }
            return;
              }

              var rgb = brush as RadialGradientBrush;
              if (rgb != null)
              {
            var n = rgb.Stops.Count;
            if (n >= 2)
            {
              var locs = new float[n];
              var comps = new int[n];
              for (var i = 0; i < n; i++)
              {
            var s = rgb.Stops[i];
            locs[i] = (float) s.Offset;
            comps[i] = s.Color.Argb;
              }
              var p1 = rgb.GetAbsoluteCenter(frame);
              var r = rgb.GetAbsoluteRadius(frame);
              var rg = new RadialGradient(
            (float) p1.X, (float) p1.Y,
            (float) r.Max,
            comps,
            locs,
            Shader.TileMode.Clamp);

              paint.SetShader(rg);
            }
            return;
              }

              throw new NotSupportedException("Brush " + brush);
        }
开发者ID:yard,项目名称:NGraphics,代码行数:69,代码来源:AndroidPlatform.cs

示例15: OnDraw

        protected override void OnDraw(Canvas canvas)
        {
            base.OnDraw(canvas);
            if (!this.IsInEditMode)
            {
                //if (((View)this.GetParent()).getVisibility() == VISIBLE && ((View)this.getParent()).getId() != id.bigSlider)
                if (this.Visibility == ViewStates.Visible)
                {
                //draw the dragable slider(s)
                //canvas.DrawBitmap(BitmapFactory.DecodeResource(Resource.Drawable.slidersmall, _touchingPoint.X, _touchingPoint.Y));
                    canvas.DrawBitmap(BitmapFactory.DecodeResource(Resources, Resource.Drawable.slidersmall), _touchingPoint.X, _touchingPoint.Y, null);
                }
                //else
                //{
                //    //draw the dragable slider
                //    canvas.DrawBitmap(BitmapFactory.DecodeResource(Resource.Drawable.sliderbig, _touchingPoint.X, _touchingPoint.Y));
                //}
                //for debugging in edit mode
            }
            else
            {
                Paint innerCirclePaint = new Paint();
                innerCirclePaint.SetARGB(255, 255, 255, 255);
                innerCirclePaint.AntiAlias = true;

                innerCirclePaint.SetStyle(Paint.Style.Fill);
                canvas.DrawLine(21, 0, 21, 205, innerCirclePaint);
            }
        }
开发者ID:OML,项目名称:OML_Controller,代码行数:29,代码来源:SliderControls.cs


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