Beispiel #1
0
        private Path CreateMotherMovePath()
        {
            Path path = new Path();

            float CenterX           = mCurrentBounds.CenterX();
            float CenterY           = mCurrentBounds.CenterY();
            float currentPathLength = 0.0f;

            path.MoveTo(CenterX, CenterY);
            //forward top left
            path.QuadTo(CenterX - mMotherOvalHalfWidth * 2.0f, CenterY, CenterX - mMotherOvalHalfWidth * 2.0f, CenterY - mMotherOvalHalfHeight);
            mStageMotherForwardTopLeftLength = GetRestLength(path, currentPathLength);
            currentPathLength += mStageMotherForwardTopLeftLength;

            //backward top left
            path.QuadTo(CenterX - mMotherOvalHalfWidth * 1.0f, CenterY - mMotherOvalHalfHeight, CenterX, CenterY);
            mStageMotherBackwardTopLeftLength = GetRestLength(path, currentPathLength);
            currentPathLength += mStageMotherBackwardTopLeftLength;
            //forward bottom left
            path.QuadTo(CenterX, CenterY + mMotherOvalHalfHeight, CenterX - mMotherOvalHalfWidth / 2, CenterY + mMotherOvalHalfHeight * 1.1f);
            mStageMotherForwardBottomLeftLength = GetRestLength(path, currentPathLength);
            currentPathLength += mStageMotherForwardBottomLeftLength;
            //backward bottom left
            path.QuadTo(CenterX - mMotherOvalHalfWidth / 2, CenterY + mMotherOvalHalfHeight * 0.6f, CenterX, CenterY);
            mStageMotherBackwardBottomLeftLength = GetRestLength(path, currentPathLength);

            return(path);
        }
        private Path CreateCannulaHeadPath(RectF cannulaRect)
        {
            Path path = new Path();

            path.MoveTo(cannulaRect.Left, cannulaRect.Top);
            path.LineTo(cannulaRect.Right, cannulaRect.Top);
            path.MoveTo(cannulaRect.CenterX(), cannulaRect.Top);
            path.LineTo(cannulaRect.CenterX(), cannulaRect.Bottom - 0.833f * cannulaRect.Width());
            return(path);
        }
        protected override void OnDraw(Android.Graphics.Canvas canvas)
        {
            var rect = new RectF(0, 0, 300, 300);
            switch (Shape)
            {
                case Shape.Circle:
                    canvas.DrawOval(rect, new Paint() { Color = Color.CornflowerBlue });
                    break;
                case Shape.Square:
                    canvas.DrawRect(rect, new Paint() { Color = Color.Crimson });
                    break;
                case Shape.Triangle:

                    var path = new Path();
                    path.MoveTo(rect.CenterX(), rect.Top);
                    path.LineTo(rect.Left, rect.Bottom);
                    path.LineTo(rect.Right, rect.Bottom);
                    path.Close();
                    var paint = new Paint() {Color = Color.Crimson};
                    paint.Color = Color.Gold;
                    paint.SetStyle(Paint.Style.Fill);
                    canvas.DrawPath(path, paint);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
        public override void Draw(Android.Graphics.Canvas canvas)
        {
            base.Draw(canvas);

            var rect = new RectF(0,0,300,300);
            switch (TheShape)
            {
                case Shape.Circle:
                    canvas.DrawOval(rect, new Paint() { Color = Color.Aqua });
                    break;
                case Shape.Square:
                    canvas.DrawRect(rect, new Paint() { Color = Color.Red });
                    break;
                case Shape.Triangle:
                    var path = new Path();
                    path.MoveTo(rect.CenterX(), 0);
                    path.LineTo(0, rect.Height());
                    path.LineTo(rect.Width(), rect.Height());
                    path.Close();

                    var paint = new Paint() {Color = Color.Magenta};
                    paint.SetStyle(Paint.Style.Fill);
                    canvas.DrawPath(path, paint);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
        private RectF CreateRightEyeBall(RectF arcBounds, float offsetY)
        {
            //the center of the right eye
            float rightEyeCenterX = arcBounds.CenterX() + mEyeInterval / 2.0f + mEyeCircleRadius;
            float rightEyeCenterY = arcBounds.CenterY() - mEyeBallOffsetY + offsetY;

            RectF rectF = new RectF(rightEyeCenterX - mEyeBallWidth / 2.0f, rightEyeCenterY - mEyeBallHeight / 2.0f, rightEyeCenterX + mEyeBallWidth / 2.0f, rightEyeCenterY + mEyeBallHeight / 2.0f);

            return(rectF);
        }
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            int saveCount = canvas.Save();

            mTempBounds.Set(bounds);
            mTempBounds.Inset(mStrokeInset, mStrokeInset);
            mCurrentBounds.Set(mTempBounds);

            float outerCircleRadius = Math.Min(mTempBounds.Height(), mTempBounds.Width()) / 2.0f;
            float interCircleRadius = outerCircleRadius / 2.0f;
            float centerRingWidth   = interCircleRadius - mStrokeWidth / 2;

            mPaint.SetStyle(Paint.Style.Stroke);
            mPaint.Color       = new Color(mColor);
            mPaint.StrokeWidth = mStrokeWidth;
            canvas.DrawCircle(mTempBounds.CenterX(), mTempBounds.CenterY(), outerCircleRadius, mPaint);
            mPaint.SetStyle(Paint.Style.Fill);
            canvas.DrawCircle(mTempBounds.CenterX(), mTempBounds.CenterY(), interCircleRadius * mScale, mPaint);

            if (mRotation != 0)
            {
                mPaint.Color = new Color(mArcColor);
                mPaint.SetStyle(Paint.Style.Stroke);
                //strokeWidth / 2.0f + mStrokeWidth / 2.0f is the center of the inter circle width
                mTempBounds.Inset(centerRingWidth / 2.0f + mStrokeWidth / 2.0f, centerRingWidth / 2.0f + mStrokeWidth / 2.0f);
                mPaint.StrokeWidth = centerRingWidth;
                canvas.DrawArc(mTempBounds, RING_START_ANGLE, mRotation, false, mPaint);
            }

            mPaint.Color = new Color(mColor);
            mPaint.SetStyle(Paint.Style.Fill);
            for (int i = 0; i < NUM_POINTS; i++)
            {
                canvas.Rotate(i * DANCE_INTERVAL_ANGLE, POINT_X[i], POINT_Y[i]);
                RectF rectF = new RectF(POINT_X[i] - mDanceBallRadius - mShapeChangeWidth / 2.0f, POINT_Y[i] - mDanceBallRadius - mShapeChangeHeight / 2.0f, POINT_X[i] + mDanceBallRadius + mShapeChangeWidth / 2.0f, POINT_Y[i] + mDanceBallRadius + mShapeChangeHeight / 2.0f);
                canvas.DrawOval(rectF, mPaint);
                canvas.Rotate(-i * DANCE_INTERVAL_ANGLE, POINT_X[i], POINT_Y[i]);
            }

            canvas.RestoreToCount(saveCount);
        }
        protected internal override void ComputeRender(float renderProgress)
        {
            RectF arcBounds = mCurrentBounds;

            //compute gas tube bounds
            mGasTubeBounds.Set(arcBounds.CenterX() - mGasTubeWidth / 2.0f, arcBounds.CenterY(), arcBounds.CenterX() + mGasTubeWidth / 2.0f, arcBounds.CenterY() + mGasTubeHeight);
            //compute pipe body bounds
            mPipeBodyBounds.Set(arcBounds.CenterX() + mGasTubeWidth / 2.0f - mPipeBodyWidth / 2.0f, arcBounds.CenterY() - mPipeBodyHeight, arcBounds.CenterX() + mGasTubeWidth / 2.0f + mPipeBodyWidth / 2.0f, arcBounds.CenterY());
            //compute cannula bounds
            mCannulaBounds.Set(arcBounds.CenterX() + mGasTubeWidth / 2.0f - mCannulaWidth / 2.0f, arcBounds.CenterY() - mCannulaHeight - mCannulaOffsetY, arcBounds.CenterX() + mGasTubeWidth / 2.0f + mCannulaWidth / 2.0f, arcBounds.CenterY() - mCannulaOffsetY);
            //compute balloon bounds
            float insetX = mBalloonWidth * 0.333f * (1 - mProgress);
            float insetY = mBalloonHeight * 0.667f * (1 - mProgress);

            mBalloonBounds.Set(arcBounds.CenterX() - mGasTubeWidth / 2.0f - mBalloonWidth / 2.0f + insetX, arcBounds.CenterY() - mBalloonHeight + insetY, arcBounds.CenterX() - mGasTubeWidth / 2.0f + mBalloonWidth / 2.0f - insetX, arcBounds.CenterY());

            if (renderProgress <= START_INHALE_DURATION_OFFSET)
            {
                mCannulaBounds.Offset(0, -mCannulaMaxOffsetY * renderProgress / START_INHALE_DURATION_OFFSET);

                mProgress     = 0.0f;
                mProgressText = 10 + PERCENT_SIGN;

                mPaint.TextSize = mTextSize;
                mPaint.GetTextBounds(mProgressText, 0, mProgressText.Length, mProgressBounds);
            }
            else
            {
                float exhaleProgress = ACCELERATE_INTERPOLATOR.GetInterpolation(1.0f - (renderProgress - START_INHALE_DURATION_OFFSET) / (1.0f - START_INHALE_DURATION_OFFSET));
                mCannulaBounds.Offset(0, -mCannulaMaxOffsetY * exhaleProgress);

                mProgress     = 1.0f - exhaleProgress;
                mProgressText = AdjustProgress((int)(exhaleProgress * 100.0f)) + PERCENT_SIGN;

                mPaint.TextSize = mTextSize;
                mPaint.GetTextBounds(mProgressText, 0, mProgressText.Length, mProgressBounds);
            }
        }
    public Transition(RectF srcRect, RectF dstRect, long duration, IInterpolator interpolator) {
        if (!MathUtils.HaveSameAspectRatio(srcRect, dstRect)) {
            throw new IncompatibleRatioException();
        }
        _mSrcRect = srcRect;
        _mDstRect = dstRect;
        _mDuration = duration;
        _mInterpolator = interpolator;

        // Precomputes a few variables to avoid doing it in onDraw().
        _mWidthDiff = dstRect.Width() - srcRect.Width();
        _mHeightDiff = dstRect.Height() - srcRect.Height();
        _mCenterXDiff = dstRect.CenterX() - srcRect.CenterX();
        _mCenterYDiff = dstRect.CenterY() - srcRect.CenterY();
    }
        private Path CreateRightEyeCircle(RectF arcBounds, float offsetY)
        {
            Path path = new Path();

            //the center of the right eye
            float rightEyeCenterX = arcBounds.CenterX() + mEyeInterval / 2.0f + mEyeCircleRadius;
            float rightEyeCenterY = arcBounds.CenterY() + offsetY;
            //the bounds of left eye
            RectF leftEyeBounds = new RectF(rightEyeCenterX - mEyeCircleRadius, rightEyeCenterY - mEyeCircleRadius, rightEyeCenterX + mEyeCircleRadius, rightEyeCenterY + mEyeCircleRadius);

            path.AddArc(leftEyeBounds, 180, -(DEGREE_180 + 15));
            //the above radian of of the eye
            path.QuadTo(leftEyeBounds.Right - mAboveRadianEyeOffsetX, leftEyeBounds.Top + mEyeCircleRadius * 0.2f, leftEyeBounds.Right - mAboveRadianEyeOffsetX / 4.0f, leftEyeBounds.Top - mEyeCircleRadius * 0.15f);

            return(path);
        }
Beispiel #10
0
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            int saveCount = canvas.Save();

            mTempBounds.Set(Bounds);
            mTempBounds.Inset(mStrokeInset, mStrokeInset);

            canvas.Rotate(mGroupRotation, mTempBounds.CenterX(), mTempBounds.CenterY());

            if (mSwipeDegrees != 0)
            {
                mPaint.Color = new Color(mCurrentColor);
                canvas.DrawArc(mTempBounds, mStartDegrees, mSwipeDegrees, false, mPaint);
            }

            canvas.RestoreToCount(saveCount);
        }
Beispiel #11
0
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            RectF arcBounds = mTempBounds;

            arcBounds.Set(bounds);
            arcBounds.Inset(mStrokeInset, mStrokeInset);
            mCurrentBounds.Set(arcBounds);

            int saveCount = canvas.Save();

            //draw circle trim
            float startAngle = (mStartTrim + mRotation) * 360;
            float endAngle   = (mEndTrim + mRotation) * 360;
            float sweepAngle = endAngle - startAngle;

            if (sweepAngle != 0)
            {
                mPaint.Color = new Color(mColor);
                mPaint.SetStyle(Paint.Style.Stroke);
                canvas.DrawArc(arcBounds, startAngle, sweepAngle, false, mPaint);
            }

            //draw water wave
            if (mWaveProgress < 1.0f)
            {
                var nColor = new Color(mColor);


                mPaint.Color = Color.Argb((int)(Color.GetAlphaComponent(mColor) * (1.0f - mWaveProgress)), Color.GetRedComponent(mColor), Color.GetGreenComponent(mColor), Color.GetBlueComponent(mColor));

                mPaint.SetStyle(Paint.Style.Stroke);
                float radius = Math.Min(arcBounds.Width(), arcBounds.Height()) / 2.0f;
                canvas.DrawCircle(arcBounds.CenterX(), arcBounds.CenterY(), radius * (1.0f + mWaveProgress), mPaint);
            }
            //draw ball bounce
            if (mPathMeasure != null)
            {
                mPaint.Color = new Color(mBallColor);
                mPaint.SetStyle(Paint.Style.Fill);
                canvas.DrawCircle(mCurrentPosition[0], mCurrentPosition[1], mSkipBallSize * mScale, mPaint);
            }

            canvas.RestoreToCount(saveCount);
        }
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            int saveCount = canvas.Save();

            mTempBounds.Set(Bounds);
            mTempBounds.Inset(mStrokeInset, mStrokeInset);
            canvas.Rotate(mGroupRotation, mTempBounds.CenterX(), mTempBounds.CenterY());

            for (int i = 0; i < 3; i++)
            {
                if (mLevelSwipeDegrees[i] != 0)
                {
                    mPaint.Color = new Color(mLevelColors[i]);
                    canvas.DrawArc(mTempBounds, mEndDegrees, mLevelSwipeDegrees[i], false, mPaint);
                }
            }

            canvas.RestoreToCount(saveCount);
        }
Beispiel #13
0
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            int saveCount = canvas.Save();

            mTempBounds.Set(Bounds);
            mTempBounds.Inset(mStrokeInSet, mStrokeInSet);

            canvas.Rotate(mGroupRotation, mTempBounds.CenterX(), mTempBounds.CenterY());

            if (mSwipeDegrees != 0)
            {
                for (int i = 0; i < mColors.Length; i++)
                {
                    mPaint.StrokeWidth = mStrokeWidth / (i + 1);
                    mPaint.Color       = new Color(mColors[i]);
                    canvas.DrawArc(CreateArcBounds(mTempBounds, i), mStartDegrees + DEGREE_180 * (i % 2), mSwipeDegrees, false, mPaint);
                }
            }

            canvas.RestoreToCount(saveCount);
        }
        /// <summary>
        /// Coordinates are approximate, you have better cooperate with the designer's design draft
        /// </summary>
        private Path CreateBalloonPath(RectF balloonRect, float progress)
        {
            Path path = new Path();

            path.MoveTo(balloonRect.CenterX(), balloonRect.Bottom);

            float progressWidth  = balloonRect.Width() * progress;
            float progressHeight = balloonRect.Height() * progress;
            //draw left half
            float leftIncrementX1 = progressWidth * -0.48f;
            float leftIncrementY1 = progressHeight * 0.75f;
            float leftIncrementX2 = progressWidth * -0.03f;
            float leftIncrementY2 = progressHeight * -1.6f;
            float leftIncrementX3 = progressWidth * 0.9f;
            float leftIncrementY3 = progressHeight * -1.0f;

            path.CubicTo(balloonRect.Left + balloonRect.Width() * 0.25f + leftIncrementX1, balloonRect.CenterY() - balloonRect.Height() * 0.4f + leftIncrementY1, balloonRect.Left - balloonRect.Width() * 0.20f + leftIncrementX2, balloonRect.CenterY() + balloonRect.Height() * 1.15f + leftIncrementY2, balloonRect.Left - balloonRect.Width() * 0.4f + leftIncrementX3, balloonRect.Bottom + leftIncrementY3);

            //        the results of the left final transformation
            //        path.cubicTo(balloonRect.left - balloonRect.width() * 0.13f, balloonRect.CenterY() + balloonRect.height() * 0.35f,
            //                balloonRect.left - balloonRect.width() * 0.23f, balloonRect.CenterY() - balloonRect.height() * 0.45f,
            //                balloonRect.left + balloonRect.width() * 0.5f, balloonRect.bottom - balloonRect.height());

            //draw right half
            float rightIncrementX1 = progressWidth * 1.51f;
            float rightIncrementY1 = progressHeight * -0.05f;
            float rightIncrementX2 = progressWidth * 0.03f;
            float rightIncrementY2 = progressHeight * 0.5f;
            float rightIncrementX3 = 0.0f;
            float rightIncrementY3 = 0.0f;

            path.CubicTo(balloonRect.Left - balloonRect.Width() * 0.38f + rightIncrementX1, balloonRect.CenterY() - balloonRect.Height() * 0.4f + rightIncrementY1, balloonRect.Left + balloonRect.Width() * 1.1f + rightIncrementX2, balloonRect.CenterY() - balloonRect.Height() * 0.15f + rightIncrementY2, balloonRect.Left + balloonRect.Width() * 0.5f + rightIncrementX3, balloonRect.Bottom + rightIncrementY3);

            //        the results of the right final transformation
            //        path.cubicTo(balloonRect.left + balloonRect.width() * 1.23f, balloonRect.CenterY() - balloonRect.height() * 0.45f,
            //                balloonRect.left + balloonRect.width() * 1.13f, balloonRect.CenterY() + balloonRect.height() * 0.35f,
            //                balloonRect.left + balloonRect.width() * 0.5f, balloonRect.bottom);

            return(path);
        }
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            int saveCount = canvas.Save();

            RectF arcBounds = mCurrentBounds;

            arcBounds.Set(bounds);

            //draw draw gas tube
            mPaint.Color = new Color(mGasTubeColor);
            mPaint.SetStyle(Paint.Style.Stroke);
            mPaint.StrokeWidth = mStrokeWidth;
            canvas.DrawPath(CreateGasTubePath(mGasTubeBounds), mPaint);

            //draw balloon
            mPaint.Color = new Color(mBalloonColor);
            mPaint.SetStyle(Paint.Style.FillAndStroke);
            canvas.DrawPath(CreateBalloonPath(mBalloonBounds, mProgress), mPaint);

            //draw progress
            mPaint.Color       = new Color(mGasTubeColor);
            mPaint.TextSize    = mTextSize;
            mPaint.StrokeWidth = mStrokeWidth / 5.0f;
            canvas.DrawText(mProgressText, arcBounds.CenterX() - mProgressBounds.Width() / 2.0f, mGasTubeBounds.CenterY() + mProgressBounds.Height() / 2.0f, mPaint);

            //draw cannula
            mPaint.Color = new Color(mCannulaColor);
            mPaint.SetStyle(Paint.Style.Stroke);
            mPaint.StrokeWidth = mStrokeWidth;
            canvas.DrawPath(CreateCannulaHeadPath(mCannulaBounds), mPaint);
            mPaint.SetStyle(Paint.Style.Fill);
            canvas.DrawPath(CreateCannulaBottomPath(mCannulaBounds), mPaint);

            //draw pipe body
            mPaint.Color = new Color(mPipeBodyColor);
            mPaint.SetStyle(Paint.Style.Fill);
            canvas.DrawRoundRect(mPipeBodyBounds, mRectCornerRadius, mRectCornerRadius, mPaint);

            canvas.RestoreToCount(saveCount);
        }
Beispiel #16
0
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            int SaveCount = canvas.Save();

            RectF arcBounds = mCurrentBounds;

            arcBounds.Set(bounds);

            //Draw background
            canvas.DrawColor(new Color(mCurrentBackgroundColor));
            //Draw reveal circle
            if (mRevealCircleRadius > 0)
            {
                mPaint.Color = new Color(mCurrentBackgroundColor == mBackgroundColor ? mBackgroundDeepColor : mBackgroundColor);
                canvas.DrawCircle(arcBounds.CenterX(), arcBounds.CenterY(), mRevealCircleRadius, mPaint);
            }

            //Draw mother oval
            mPaint.Color = new Color(mCurrentOvalColor);

            int motherSaveCount = canvas.Save();

            canvas.Rotate(mRotateDegrees, mMotherPosition[0], mMotherPosition[1]);
            canvas.DrawPath(CreateMotherPath(), mPaint);
            canvas.DrawPath(CreateLinkPath(), mPaint);
            canvas.RestoreToCount(motherSaveCount);

            int childSaveCount = canvas.Save();

            canvas.Rotate(mRotateDegrees, mChildPosition[0], mChildPosition[1]);
            canvas.DrawPath(CreateChildPath(), mPaint);
            canvas.RestoreToCount(childSaveCount);
            canvas.RestoreToCount(SaveCount);

            //    canvas.DrawPath(mMotherMovePath, mPaint);
            //    canvas.DrawPath(mChildMovePath, mPaint);
            //    canvas.DrawLine(mMotherPosition[0], mMotherPosition[1], mChildPosition[0], mChildPosition[1], mPaint);
        }
Beispiel #17
0
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            int saveCount = canvas.Save();

            mTempBounds.Set(Bounds);
            mTempBounds.Inset(mStrokeInset, mStrokeInset);
            mTempBounds.Inset(mTempBounds.Width() * (1.0f - mScale) / 2.0f, mTempBounds.Width() * (1.0f - mScale) / 2.0f);

            canvas.Rotate(mGroupRotation, mTempBounds.CenterX(), mTempBounds.CenterY());

            mPaint.Color       = new Color(mColor);
            mPaint.Alpha       = (int)(MAX_ALPHA * mScale);
            mPaint.StrokeWidth = mStrokeWidth * mScale;

            if (mSwipeDegrees != 0)
            {
                for (int i = 0; i < mGearCount; i++)
                {
                    canvas.DrawArc(mTempBounds, mStartDegrees + DEGREE_360 / mGearCount * i, mSwipeDegrees, false, mPaint);
                }
            }

            canvas.RestoreToCount(saveCount);
        }
		//Configures the neccesary matrix transformation to apply to the textureView
		public void configureTransform(int viewWidth, int viewHeight) 
		{
			if (null == Activity || null == previewSize || null == textureView) 
				return;

			int rotation = (int)Activity.WindowManager.DefaultDisplay.Rotation;
			var matrix = new Matrix ();
			var viewRect = new RectF (0, 0, viewWidth, viewHeight);
			var bufferRect = new RectF (0, 0, previewSize.Height, previewSize.Width);
			float centerX = viewRect.CenterX();
			float centerY = viewRect.CenterY();
			if ((int)SurfaceOrientation.Rotation90 == rotation || (int)SurfaceOrientation.Rotation270 == rotation) { 
				bufferRect.Offset ((centerX - bufferRect.CenterX()), (centerY - bufferRect.CenterY()));
				matrix.SetRectToRect (viewRect, bufferRect, Matrix.ScaleToFit.Fill);
				float scale = System.Math.Max (
					(float)viewHeight / previewSize.Height,
					(float)viewHeight / previewSize.Width);
				matrix.PostScale (scale, scale, centerX, centerY);
				matrix.PostRotate (90 * (rotation - 2), centerX, centerY);
			}
			textureView.SetTransform (matrix);
		}
Beispiel #19
0
		protected override void OnSizeChanged (int w, int h, int oldW, int oldH)
		{	
			HEIGHT = h;
			WIDTH = w;

			HALF_WIDTH = (int)Math.Round ((Double)w / 2);
			HALF_HEIGHT = (int)(Math.Round ((Double)h / 2));

			//int OFFSET = mCenterOval.Width () / 3.0f;

			mCenterOval = new RectF ();
			//float OFFSET = 140f;
			//Change the OFFSET to relative value according to the screen width
			float OFFSET = WIDTH / 5;
			//mCenterOval.Set (OFFSET, OFFSET, WIDTH - OFFSET, WIDTH - OFFSET);
			//move the mCenterOval a little bit up
			mCenterOval.Set (OFFSET, OFFSET * (float)0.5, WIDTH - OFFSET, WIDTH - (float)1.5 * OFFSET);

			mCx = (int)Math.Round (mCenterOval.CenterX ());
			mCy = (int)Math.Round (mCenterOval.CenterY ());
			mRadius = (int)Math.Round (mCenterOval.Width () / 2.0f);

			mInnerCircleRadius = mRadius - (mPaint.StrokeWidth * 0.9f);

			updateCircleCoordinate (mCx, 0);
		}
		/// <summary>
		/// Configures the necessary transformation to mTextureView.
		/// This method should be called after the camera preciew size is determined in openCamera, and also the size of mTextureView is fixed
		/// </summary>
		/// <param name="viewWidth">The width of mTextureView</param>
		/// <param name="viewHeight">VThe height of mTextureView</param>
		private void ConfigureTransform(int viewWidth, int viewHeight)
		{
			Activity activity = Activity;
			if (mTextureView == null || mPreviewSize == null || activity == null) {
				return;
			}

			SurfaceOrientation rotation = activity.WindowManager.DefaultDisplay.Rotation;
			Matrix matrix = new Matrix ();
			RectF viewRect = new RectF (0, 0, viewWidth, viewHeight);
			RectF bufferRect = new RectF (0, 0, mPreviewSize.Width, mPreviewSize.Height);
			float centerX = viewRect.CenterX();
			float centerY = viewRect.CenterY();
			if (rotation == SurfaceOrientation.Rotation90 || rotation == SurfaceOrientation.Rotation270) {
				bufferRect.Offset (centerX - bufferRect.CenterX(), centerY - bufferRect.CenterY());
				matrix.SetRectToRect (viewRect, bufferRect, Matrix.ScaleToFit.Fill);
				float scale = Math.Max ((float)viewHeight / mPreviewSize.Height, (float)viewWidth / mPreviewSize.Width);
				matrix.PostScale (scale, scale, centerX, centerY);
				matrix.PostRotate (90 * ((int)rotation - 2), centerX, centerY);
			}
			mTextureView.SetTransform (matrix);
		}
 public override void OnDraw(Canvas canvas, RectF bounds, float degreeSelected)
 {
     canvas.DrawRect(bounds,BackgroundPaint);
     canvas.DrawText(Text, bounds.CenterX(), bounds.CenterY() - (TextPaint.Descent() + TextPaint.Ascent()) / 2, TextPaint);
 }