Esempio n. 1
0
 public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)
 {
     APaint.Color = pen.Color.AColor();
     APaint.Flags = (Android.Graphics.PaintFlags) 0;
     APaint.Flags = Flags;
     APaint.SetStyle(Android.Graphics.Paint.Style.Stroke);
     APaint.StrokeWidth = LineWidth;
     ACanvas.DrawLine(x1, y1, x2, y2, APaint);
 }
        protected override void Draw(Canvas canvas, Rect bounds)
        {
            int saveCount = canvas.Save();

            RectF arcBounds = mTempBounds;

            arcBounds.Set(bounds);

            mPaint.Alpha = MAX_ALPHA;
            mPaint.SetStyle(Paint.Style.Stroke);
            mPaint.Color = new Color(mCurrentColor);

            if (mSunCoordinateY < mInitSun_MoonCoordinateY)
            {
                canvas.DrawCircle(arcBounds.CenterX(), mSunCoordinateY, mSun_MoonRadius, mPaint);
            }

            if (mMoonCoordinateY < mInitSun_MoonCoordinateY)
            {
                int moonSaveCount = canvas.Save();
                canvas.Rotate(mMoonRotation, arcBounds.CenterX(), mMoonCoordinateY);
                canvas.DrawPath(CreateMoonPath(arcBounds.CenterX(), mMoonCoordinateY), mPaint);
                canvas.RestoreToCount(moonSaveCount);
            }

            for (int i = 0; i < mSunRayCount; i++)
            {
                int sunRaySaveCount = canvas.Save();
                //rotate 45 degrees can change the direction of 0 degrees to 1:30 clock
                //-mSunRayRotation means reverse rotation
                canvas.Rotate(45 - mSunRayRotation + (mIsExpandSunRay ? i : MAX_SUN_RAY_COUNT - i) * DEGREE_360 / MAX_SUN_RAY_COUNT, arcBounds.CenterX(), mSunCoordinateY);

                canvas.DrawLine(arcBounds.CenterX(), mSunRayStartCoordinateY, arcBounds.CenterX(), mSunRayEndCoordinateY, mPaint);
                canvas.RestoreToCount(sunRaySaveCount);
            }

            if (mShowStar)
            {
                if (mStarHolders.Count == 0)
                {
                    InitStarHolders(arcBounds);
                }

                for (int i = 0; i < mStarHolders.Count; i++)
                {
                    mPaint.SetStyle(Paint.Style.Fill);
                    mPaint.Alpha = mStarHolders[i].mAlpha;
                    canvas.DrawCircle(mStarHolders[i].mCurrentPoint.X, mStarHolders[i].mCurrentPoint.Y, mStarRadius, mPaint);
                }
            }

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

            if (!TitleMode)
            {
                var rect = canvas.ClipBounds;
                int size = StyleGuide.MCSC_SortOptTbl_LayerBorderWidth.px();
                int x    = rect.Width();

                var paint = new Android.Graphics.Paint();
                paint.Color       = MI.StyleGuide.MCSC_SortOptTbl_BorderColor;
                paint.StrokeWidth = size;
                paint.SetStyle(Android.Graphics.Paint.Style.Stroke);

                canvas.DrawLine(0f, 0f, x, 0f, paint);
            }
        }