コード例 #1
0
 void Initialize()
 {
     orientation = ArrowOrientation.Right;
     arrowPaint  = new Paint {
         Color = Color.Rgb(0x77, 0x77, 0x77),
         //Color = Color.Black,
         AntiAlias = true
     };
 }
コード例 #2
0
        public void SetOrientation(ArrowOrientation orientation, bool animate = true)
        {
            Orientation = orientation;

            animator = ValueAnimator.OfFloat(0f, 1f);
            animator.SetDuration(250);
            animator.Update       += (sender, e) => Alpha = (float)e.Animation.AnimatedValue;
            animator.AnimationEnd += (sender, e) => { animator.RemoveAllListeners(); animator = null; };
            animator.Start();
        }
コード例 #3
0
        public void DrawArrow(Rectangle r, ArrowOrientation orientation, bool color)
        {
            int   height = r.P2.Y - r.P1.Y;
            int   width  = r.P2.X - r.P1.X;
            float inc    = 0;

            if (orientation == ArrowOrientation.Left || orientation == ArrowOrientation.Right)
            {
                inc = (((float)height) / 2.0f) / ((float)width);
            }
            else
            {
                inc = (((float)width) / 2.0f) / ((float)height);
            }
            if (orientation == ArrowOrientation.Left)
            {
                for (int i = 0; i < width; i++)
                {
                    SetPixel((int)(r.P1.X + i), (int)(r.P1.Y + height / 2), color);
                    int points = (int)(inc * (float)i) + 1;
                    for (int j = 0; j < points; j++)
                    {
                        SetPixel((int)(r.P1.X + i), (int)(r.P1.Y + height / 2 + j), color);
                        SetPixel((int)(r.P1.X + i), (int)(r.P1.Y + height / 2 - j), color);
                    }
                }
            }
            if (orientation == ArrowOrientation.Right)
            {
                for (int i = 0; i < width; i++)
                {
                    SetPixel((int)(r.P2.X - i), (int)(r.P1.Y + height / 2), color);
                    int points = (int)(inc * (float)i) + 1;
                    for (int j = 0; j < points; j++)
                    {
                        SetPixel((int)(r.P2.X - i), (int)(r.P1.Y + height / 2 + j), color);
                        SetPixel((int)(r.P2.X - i), (int)(r.P1.Y + height / 2 - j), color);
                    }
                }
            }
            if (orientation == ArrowOrientation.Up)
            {
                for (int i = 0; i < height; i++)
                {
                    SetPixel((int)(r.P1.X + width / 2), (int)(r.P1.Y + i), color);
                    int points = (int)(inc * (float)i) + 1;
                    for (int j = 0; j < points; j++)
                    {
                        SetPixel((int)(r.P1.X + width / 2 + j), (int)(r.P1.Y + i), color);
                        SetPixel((int)(r.P1.X + width / 2 - j), (int)(r.P1.Y + i), color);
                    }
                }
            }
            if (orientation == ArrowOrientation.Down)
            {
                for (int i = 0; i < height; i++)
                {
                    SetPixel((int)(r.P1.X + width / 2), (int)(r.P2.Y - i), color);
                    int points = (int)(inc * (float)i) + 1;
                    for (int j = 0; j < points; j++)
                    {
                        SetPixel((int)(r.P1.X + width / 2 + j), (int)(r.P2.Y - i), color);
                        SetPixel((int)(r.P1.X + width / 2 - j), (int)(r.P2.Y - i), color);
                    }
                }
            }
        }
コード例 #4
0
ファイル: Arrow.cs プロジェクト: Andrea/FriendTab
        public void SetOrientation(ArrowOrientation orientation, bool animate = true)
        {
            Orientation = orientation;

            animator = ValueAnimator.OfFloat (0f, 1f);
            animator.SetDuration (250);
            animator.Update += (sender, e) => Alpha = (float)e.Animation.AnimatedValue;
            animator.AnimationEnd += (sender, e) => { animator.RemoveAllListeners (); animator = null; };
            animator.Start ();
        }
コード例 #5
0
ファイル: Arrow.cs プロジェクト: Andrea/FriendTab
 void Initialize()
 {
     orientation = ArrowOrientation.Right;
     arrowPaint = new Paint {
         Color = Color.Rgb (0x77, 0x77, 0x77),
         //Color = Color.Black,
         AntiAlias = true
     };
 }
コード例 #6
0
ファイル: Lcd.cs プロジェクト: RoninWest/monoev3
        public void DrawArrow(Rectangle r, ArrowOrientation orientation, bool color)
        {
            int height = r.P2.Y - r.P1.Y;
            int width = r.P2.X - r.P1.X;
            float inc = 0;
            if (orientation == ArrowOrientation.Left || orientation == ArrowOrientation.Right)
            {
                inc = (((float)height) / 2.0f) / ((float)width);
            }
            else
            {
                inc = (((float)width) / 2.0f) / ((float)height);
            }
            if (orientation == ArrowOrientation.Left) {
                for (int i = 0; i < width; i++) {
                    SetPixel ((int)(r.P1.X + i), (int)(r.P1.Y + height/2), color);
                    int points = (int)(inc*(float)i)+1;
                    for (int j = 0; j < points; j++) {
                        SetPixel ((int)(r.P1.X + i), (int)(r.P1.Y + height / 2 +j), color);
                        SetPixel ((int)(r.P1.X + i), (int)(r.P1.Y + height / 2 -j), color);
                    }
                }
            }
            if (orientation == ArrowOrientation.Right) {
                for (int i = 0; i < width; i++) {
                    SetPixel ((int)(r.P2.X - i), (int)(r.P1.Y + height/2), color);
                    int points = (int)(inc*(float)i)+1;
                    for (int j = 0; j < points; j++) {
                        SetPixel ((int)(r.P2.X -i), (int)(r.P1.Y + height / 2 +j), color);
                        SetPixel ((int)(r.P2.X -i), (int)(r.P1.Y + height / 2 -j), color);
                    }
                }
            }
            if (orientation == ArrowOrientation.Up) {
                for (int i = 0; i < height; i++) {

                    SetPixel ((int)(r.P1.X + width/2), (int)(r.P1.Y + i), color);
                    int points = (int)(inc*(float)i)+1;
                    for (int j = 0; j < points; j++) {
                        SetPixel ((int)(r.P1.X + width/2+j), (int)(r.P1.Y + i), color);
                        SetPixel ((int)(r.P1.X + width/2-j), (int)(r.P1.Y + i), color);
                    }
                }
            }
            if (orientation == ArrowOrientation.Down) {
                for (int i = 0; i < height; i++) {

                    SetPixel ((int)(r.P1.X + width/2), (int)(r.P2.Y -i), color);
                    int points = (int)(inc*(float)i)+1;
                    for (int j = 0; j < points; j++) {
                        SetPixel ((int)(r.P1.X + width/2+j), (int)(r.P2.Y - i), color);
                        SetPixel ((int)(r.P1.X + width/2-j), (int)(r.P2.Y - i), color);
                    }
                }
            }
        }
コード例 #7
0
 public Arrow(ArrowOrientation orientation)
 {
     Orientation = orientation;
 }