Example #1
0
        public override void Draw(Canvas canvas)
        {
            paint = new Android.Graphics.Paint();
            paint.SetStyle(Android.Graphics.Paint.Style.Stroke);
            paint.StrokeCap  = Android.Graphics.Paint.Cap.Round;
            paint.StrokeJoin = Android.Graphics.Paint.Join.Round;

            if (_paths == null)
            {
                return;
            }
            foreach (var pathFromModel in _paths)
            {
                if (pathFromModel?.Points == null || pathFromModel.Points.Count < 2)
                {
                    continue;
                }
                paint.SetARGB(255, pathFromModel.Color.Red, pathFromModel.Color.Green, pathFromModel.Color.Blue);
                paint.StrokeWidth = pathFromModel.LineWidth;
                var path = new Android.Graphics.Path();
                path.MoveTo(pathFromModel.Points[0].X, pathFromModel.Points[0].Y);
                for (int i = 1; i < pathFromModel.Points.Count; i++)
                {
                    path.LineTo(pathFromModel.Points[i].X, pathFromModel.Points[i].Y);
                }

                canvas.DrawPath(path, paint);
            }
        }
Example #2
0
        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));
            }
        }
        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);
        }
			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);
			}
Example #5
0
        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);
        }
Example #6
0
 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;
 }
Example #7
0
        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);
        }
        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);
                }
            }
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
Example #13
0
        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 };
        }
			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();
			}
Example #15
0
        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);
        }
Example #16
0
        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);
            }
        }
		async Task InitDrawShape ()
		{
			if (_shapeViewModel.Image == 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 RectShape ());
				_shape.Paint.Set (paint);

				_shape.SetBounds (
					0,
					0, 
					_shapeViewModel.Shape.Radius * 2, 
					_shapeViewModel.Shape.Radius * 2);
			}
			await _shapeViewModel.LoadImageIfNeed ();
		}
Example #18
0
            public override void OnCreate(ISurfaceHolder surfaceHolder)
            {
                this.SetWatchFaceStyle (new WatchFaceStyle.Builder (this.NFLWatchService)
                    .SetCardPeekMode (WatchFaceStyle.PeekModeShort)
                    .SetBackgroundVisibility (WatchFaceStyle.BackgroundVisibilityInterruptive)
                    .SetShowSystemUiTime (false)
                    .Build ()
                );
                base.OnCreate (surfaceHolder);

                // Define backgroundImage in analogue surface - Here you can give your custom background image from resource.
                //Eventually you can update it from datamap or configuration setting
                var backgroundDrawable = NFLWatchService.Resources.GetDrawable (Resource.Drawable.sea);
                backgroundBitmap = (backgroundDrawable as BitmapDrawable).Bitmap;

                //Draw hour niddle
                hourPaint = new Paint ();
                hourPaint.SetARGB(255, 123, 195, 66);
                hourPaint.StrokeWidth = 5.0f;
                hourPaint.AntiAlias = true;
                hourPaint.StrokeCap = Paint.Cap.Round;

                //Draw minute Niddle
                minutePaint = new Paint ();
                minutePaint.SetARGB(255, 123, 195, 66);
                minutePaint.StrokeWidth = 3.0f;
                minutePaint.AntiAlias = true;
                minutePaint.StrokeCap = Paint.Cap.Round;

                // Draw second niddle
                secondPaint = new Paint ();
                secondPaint.SetARGB (255, 255, 0, 0);
                secondPaint.StrokeWidth = 2.0f;
                secondPaint.AntiAlias = true;
                secondPaint.StrokeCap = Paint.Cap.Round;

                // Draw dial
                tickPaint = new Paint ();
                tickPaint.SetARGB(255, 123, 195, 66);
                tickPaint.StrokeWidth = 3.0f;
                tickPaint.AntiAlias = true;

                time = new Time ();
            }
            public override void OnCreate(ISurfaceHolder holder)
            {
                this.SetWatchFaceStyle (new WatchFaceStyle.Builder (this.owner)
                    .SetCardPeekMode (WatchFaceStyle.PeekModeShort)
                    .SetBackgroundVisibility (WatchFaceStyle.BackgroundVisibilityInterruptive)
                    .SetShowSystemUiTime (false)
                    .Build ()
                );
                base.OnCreate (holder);

                var backgroundDrawable = owner.Resources.GetDrawable (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, 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;

                time = new Time ();
            }
Example #20
0
        public InkView(Context context, IAttributeSet attrs)
            : base(context, attrs)
        {
            mPath = new Path();
            mPathList = new LinkedList<Path>();
            mCurrStroke = -1;
            mPaint = new Paint();
            mPaint.AntiAlias = true;
            mPaint.Dither = true;
            mPaint.Color = new Color(0, 0, 255);
            mPaint.SetStyle(Paint.Style.Stroke);
            mPaint.StrokeJoin = Paint.Join.Round;
            mPaint.StrokeCap = Paint.Cap.Round;
            mPaint.StrokeWidth = 3;

            mResultPaint = new Paint();
            mResultPaint.TextSize = 32;
            mResultPaint.AntiAlias = true;
            mResultPaint.SetARGB(0xff, 0x00, 0x00, 0x00);

            gridpath = new Path();
        }
			void InitPaints()
			{
				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;

				InitStepCountPaint();
			}
        /// <summary>
        /// Initializes the joystick and displacement shapes
        /// </summary>
        private void InitShapes()
        {
            // Paint for joystick ovals
            var paintStick = new Paint();
            paintStick.SetARGB(255, 78, 78, 78);
            paintStick.SetStyle(Paint.Style.Fill);

            // Shape for left joystick
            m_ShapeStickLeft = new ShapeDrawable(new OvalShape());
            m_ShapeStickLeft.Paint.Set(paintStick);

            // Shape for right joystick
            m_ShapeStickRight = new ShapeDrawable(new OvalShape());
            m_ShapeStickRight.Paint.Set(paintStick);

            // Paint for displacement ovals
            var paintRadius = new Paint();
            paintRadius.SetARGB(255, 230, 230, 230);
            paintRadius.SetStyle(Paint.Style.Fill);

            // Shape for left displacement
            m_ShapeRadiusLeft = new ShapeDrawable(new OvalShape());
            m_ShapeRadiusLeft.Paint.Set(paintRadius);

            // Shape for right displacement
            m_ShapeRadiusRight = new ShapeDrawable(new OvalShape());
            m_ShapeRadiusRight.Paint.Set(paintRadius);
        }
        protected override void OnDraw(Canvas canvas)
        {
            // Draw shapes
            m_ShapeRadiusLeft.Draw(canvas);
            m_ShapeRadiusRight.Draw(canvas);
            m_ShapeStickLeft.Draw(canvas);
            m_ShapeStickRight.Draw(canvas);

            // Set paint for data text
            Paint paint = new Paint();
            paint.SetARGB(255, 0, 0, 0);
            paint.TextSize = 20;
            paint.TextAlign = Paint.Align.Center;

            // Draw data text for left joystick
            canvas.DrawText("DATA LEFT JOYSTICK", m_LeftJS.CENTER_X, m_LeftJS.CENTER_Y - SCREEN_HEIGHT / 2 - 30, paint);
            canvas.DrawText("Power is " + m_LeftJS.GetPower() + " %", m_LeftJS.CENTER_X, m_LeftJS.CENTER_Y - SCREEN_HEIGHT / 2, paint);
            canvas.DrawText("Abs is " + m_LeftJS.GetAbs(), m_LeftJS.CENTER_X, m_LeftJS.CENTER_Y - SCREEN_HEIGHT / 2 + 30, paint);
            canvas.DrawText("Angle is " + m_LeftJS.GetAngle() + " �", m_LeftJS.CENTER_X, m_LeftJS.CENTER_Y - SCREEN_HEIGHT / 2 + 60, paint);
            canvas.DrawText("Direction is " + m_LeftJS.GetDirection(), m_LeftJS.CENTER_X, m_LeftJS.CENTER_Y - SCREEN_HEIGHT / 2 + 90, paint);

            // Draw data text for right joystick
            canvas.DrawText("DATA RIGHT JOYSTICK", m_RightJS.CENTER_X, m_RightJS.CENTER_Y - SCREEN_HEIGHT / 2 - 30, paint);
            canvas.DrawText("Power is " + m_RightJS.GetPower() + " %", m_RightJS.CENTER_X, m_RightJS.CENTER_Y - SCREEN_HEIGHT / 2, paint);
            canvas.DrawText("Abs is " + m_RightJS.GetAbs(), m_RightJS.CENTER_X, m_RightJS.CENTER_Y - SCREEN_HEIGHT / 2 + 30, paint);
            canvas.DrawText("Angle is " + m_RightJS.GetAngle() + " �", m_RightJS.CENTER_X, m_RightJS.CENTER_Y - SCREEN_HEIGHT / 2 + 60, paint);
            canvas.DrawText("Direction is " + m_RightJS.GetDirection(), m_RightJS.CENTER_X, m_RightJS.CENTER_Y - SCREEN_HEIGHT / 2 + 90, paint);
        }
        private void init()
        {

            colorPointerPaint = new Paint();

            colorPointerPaint.SetStyle(Paint.Style.Stroke);
            colorPointerPaint.StrokeWidth = 2f;
            colorPointerPaint.SetARGB(128, 0, 0, 0);

            valuePointerPaint = new Paint();
            valuePointerPaint.SetStyle(Paint.Style.Stroke);
            valuePointerPaint.StrokeWidth = 2f;

            valuePointerArrowPaint = new Paint();

            colorWheelPaint = new Paint();
            colorWheelPaint.AntiAlias = true;
            colorWheelPaint.Dither = true;

            valueSliderPaint = new Paint();
            valueSliderPaint.AntiAlias = true;
            valueSliderPaint.Dither = true;

            colorViewPaint = new Paint();
            colorViewPaint.AntiAlias = true;

            colorViewPath = new Path();
            valueSliderPath = new Path();
            arrowPointerPath = new Path();

            outerWheelRect = new RectF();
            innerWheelRect = new RectF();

            colorPointerCoords = new RectF();

        }
Example #25
0
 private Paint GetPenPaint(Pen pen)
 {
     var paint = new Paint(PaintFlags.AntiAlias);
       paint.SetStyle(Paint.Style.Stroke);
       paint.SetARGB(pen.Color.A, pen.Color.R, pen.Color.G, pen.Color.B);
       paint.StrokeWidth = (float) pen.Width;
       return paint;
 }
Example #26
0
		Paint GetPenPaint (Pen pen)
		{
			var paint = new Paint (PaintFlags.AntiAlias);
			paint.SetStyle (Paint.Style.Stroke);
			paint.SetARGB (pen.Color.A, pen.Color.R, pen.Color.G, pen.Color.B);
			paint.StrokeWidth = (float)pen.Width;

            if (pen.DashPattern != null && pen.DashPattern.Any ()) {
                var dashPathEffect = new DashPathEffect(pen.DashPattern.ToArray(), 0);
                paint.SetPathEffect(dashPathEffect);
            }

			return paint;
		}
Example #27
0
			public LunarThread(LunarView view, ISurfaceHolder surfaceHolder, Context context, Handler handler)
			{
				// get handles to some important objects
			    this.view = view;
			    mSurfaceHolder = surfaceHolder;
				mHandler = handler;
				view.mContext = context;

				Resources res = context.Resources;
				// cache handles to our key sprites & other drawables
				mLanderImage = context.Resources.GetDrawable(R.Drawables.lander_plain);
				mFiringImage = context.Resources.GetDrawable(R.Drawables.lander_firing);
				mCrashedImage = context.GetResources().GetDrawable(R.Drawables.lander_crashed);

				// load background image as a Bitmap instead of a Drawable b/c
				// we don't need to transform it and it's faster to draw this way
				mBackgroundImage = BitmapFactory.DecodeResource(res, R.Drawables.earthrise);

				// Use the regular lander image as the model size for all sprites
				mLanderWidth = mLanderImage.IntrinsicWidth;
				mLanderHeight = mLanderImage.IntrinsicHeight;

				// Initialize paints for speedometer
				mLinePaint = new Paint();
				mLinePaint.SetAntiAlias(true);
				mLinePaint.SetARGB(255, 0, 255, 0);

				mLinePaintBad = new Paint();
				mLinePaintBad.SetAntiAlias(true);
				mLinePaintBad.SetARGB(255, 120, 180, 0);

				mScratchRect = new RectF(0, 0, 0, 0);

				mWinsInARow = 0;
				mDifficulty = DIFFICULTY_MEDIUM;

				// initial show-up of lander (not yet playing)
				mX = mLanderWidth;
				mY = mLanderHeight * 2;
				mFuel = PHYS_FUEL_INIT;
				mDX = 0;
				mDY = 0;
				mHeading = 0;
				mEngineFiring = true;
			}
Example #28
0
        protected override void OnDraw(Canvas canvas)
        {
            base.OnDraw(canvas);
            if (!this.IsInEditMode)
            {
                //draw the dragable joystick
                canvas.DrawBitmap(BitmapFactory.DecodeResource(Resources, Resource.Drawable.joystick), _touchingPoint.X, _touchingPoint.Y, null);
            }
            //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(0, 0, 60, 50, innerCirclePaint);
            }
        }