示例#1
0
        public void Rescale(MotoRect motoRect)
        {
            //int imageWidth = 360;
            //int moonWidth = 200;

            //int scaledMoonWidth = motoRect.Width * moonWidth / imageWidth;
            //int leftMargin = (motoRect.Width - scaledMoonWidth) / 2;

            //int unit = leftMargin / 7;
            int unit = Scale.Unit(motoRect);

            int margin = 3;

            // リスト
            for (int i = 0; i < 6; i++)
            {
                //listRects[i].Left = unit * 13;
                //listRects[i].Top = ((unit * 10) + i * (int)(unit * 2.4f));
                //listRects[i].Right = listRects[i].Left + unit * 12;
                //listRects[i].Bottom = listRects[i].Top + unit * 2;
                listRects[i] = new Rect(
                    unit * 13,
                    (unit * 10) + i * (int)(unit * 2.4f),
                    unit * 13 + unit * 12,
                    ((unit * 10) + i * (int)(unit * 2.4f)) + unit * 2);
            }

            listTextPaint.TextSize = (float)unit * 2f * 0.9f;
            float textWidth = listTextPaint.MeasureText("00:00");

            dateLeft = unit * 7;
            timeLeft = listRects[0].CenterX() - (int)(textWidth / 2f);

            // スケール
            scaleRectF = new RectF(unit * 3, unit * 3,
                                   motoRect.Right - unit * 3, motoRect.Bottom - unit * 3);

            scalePath.AddArc(scaleRectF, scaleStartAngle, scaleSweepAngle);
            scalePaint.StrokeWidth = unit * 2;

            // テキスト
            scaleTextRectF = new RectF(unit * 4 - margin, unit * 4 - margin,
                                       motoRect.Right - unit * 4 + margin, motoRect.Bottom - unit * 4 + margin);

            scaleTextPaint.TextSize = listTextPaint.TextSize;

            float textSweep =
                360.0f * textWidth / ((float)Math.PI * scaleTextRectF.Width());
            //360.0f * textWidth / (2.0f * (float)Math.PI * scaleTextRectF.Width());
            float textStart =
                scaleStartAngle + (scaleSweepAngle / 2) - textSweep / 2;

            scaleTextPath.AddArc(scaleTextRectF, textStart, textSweep);

            // リマインダ
            reminderRectF = new RectF(unit * 4.5f, unit * 4.5f,
                                      motoRect.Right - unit * 4.5f, motoRect.Bottom - unit * 4.5f);

            reminderPaint.StrokeWidth = unit;
        }
示例#2
0
        public void Draw(Canvas canvas, MotoRect rect)
        {
            if (!Visible)
            {
                return;
            }

            string text = "";

            switch (Message)
            {
            case Messages.Before1min:
                text = MSG_ONE;
                break;

            case Messages.Before5min:
                text = MSG_FIVE;
                break;

            case Messages.Ended:
                text = MSG_ENDED;
                break;

            default:
                break;
            }

            if (!string.IsNullOrWhiteSpace(text))
            {
                float width = paint.MeasureText(text);
                canvas.DrawText(text, (rect.Width - width) / 2.0f, 270, paint);
            }
        }
示例#3
0
        public void DrawBorder(Canvas canvas, MotoRect rect)
        {
            // 中心からの距離
            float margin = 20.0f;

            // 中心のXY座標を求めます。
            float centerX = rect.Width / 2.0f;
            float centerY = rect.Height / 2.0f;

            // 時針の縁を描画します
            // X, Y → 先端の座標 / Xc, Yc → 中心側の座標
            float hourHandBackLength   = centerX - 80;
            float hourHandBackRotation = ((Calendar.Get(Java.Util.CalendarField.Hour) + (Calendar.Get(Java.Util.CalendarField.Minute) / 60f)) / 6f) * (float)Math.PI;
            float hourHandBackX        = (float)Math.Sin(hourHandBackRotation) * hourHandBackLength;
            float hourHandBackY        = (float)-Math.Cos(hourHandBackRotation) * hourHandBackLength;
            float hourHandBackXc       = (float)Math.Sin(hourHandBackRotation) * margin;
            float hourHandBackYc       = (float)-Math.Cos(hourHandBackRotation) * margin;

            canvas.DrawLine(
                centerX + hourHandBackXc, centerY + hourHandBackYc,
                centerX + hourHandBackX, centerY + hourHandBackY, hourHandBackPaint);

            // 分針の縁を描画します
            // X, Y → 先端の座標 / Xc, Yc → 中心側の座標
            float minuteHandBackLength   = centerX - 40;
            float minuteHandBackRotation = Calendar.Get(Java.Util.CalendarField.Minute) / 30f * (float)Math.PI;
            float minuteHandBackX        = (float)Math.Sin(minuteHandBackRotation) * minuteHandBackLength;
            float minuteHandBackY        = (float)-Math.Cos(minuteHandBackRotation) * minuteHandBackLength;
            float minuteHandBackXc       = (float)Math.Sin(minuteHandBackRotation) * margin;
            float minuteHandBackYc       = (float)-Math.Cos(minuteHandBackRotation) * margin;

            canvas.DrawLine(
                centerX + minuteHandBackXc, centerY + minuteHandBackYc,
                centerX + minuteHandBackX, centerY + minuteHandBackY, minuteHandBackPaint);
        }
示例#4
0
        public static int Unit(MotoRect rect)
        {
            int imageWidth = 360;
            int moonWidth  = 200;

            int scaledMoonWidth = rect.Width * moonWidth / imageWidth;
            int leftMargin      = (rect.Width - scaledMoonWidth) / 2;

            return(leftMargin / 7);
        }
示例#5
0
 public void DrawInAmbient(Canvas canvas, MotoRect rect)
 {
     canvas.DrawColor(backColor);
     if (backgroundScaledAmbient == null)
     {
         backgroundScaledAmbient =
             Bitmap.CreateScaledBitmap(
                 backgroundAmbient, rect.Width, rect.Height, true);
     }
     canvas.DrawBitmap(backgroundScaledAmbient, rect.Left, rect.Top, backgroundPaint);
 }
示例#6
0
 public void DrawTetregrammaton(Canvas canvas, MotoRect rect)
 {
     canvas.DrawColor(backColor);
     if (backgroundScaledTetregrammaton == null)
     {
         backgroundScaledTetregrammaton =
             Bitmap.CreateScaledBitmap(
                 backgroundTetregrammaton, rect.Width, rect.Height, true);
     }
     canvas.DrawBitmap(backgroundScaledTetregrammaton, rect.Left, rect.Top, backgroundPaint);
 }
示例#7
0
 public void Draw(Canvas canvas, MotoRect rect)
 {
     if (IsListMode)
     {
         DrawList(canvas, rect);
     }
     else
     {
         DrawScale(canvas, rect);
         DrawReminder(canvas, rect);
     }
 }
示例#8
0
        public void Draw(Canvas canvas, MotoRect rect)
        {
            switch (NotifyStyle)
            {
            case NotifyStyles.Text:
                msgText.Draw(canvas, rect);
                break;

            case NotifyStyles.Image:
                msgImage.Draw(canvas, rect);
                break;

            default:
                break;
            }
        }
示例#9
0
        public void Draw(Canvas canvas, MotoRect rect)
        {
            string time = WatchfaceUtility.ConvertToDateTime(Calendar).ToString("HH:mm");

            int unit = Scale.Unit(rect);

            // HH:mm

            //paint.TextSize = 50;
            paint.TextSize = unit * 5f;
            float width = paint.MeasureText(time);

            //canvas.DrawText(time,
            //    (rect.Width - width) / 2, 80, paint);
            canvas.DrawText(time,
                            (rect.Width - width) / 2, unit * 8f, paint);
        }
示例#10
0
        void DrawScale(Canvas canvas, MotoRect rect)
        {
            //if (MoonAge == MoonAges.Full & FaceStyle == FaceStyles.Moon)
            if (MoonAge == MoonAges.Full)
            {
                return;
            }

            canvas.DrawPath(scalePath, scalePaint);

            #region graph gray mm = 46~59

            int minute = NextFullMoon.Minute;

            if (minute >= 46)
            {
                scaleGrayPath.Reset();

                float startAngle = scaleStartAngle + (55 - minute) * 6;
                if (startAngle < scaleStartAngle)
                {
                    startAngle = scaleStartAngle;
                }

                float sweepAngle = 30;
                if (minute <= 49)
                {
                    sweepAngle = (minute - 45) * 6;
                }
                else if (minute >= 56)
                {
                    sweepAngle = (60 - minute) * 6;
                }

                scaleGrayPath.AddArc(scaleRectF, startAngle, sweepAngle);
                canvas.DrawPath(scaleGrayPath, scaleGrayPaint);
            }

            #endregion

            canvas.DrawTextOnPath(
                NextFullMoon.ToString(FORMAT_HHMM, ci),
                scaleTextPath, 0, 0, scaleTextPaint);
        }
示例#11
0
        public void Draw(Canvas canvas, MotoRect rect)
        {
            DateTime datetime   = WatchfaceUtility.ConvertToDateTime(Calendar);
            string   date       = "";
            Rect     textRect   = new Rect();
            int      dateHeight = 0;

            int unit = Scale.Unit(rect);

            // d
            //paint.TextSize = 28;
            paint.TextSize = unit * 2.8f;
            date           = datetime.ToString("dd", ci);
            paint.GetTextBounds(date, 0, date.Length, textRect);
            dateHeight = textRect.Height();
            canvas.DrawText(date,
                            (rect.Width / 4.0f * 3.5f) - (textRect.Width() / 2.0f),
                            (rect.Height + textRect.Height()) / 2.0f, paint);

            // ddd
            //paint.TextSize = 16;
            paint.TextSize = unit * 1.6f;
            date           = datetime.ToString("ddd", ci).ToUpper();
            paint.GetTextBounds(date, 0, date.Length, textRect);
            //canvas.DrawText(date,
            //    (rect.Width / 4.0f * 3.5f) - (textRect.Width() / 2.0f),
            //    (rect.Height + textRect.Height()) / 2.0f - dateHeight - 10, paint);
            canvas.DrawText(date,
                            (rect.Width / 4.0f * 3.5f) - (textRect.Width() / 2.0f),
                            (rect.Height + textRect.Height()) / 2.0f - dateHeight - unit, paint);

            // MMM
            //paint.TextSize = 16;
            paint.TextSize = unit * 1.6f;
            date           = datetime.ToString("MMM", ci).ToUpper();
            paint.GetTextBounds(date, 0, date.Length, textRect);
            canvas.DrawText(date,
                            (rect.Width / 4.0f * 3.5f) - (textRect.Width() / 2.0f),
                            (rect.Height + textRect.Height()) / 2.0f + dateHeight + textRect.Height(), paint);
        }
示例#12
0
 /// <summary>
 /// 画像のリスケール
 /// </summary>
 /// <param name="rect">リスケールするサイズ</param>
 public void Rescale(MotoRect rect)
 {
     charScaledPlayer =
         Bitmap.CreateScaledBitmap(
             charPlayer, rect.Width, rect.Height, true);
     charScaledTemplarDragon =
         Bitmap.CreateScaledBitmap(
             charTemplarDragon, rect.Width, rect.Height, true);
     charScaledEileen =
         Bitmap.CreateScaledBitmap(
             charEileen, rect.Width, rect.Height, true);
     charScaledShionyan =
         Bitmap.CreateScaledBitmap(
             charShionyan, rect.Width, rect.Height, true);
     balloonScaledBefore5min =
         Bitmap.CreateScaledBitmap(
             balloonBefore5min, rect.Width, rect.Height, true);
     balloonScaledBefore1min =
         Bitmap.CreateScaledBitmap(
             balloonBefore1min, rect.Width, rect.Height, true);
     balloonScaledEnded =
         Bitmap.CreateScaledBitmap(
             balloonEnded, rect.Width, rect.Height, true);
 }
示例#13
0
        public void DrawSec(Canvas canvas, MotoRect rect)
        {
            // 中心からの距離
            float margin = 20.0f;

            // 中心のXY座標を求めます。
            float centerX = rect.Width / 2.0f;
            float centerY = rect.Height / 2.0f;

            // 針の長さを求めます。
            float secondHandLength = centerX - 20;

            // 秒針の縁を描画します
            float secondHandBackLength   = centerX - 20;
            float secondHandBackRotation = Calendar.Get(Java.Util.CalendarField.Second) / 30f * (float)Math.PI;
            float secondHandBackX        = (float)Math.Sin(secondHandBackRotation) * secondHandBackLength;
            float secondHandBackY        = (float)-Math.Cos(secondHandBackRotation) * secondHandBackLength;
            float secondHandBackXc       = (float)Math.Sin(secondHandBackRotation) * (secondHandBackLength - margin);
            float secondHandBackYc       = (float)-Math.Cos(secondHandBackRotation) * (secondHandBackLength - margin);

            canvas.DrawLine(
                centerX + secondHandBackXc, centerY + secondHandBackYc,
                centerX + secondHandBackX, centerY + secondHandBackY, secondHandBackPaint);

            // 秒針の先端のXY座標を求めます。
            float secondHandRotation = Calendar.Get(Java.Util.CalendarField.Second) / 30f * (float)Math.PI;
            float secondHandX        = (float)Math.Sin(secondHandRotation) * secondHandLength;
            float secondHandY        = (float)-Math.Cos(secondHandRotation) * secondHandLength;
            float secondHandXc       = (float)Math.Sin(secondHandRotation) * (secondHandLength - margin);
            float secondHandYc       = (float)-Math.Cos(secondHandRotation) * (secondHandLength - margin);

            // 秒針を描画します。
            canvas.DrawLine(
                centerX + secondHandXc, centerY + secondHandYc,
                centerX + secondHandX, centerY + secondHandY, secondHandPaint);
        }
示例#14
0
        /// <summary>
        /// 描画(基本は AnalogWatchFaceEngine.OnDraw から呼ぶ)
        /// </summary>
        /// <param name="canvas">OnDraw の canvas オブジェクト</param>
        /// <param name="rect">OnDraw の bounds オブジェクトから変換された MotoRect オブジェクト</param>
        public void Draw(Canvas canvas, MotoRect rect)
        {
            // 非表示状態の場合は終了
            if (!Visible)
            {
                return;
            }

            // キャラクタが設定されていない場合(Text モード)は終了
            // 呼び出し元で握り潰してるはずやけど、もれたら嫌なんで
            if (Character == Characters.none)
            {
                return;
            }

            switch (Character)
            {
            case Characters.Player:
                if (charScaledPlayer == null)
                {
                    charScaledPlayer =
                        Bitmap.CreateScaledBitmap(
                            charPlayer, rect.Width, rect.Height, true);
                }
                canvas.DrawBitmap(charScaledPlayer, rect.Left, rect.Top, paint);
                break;

            case Characters.TemplarDragon:
                if (charScaledTemplarDragon == null)
                {
                    charScaledTemplarDragon =
                        Bitmap.CreateScaledBitmap(
                            charTemplarDragon, rect.Width, rect.Height, true);
                }
                canvas.DrawBitmap(charScaledTemplarDragon, rect.Left, rect.Top, paint);
                break;

            case Characters.Eileen:
                if (charScaledEileen == null)
                {
                    charScaledEileen =
                        Bitmap.CreateScaledBitmap(
                            charEileen, rect.Width, rect.Height, true);
                }
                canvas.DrawBitmap(charScaledEileen, rect.Left, rect.Top, paint);
                break;

            case Characters.Shionyan:
                if (charScaledShionyan == null)
                {
                    charScaledShionyan =
                        Bitmap.CreateScaledBitmap(
                            charShionyan, rect.Width, rect.Height, true);
                }
                canvas.DrawBitmap(charScaledShionyan, rect.Left, rect.Top, paint);
                break;

            default:
                break;
            }

            if (Message != Messages.none)
            {
                switch (Message)
                {
                case Messages.Before5min:
                    if (balloonScaledBefore5min == null)
                    {
                        balloonScaledBefore5min =
                            Bitmap.CreateScaledBitmap(
                                balloonBefore5min, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(balloonScaledBefore5min, rect.Left, rect.Top, paint);
                    break;

                case Messages.Before1min:
                    if (balloonScaledBefore1min == null)
                    {
                        balloonScaledBefore1min =
                            Bitmap.CreateScaledBitmap(
                                balloonBefore1min, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(balloonScaledBefore1min, rect.Left, rect.Top, paint);
                    break;

                case Messages.Ended:
                    if (balloonScaledEnded == null)
                    {
                        balloonScaledEnded =
                            Bitmap.CreateScaledBitmap(
                                balloonEnded, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(balloonScaledEnded, rect.Left, rect.Top, paint);
                    break;

                default:
                    break;
                }
            }
        }
示例#15
0
        public void Draw(Canvas canvas, MotoRect rect)
        {
            canvas.DrawColor(backColor);

            if (IsListMode)
            {
                // 背景を暗くしたら終わり
                // WatchGraph が描いてくれる
                return;
            }

            if (FaceStyle == FaceStyles.Logo)
            {
                if (backgroundScaledDevilSummoner == null)
                {
                    backgroundScaledDevilSummoner =
                        Bitmap.CreateScaledBitmap(
                            backgroundDevilSummoner, rect.Width, rect.Height, true);
                }
                canvas.DrawBitmap(backgroundScaledDevilSummoner, rect.Left, rect.Top, backgroundPaint);
            }
            else
            {
                switch (MoonAge)
                {
                case MoonAges.none:
                    if (backgroundScaledDx2 == null)
                    {
                        backgroundScaledDx2 =
                            Bitmap.CreateScaledBitmap(
                                backgroundDx2, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledDx2, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.Full:
                    if (backgroundScaledFullMoon == null)
                    {
                        backgroundScaledFullMoon =
                            Bitmap.CreateScaledBitmap(
                                backgroundFullMoon, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledFullMoon, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.F7N:
                    if (backgroundScaledF7N == null)
                    {
                        backgroundScaledF7N =
                            Bitmap.CreateScaledBitmap(
                                backgroundF7N, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledF7N, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.F6N:
                    if (backgroundScaledF6N == null)
                    {
                        backgroundScaledF6N =
                            Bitmap.CreateScaledBitmap(
                                backgroundF6N, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledF6N, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.F5N:
                    if (backgroundScaledF5N == null)
                    {
                        backgroundScaledF5N =
                            Bitmap.CreateScaledBitmap(
                                backgroundF5N, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledF5N, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.F4N:
                    if (backgroundScaledF4N == null)
                    {
                        backgroundScaledF4N =
                            Bitmap.CreateScaledBitmap(
                                backgroundF4N, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledF4N, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.F3N:
                    if (backgroundScaledF3N == null)
                    {
                        backgroundScaledF3N =
                            Bitmap.CreateScaledBitmap(
                                backgroundF3N, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledF3N, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.F2N:
                    if (backgroundScaledF2N == null)
                    {
                        backgroundScaledF2N =
                            Bitmap.CreateScaledBitmap(
                                backgroundF2N, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledF2N, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.F1N:
                    if (backgroundScaledF1N == null)
                    {
                        backgroundScaledF1N =
                            Bitmap.CreateScaledBitmap(
                                backgroundF1N, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledF1N, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.New:
                    if (backgroundScaledNewMoon == null)
                    {
                        backgroundScaledNewMoon =
                            Bitmap.CreateScaledBitmap(
                                backgroundNewMoon, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledNewMoon, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.N1F:
                    if (backgroundScaledN1F == null)
                    {
                        backgroundScaledN1F =
                            Bitmap.CreateScaledBitmap(
                                backgroundN1F, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledN1F, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.N2F:
                    if (backgroundScaledN2F == null)
                    {
                        backgroundScaledN2F =
                            Bitmap.CreateScaledBitmap(
                                backgroundN2F, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledN2F, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.N3F:
                    if (backgroundScaledN3F == null)
                    {
                        backgroundScaledN3F =
                            Bitmap.CreateScaledBitmap(
                                backgroundN3F, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledN3F, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.N4F:
                    if (backgroundScaledN4F == null)
                    {
                        backgroundScaledN4F =
                            Bitmap.CreateScaledBitmap(
                                backgroundN4F, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledN4F, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.N5F:
                    if (backgroundScaledN5F == null)
                    {
                        backgroundScaledN5F =
                            Bitmap.CreateScaledBitmap(
                                backgroundN5F, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledN5F, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.N6F:
                    if (backgroundScaledN6F == null)
                    {
                        backgroundScaledN6F =
                            Bitmap.CreateScaledBitmap(
                                backgroundN6F, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledN6F, rect.Left, rect.Top, backgroundPaint);
                    break;

                case MoonAges.N7F:
                    if (backgroundScaledN7F == null)
                    {
                        backgroundScaledN7F =
                            Bitmap.CreateScaledBitmap(
                                backgroundN7F, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledN7F, rect.Left, rect.Top, backgroundPaint);
                    break;

                default:
                    if (backgroundScaledDx2 == null)
                    {
                        backgroundScaledDx2 =
                            Bitmap.CreateScaledBitmap(
                                backgroundDx2, rect.Width, rect.Height, true);
                    }
                    canvas.DrawBitmap(backgroundScaledDx2, rect.Left, rect.Top, backgroundPaint);
                    break;
                }
            }
        }
示例#16
0
 public void Rescale(MotoRect rect)
 {
     msgImage.Rescale(rect);
 }
示例#17
0
 public void Rescale(MotoRect rect)
 {
     backgroundScaledFullMoon =
         Bitmap.CreateScaledBitmap(
             backgroundFullMoon, rect.Width, rect.Height, true);
     backgroundScaledF7N =
         Bitmap.CreateScaledBitmap(
             backgroundF7N, rect.Width, rect.Height, true);
     backgroundScaledF6N =
         Bitmap.CreateScaledBitmap(
             backgroundF6N, rect.Width, rect.Height, true);
     backgroundScaledF5N =
         Bitmap.CreateScaledBitmap(
             backgroundF5N, rect.Width, rect.Height, true);
     backgroundScaledF4N =
         Bitmap.CreateScaledBitmap(
             backgroundF4N, rect.Width, rect.Height, true);
     backgroundScaledF3N =
         Bitmap.CreateScaledBitmap(
             backgroundF3N, rect.Width, rect.Height, true);
     backgroundScaledF2N =
         Bitmap.CreateScaledBitmap(
             backgroundF2N, rect.Width, rect.Height, true);
     backgroundScaledF1N =
         Bitmap.CreateScaledBitmap(
             backgroundF1N, rect.Width, rect.Height, true);
     backgroundScaledNewMoon =
         Bitmap.CreateScaledBitmap(
             backgroundNewMoon, rect.Width, rect.Height, true);
     backgroundScaledN1F =
         Bitmap.CreateScaledBitmap(
             backgroundN1F, rect.Width, rect.Height, true);
     backgroundScaledN2F =
         Bitmap.CreateScaledBitmap(
             backgroundN2F, rect.Width, rect.Height, true);
     backgroundScaledN3F =
         Bitmap.CreateScaledBitmap(
             backgroundN3F, rect.Width, rect.Height, true);
     backgroundScaledN4F =
         Bitmap.CreateScaledBitmap(
             backgroundN4F, rect.Width, rect.Height, true);
     backgroundScaledN5F =
         Bitmap.CreateScaledBitmap(
             backgroundN5F, rect.Width, rect.Height, true);
     backgroundScaledN6F =
         Bitmap.CreateScaledBitmap(
             backgroundN6F, rect.Width, rect.Height, true);
     backgroundScaledN7F =
         Bitmap.CreateScaledBitmap(
             backgroundN7F, rect.Width, rect.Height, true);
     backgroundScaledDevilSummoner =
         Bitmap.CreateScaledBitmap(
             backgroundDevilSummoner, rect.Width, rect.Height, true);
     backgroundScaledDx2 =
         Bitmap.CreateScaledBitmap(
             backgroundDx2, rect.Width, rect.Height, true);
     backgroundScaledAmbient =
         Bitmap.CreateScaledBitmap(
             backgroundAmbient, rect.Width, rect.Height, true);
     backgroundScaledTetregrammaton =
         Bitmap.CreateScaledBitmap(
             backgroundTetregrammaton, rect.Width, rect.Height, true);
 }
示例#18
0
            /// <summary>
            ///		<see cref="MyWatchFaceEngine"/>のインスタンスが生成された時に実行します。
            /// </summary>
            /// <param name="holder">ディスプレイ表面を表すオブジェクト</param>
            public override void OnCreate(ISurfaceHolder holder)
            {
                // TODO : ここでは主に、以下の処理を行います。
                // ・リソースから画像の読み込み
                // ・Paintなどのグラフィックスオブジェクトを生成
                // ・時刻を格納するオブジェクトの作成
                // ・システムのUI(インジケーターやOK Googleの表示など)の設定

                // システムのUIの配置方法を設定します。
                SetWatchFaceStyle(
                    new WatchFaceStyle.Builder(owner)
                    #region ウォッチフェイスのスタイルの設定

                    // ユーザーからのタップイベントを有効にするかどうか設定します。
                    //   true  : 有効
                    //   false : 無効(デフォルト)
                    .SetAcceptsTapEvents(true)

                    // 通知が来た時の通知カードの高さを設定します。
                    //   WatchFaceStyle.PeekModeShort    : 通知カードをウィンドウの下部に小さく表示します。(デフォルト)
                    //   WatchFaceStyle.PeekModeVariable : 通知カードをウィンドウの全面に表示します。
                    .SetCardPeekMode(WatchFaceStyle.PeekModeShort)

                    // 通知カードの背景の表示方法を設定します。
                    //   WatchFaceStyle.BackgroundVisibilityInterruptive : 電話の着信など一部の通知のみ、背景を用事します。(デフォルト)
                    //   WatchFaceStyle.BackgroundVisibilityPersistent   : 通知カードの種類にかかわらず、その背景を常に表示します。
                    .SetBackgroundVisibility(WatchFaceStyle.BackgroundVisibilityInterruptive)

                    // アンビエントモード時に通知カードを表示するかどうかを設定します。
                    //   WatchFaceStyle.AmbientPeekModeVisible : 通知カードを表示します。(デフォルト)
                    //   WatchFaceStyle.AmbientPeekModeHidden  : 通知カードを表示しません。
                    //.SetAmbientPeekMode( WatchFaceStyle.AmbientPeekModeHidden )

                    // システムUIのデジタル時計を表示するするかどうかを設定します。(使用している例として、デフォルトで用意されている「シンプル」があります。)
                    //   true  : 表示
                    //   false : 非表示(デフォルト)
                    .SetShowSystemUiTime(false)

                    // ステータスアイコンなどに背景を付けるかどうかを設定します。
                    //   デフォルト                               : ステータスアイコンなどに背景を表示しません。
                    //   WatchFaceStyle.ProtectStatusBar        : ステータスアイコンに背景を表示します。
                    //   WatchFaceStyle.ProtectHotwordIndicator : 「OK Google」に背景を表示します。
                    //   WatchFaceStyle.ProtectWholeScreen      : ウォッチフェイスの背景を少し暗めにします。
                    // ※パラメーターは論理和で組み合わせることができます。
                    //.SetViewProtectionMode( WatchFaceStyle.ProtectStatusBar | WatchFaceStyle.ProtectHotwordIndicator )

                    // 通知カードを透明にするかどうかを設定します。
                    //   WatchFaceStyle.PeekOpacityModeOpaque      : 不透明(デフォルト)
                    //   WatchFaceStyle.PeekOpacityModeTranslucent : 透明
                    //.SetPeekOpacityMode( WatchFaceStyle.PeekOpacityModeTranslucent )

                    // ステータスアイコンや「OK Google」の位置を設定します。
                    //   GravityFlags.Top | GravityFlags.Left   : 左上(角形のデフォルト)
                    //   GravityFlags.Top | GravityFlags.Center : 上部の中央(丸形のデフォルト)
                    // 注 : GravityFlagsは列挙体なので、int型にキャストします。
                    //.SetStatusBarGravity( ( int )( GravityFlags.Top | GravityFlags.Center ) )
                    //.SetHotwordIndicatorGravity( ( int )( GravityFlags.Top | GravityFlags.Center ) )

                    #endregion
                    // 設定したスタイル情報をビルドします。このメソッドは最後に呼び出します。
                    .Build()
                    );
                // ベースクラスのOnCreateメソッドを実行します。
                base.OnCreate(holder);

                #region 最新のAndroid SDKにおける、Android.Content.Res.Resources.GetColorメソッドについて

                /*
                 *                      Android.Content.Res.Resources.GetColorメソッドは、Android SDK Level 23以降で非推奨(Deprecated)となっています。
                 *                      代わりの方法として、Android.Support.V4.Content.ContextCompat.GetColorメソッドを使用します。
                 *
                 *                      [CanvasWatchFaceServiceオブジェクト].Resources.GetColor( Resource.Color.[リソース名] );
                 *                      ↓
                 *                      ContextCompat.GetColor( [CanvasWatchFaceServiceオブジェクト], Resource.Color.[リソース名] );
                 *                      ※CanvasWatchFaceServiceクラスはContextクラスを継承しています。
                 *
                 *                      なお、ContextCompat.GetColorの戻り値はColor型でなく、ARGB値を格納したint型となります。
                 *                      Chronoir_net.Chronica.WatchfaceExtension.WatchfaceUtility.ConvertARGBToColor( int )メソッドで、Color型に変換することができます。
                 */
                #endregion

                // 時刻を格納するオブジェクトを生成します。
                // Time ( Android )
                //nowTime = new Time();
                // Calendar ( Java )
                nowTime = Java.Util.Calendar.GetInstance(Java.Util.TimeZone.Default);
                // DateTime ( C# )
                // DateTime構造体は値型なので、オブジェクトの生成はは不要です。

                // 画面サイズ準備(OnDraw で更新)
                // とりあえず Moto 360 1st gen に設定
                motoRect = new MotoRect(0, 0, 320, 320)
                {
                    IsMoto360 = true
                };

                // 背景
                watchBackground = new WatchBackground(owner);
                watchBackground.Rescale(motoRect);
                watchBackground.FaceStyle = FaceStyles.Moon;
                // グラフ
                //watchGraph = new WatchGraph();
                //watchGraph.Rescale(motoRect);
                // リマインダ
                //watchReminder = new WatchReminder();
                //watchReminder.Rescale(motoRect);
                // リスト | グラフ & リマインダ
                watchList = new WatchList();
                watchList.Rescale(motoRect);
                watchList.IsListMode = false;
                watchList.FaceStyle  = FaceStyles.Moon;
                // 時針、分針、秒針
                watchHands = new WatchHands(owner);
                // 日時
                watchDate = new WatchDate();
                watchTime = new WatchTime();
                // 月齢判定
                moon = new MoonAge();
                moon.Initialize(
                    WatchfaceUtility.ConvertToDateTime(nowTime));
                // メッセージ
                watchNotify = new WatchNotify(owner);
                watchNotify.Rescale(motoRect);
            }
示例#19
0
        void DrawList(Canvas canvas, MotoRect rect)
        {
            Rect     grayRect;
            DateTime dateTime;

            for (int i = 0; i < 6; i++)
            {
                dateTime = NextFullMoon.AddMinutes(INTERVAL_MINUTES * i);

                canvas.DrawRect(listRects[i], listPaint);

                #region gray mm = 46~59

                if (dateTime.Minute >= 46)
                {
                    grayRect = new Rect(listRects[i]);

                    if (dateTime.Minute <= 54)
                    {
                        grayRect.Left +=
                            (55 - dateTime.Minute) * (listRects[i].Width() / 10);
                    }

                    if (dateTime.Minute >= 51)
                    {
                        grayRect.Right -=
                            (dateTime.Minute - 50) * (listRects[i].Width() / 10);
                    }

                    canvas.DrawRect(grayRect, listGrayPaint);
                }

                #endregion

                int margin = 3;
                int y      = listRects[i].Top + listRects[i].Height() - margin;

                //if (i == 0)
                //{
                //    canvas.DrawText(
                //        dateTime.ToString(FORMAT_MMDD),
                //        dateLeft, y, listTextPaint);
                //}
                //else
                //{
                //    if (dateTime.AddMinutes(INTERVAL_MINUTES * -1).Day != dateTime.Day)
                //    {
                //        canvas.DrawText(
                //            dateTime.ToString(FORMAT_MMDD),
                //            dateLeft, y, listTextPaint);
                //    }
                //}
                if (i == 0 |
                    i != 0 & dateTime.AddMinutes(INTERVAL_MINUTES * -1).Day != dateTime.Day)
                {
                    canvas.DrawText(
                        dateTime.ToString(FORMAT_MMDD),
                        dateLeft, y, listTextPaint);
                }

                canvas.DrawText(
                    dateTime.ToString(FORMAT_HHMM),
                    timeLeft, y, listTextPaint);
            }
        }
示例#20
0
        void DrawReminder(Canvas canvas, MotoRect rect)
        {
            DateTime now       = WatchfaceUtility.ConvertToDateTime(Calendar);
            int      totalMins = (int)NextFullMoon.Subtract(now).TotalMinutes;

            if (totalMins > 40 | totalMins < 0)
            {
                return;
            }

            reminderPath.Reset();

            //float startAngle = (45 - min) * 6;
            //float sweepAngle = min * 6;

            int nowMin  = now.Minute;
            int nextMin = NextFullMoon.Minute;

            float startAngle = 0f;
            float sweepAngle = 0f;

            if (nowMin < 15 & nextMin <= 15)
            {
                startAngle = 270f + nowMin * 6f;
                sweepAngle = (nextMin - nowMin) * 6f;

                reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);
            }
            else if (nowMin < 15)
            {
                startAngle = 270f + nowMin * 6f;
                sweepAngle = 360f - startAngle;

                reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);

                startAngle = 0f;
                sweepAngle = (nextMin - 15) * 6f;

                reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);
            }
            else if (nextMin <= 15)
            {
                startAngle = (nowMin - 15) * 6f;
                sweepAngle = 270f - startAngle;

                reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);

                startAngle = 270f;
                sweepAngle = nextMin * 6f;

                reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);
            }
            else if (nextMin < nowMin)
            {
                startAngle = (nowMin - 15) * 6f;
                sweepAngle = 360f - startAngle;

                reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);

                startAngle = 0f;
                sweepAngle = (nextMin - 15) * 6f;

                reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);
            }
            else
            {
                startAngle = (nowMin - 15) * 6f;
                sweepAngle = (nextMin - nowMin) * 6f;

                reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);
            }

            //float startAngle = (nextMin * 6f) + 15f;
            //float sweepAngle = totalMins * 6;

            //reminderPath.AddArc(reminderRectF, startAngle, sweepAngle);

            canvas.DrawPath(reminderPath, reminderPaint);
        }