コード例 #1
0
ファイル: InfoIcon.cs プロジェクト: Mokarski/Vagonka
        public override void Draw()
        {
            /*
             * var screen = ScreenPosition;
             * foreach (var path in mStaticElement)
             *  path.Update(screen.X, screen.Y);
             *
             * mImageBg.Update();
             */
            //base.Update();
            #region draw circle

            {
                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                VG.vgLoadIdentity();

                VG.vgClearPath(mCircle, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 6.0f);
                VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH);
                VG.vgSetfv(VGParamType.VG_STROKE_DASH_PATTERN, 0, null);

                const float kFullScale = -250;
                VguArc(mCircle, X + Width / 2, Y + Height / 2 + 5, 74, 74, 215, kFullScale * (Percent / 100.0f));
            }

            #endregion

            mImageFg.Update();

            VG.vgFinish();
        }
コード例 #2
0
ファイル: InfoIcon.cs プロジェクト: Mokarski/Vagonka
        public override void Draw()
        {
            //base.Update();
            #region draw circle

            {
                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                VG.vgLoadIdentity();

                VG.vgClearPath(mLinear, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 40.0f);
                VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH);
                VG.vgSetfv(VGParamType.VG_STROKE_DASH_PATTERN, mDashPattern.Length, mDashPattern);


                const float kFullScale = 55;
                var         rv         = kFullScale * (Percent / 100.0f);
                VGU.vguLine(mLinear, X + 35, Y + 35, X + 35, Y + 35 + rv);
                VG.vgDrawPath(mLinear, VGPaintMode.VG_STROKE_PATH);
                VG.vgFinish();
            }

            #endregion

            VG.vgFinish();
        }
コード例 #3
0
ファイル: InfoIcon.cs プロジェクト: Mokarski/Vagonka
        public override void Draw()
        {
            {
                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                VG.vgLoadIdentity();


                for (var i = 0; i < mCount; i++)
                {
                    VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                    if (i == (mSpeed - 1))
                    {
                        VG.vgSetPaint(mActivePaint, VGPaintMode.VG_FILL_PATH);
                        mText[i][0].SetFont(Palette.Black);
                    }
                    else
                    {
                        VG.vgSetPaint(mDefaultPaint, VGPaintMode.VG_FILL_PATH);
                        mText[i][0].SetFont(Palette.White);
                    }

                    VGU.vguRoundRect(mPath, X, Y + i * (Width + 5), Width, Width, 5, 5);
                    VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);
                    VG.vgFinish();
                }
            }
            //base.Update();
        }
コード例 #4
0
ファイル: ClassicWindow.cs プロジェクト: Mokarski/Vagonka
        public override void Draw()
        {
            VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, new[] { 0.0f, 1.0f, 0.0f, 0.50f });
            VG.vgClear(0, 60, Width, Height);
            VG.vgFinish();

            Text.Label(null, "Hello", 50, 10, 20, Width, 50, Align.Center, Palette.DarkSlateGray)[0].Draw();

            mPath.Update();
        }
コード例 #5
0
ファイル: TextArea.cs プロジェクト: Mokarski/Vagonka
        protected override void Draw()
        {
            //VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, new[] { 0.0f, 1.0f, 0.0f, 0.5f });
            //VG.vgClear(0, 0, Width, Height);
            //VG.vgFinish();

            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
            VG.vgLoadIdentity();

            #region draw text

            if (Text == null)
            {
                return;
            }

            VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, FontColor.Value);
            VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH);

            float[] glyphOrigin = { 0.0f, 0.0f };

            // set glyph matrices
            VG.vgSetfv(VGParamType.VG_GLYPH_ORIGIN, 2, glyphOrigin);
            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE);
            VG.vgLoadIdentity();

            var widthText = (TextWidth > Width) ? Width : TextWidth;
            switch (TextAlign)
            {
            case Align.Left:
                VG.vgTranslate(TextOffset.X, TextOffset.Y);
                break;

            case Align.Center:
                VG.vgTranslate((Width - widthText + TextOffset.X) / 2f, TextOffset.Y);
                break;

            case Align.Right:
                VG.vgTranslate((Width - widthText - TextOffset.X), TextOffset.Y);
                break;
            }

            VG.vgTranslate(RotateCenter.X, RotateCenter.Y);
            VG.vgRotate(mRotate);
            VG.vgTranslate(-RotateCenter.X, -RotateCenter.Y);

            VG.vgScale(FontSize, FontSize);

            mFontRender.RenderText(Text);
            VG.vgFinish();

            #endregion
        }
コード例 #6
0
ファイル: Window.cs プロジェクト: Mokarski/Vagonka
        public new void Update()
        {
            //Console.WriteLine("->> {1}: draw: {0}", Name, DateTime.Now.ToString("mm:ss.fff"));
            Redraw();

            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
            VG.vgLoadIdentity();

            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_IMAGE_USER_TO_SURFACE);
            VG.vgLoadIdentity();

            VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, new[] { 1.0f, 1.0f, 0.0f, 0.0f });
            VG.vgClear(0, 0, Width, Height);
            VG.vgFinish();
            //Console.WriteLine("<<- {1}: draw: {0}", Name, DateTime.Now.ToString("mm:ss.fff"));

            //Console.WriteLine("->> {1}: update: {0}", Name, DateTime.Now.ToString("mm:ss.fff"));
            base.Update();
            //Console.WriteLine("<<- {1}: update: {0}", Name, DateTime.Now.ToString("mm:ss.fff"));

            #region Popup window
            ModalWindow popup = null;
            lock (mModalWindows)
            {
                if (mVisibleModal != null)
                {
                    if (mVisibleModal.IsVisible)
                    {
                        popup = mVisibleModal;
                    }
                }

                if (popup == null)
                {
                    foreach (var modalWindow in mModalWindows.Where(modalWindow => modalWindow.IsVisible))
                    {
                        mVisibleModal = modalWindow;
                        popup         = mVisibleModal;
                    }
                }
            }

            if (popup == null)
            {
                return;
            }

            // отрисовываем модальное окно
            popup.Update();
            #endregion
        }
コード例 #7
0
ファイル: InfoIcon.cs プロジェクト: Mokarski/Vagonka
        //public int Status { get; set; }


        public override void Draw()
        {
            //base.Update();

            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
            VG.vgLoadIdentity();

            VG.vgSetPaint(mFilterPaint, VGPaintMode.VG_FILL_PATH);

            VG.vgDrawPath(mFilterPath, VGPaintMode.VG_FILL_PATH);
            VG.vgFinish();

            mImage.Update();
        }
コード例 #8
0
ファイル: InfoIcon.cs プロジェクト: Mokarski/Vagonka
        public override void Draw()
        {
            //base.Update();

            {
                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                VG.vgLoadIdentity();

                foreach (var rect in mRects)
                {
                    VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, rect.Color);
                    VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH);

                    VG.vgDrawPath(rect.Path, VGPaintMode.VG_FILL_PATH);
                    VG.vgFinish();
                }
            }

            //base.Update();
        }
コード例 #9
0
ファイル: Widget.cs プロジェクト: Mokarski/Vagonka
        /// <summary>
        /// Реальная физическая перерисовка, если виджет имеет ширину и высоту и помечен к перерисовке
        /// </summary>
        public void Redraw(bool force = false)
        {
            if (Height != 0 && Width != 0 && IsDirty)
            {
                //Console.WriteLine("{1}: redraw: {0}", Name, DateTime.Now.ToString("mm:ss.fff"));

                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                VG.vgLoadIdentity();

                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_IMAGE_USER_TO_SURFACE);
                VG.vgLoadIdentity();

                VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, new[] { 1.0f, 1.0f, 1.0f, 0.0f });
                VG.vgClear(0, 0, Width, Height);
                VG.vgFinish();

                // TODO: swap debug only
                if (SwapDebug)
                {
                    mApplication.Swap();
                }

                Draw();
                VG.vgFinish();

                // TODO: swap debug only
                if (SwapDebug)
                {
                    mApplication.Swap();
                }

                mRenderBuffer.Copy(); // TODO: вместо mRenderBuffer.Activate();

                IsDirty = false;
            }

            foreach (var widget in mChilds)
            {
                ((Widget)widget).Redraw();
            }
        }
コード例 #10
0
ファイル: Window.cs プロジェクト: Mokarski/Vagonka
        protected override void Draw()
        {
            if (Background != null)
            {
                VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, Background.Value);
                VG.vgClear(0, 0, Width, Height);
                VG.vgFinish();
            }

            #region calibrate lines
            {
                /*
                 *  VG.vgLoadIdentity();
                 *  VG.vgSetParameteri(mPanelBorderColor, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                 *  VG.vgSetParameterfv(mPanelBorderColor, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 1.0f, 1.0f, 1.0f, 1.0f });
                 *
                 *  VG.vgSetPaint(mPanelBorderColor, VGPaintMode.VG_STROKE_PATH);
                 *  VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
                 *
                 *  const float kLineSize = 1.0f;
                 *  VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, kLineSize);
                 *  VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                 *  VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);
                 *
                 *  VGU.vguLine(mPath, 10, 0, 10, Height);
                 *  VGU.vguLine(mPath, Width - 10, 0, Width - 10, Height);
                 *
                 *  VGU.vguLine(mPath, 0, 10, Width, 10);
                 *  VGU.vguLine(mPath, 0, Height - 10, Width, Height - 10);
                 *
                 *
                 *  VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                 *  VG.vgFinish();
                 */
            }
            #endregion
        }
コード例 #11
0
        public void Update()
        {
            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
            VG.vgLoadIdentity();

            if (mStrokePaint != null)
            {
                mStrokePaint.SetPaint(VGPaintMode.VG_STROKE_PATH);

                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, StrokeWidth);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, mCapStyle);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, mJoinStyle);
                VG.vgSetfv(VGParamType.VG_STROKE_DASH_PATTERN, mDashPattern != null ? mDashPattern.Length : 0, mDashPattern);
            }
            else
            {
                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 0);
            }

            if (mFillPaint != null)
            {
                mFillPaint.SetPaint(VGPaintMode.VG_FILL_PATH);
            }

            //Parse("M30.0, 0.0c-6.512-8.236-10.411-18.633-10.411-29.948 c0-26.692,21.639-48.331,48.331-48.331s48.331,21.639,48.331,48.331c0,11.503-4.024,22.063-10.735,30.359l10.688,8.629 c8.615-10.655,13.779-24.218,13.779-38.988c0-34.275-27.786-62.062-62.063-62.062c-34.275,0-62.062,27.786-62.062,62.062 c0,14.53,4.995,27.892,13.357,38.467L30.0, 0.0z");
            //Parse("M676.364,484.481c0,6.627-5.372,12-12,12H526.357c-6.628,0-12-5.373-12-12V357.351c0-6.627,5.372-12,12-12h138.007c6.628,0,12,5.373,12,12V484.481z");

            VG.vgTranslate(X, Y);                 // offset at screen

            VG.vgScale(Scale, Scale);             // scale
            VG.vgTranslate(-Bounds.X, -Bounds.Y); // translate to screen coordinates (0;0)

            VG.vgDrawPath(mPath, (mFillPaint != null ? VGPaintMode.VG_FILL_PATH : 0) | (mStrokePaint != null ? VGPaintMode.VG_STROKE_PATH : 0));

            VG.vgFinish();
        }
コード例 #12
0
ファイル: Table.cs プロジェクト: Mokarski/Vagonka
        protected override void Draw()
        {
            if (!IsVisible)
            {
                return;
            }

            if (OnPaint != null)
            {
                OnPaint(this);
            }

            //var position = ScreenPosition;

            #region fill default background
            if (mNormaLineColor != null)
            {
                VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, mNormaLineColor.Value);
                VG.vgClear(0, 0, Width, Height);

                VG.vgFinish();
            }
            #endregion

            #region fill active cells
            if (mActiveLineColor != null)
            {
                VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, mActiveLineColor.Value);
                if (ActiveLine != null)
                {
                    VG.vgClear(ActiveLine.X, ActiveLine.Y, ActiveLine.Width, ActiveLine.Height);
                }
                else if (ActiveCell != null)
                {
                    VG.vgClear(ActiveCell.X, ActiveCell.Y, ActiveCell.Width, ActiveCell.Height);
                }

                VG.vgFinish();
            }
            #endregion

            VG.vgFinish();

            #region draw grid

            if (mBorderWidth != 0)
            {
                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, mBorderWidth);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                VG.vgLoadIdentity();
                //VG.vgTranslate(position.X, position.Y);
                VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH);
                VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                VG.vgFinish();
            }

            #endregion
            VG.vgFinish();
        }
コード例 #13
0
        public override void Update()
        {
            if (Width == 0 || Height == 0)
            {
                return;
            }

            if (!IsVisible)
            {
                return;
            }

            VG.vgLoadIdentity();
            if (!mIsRealUpdate)
            {
                // copy image from mCache
                VG.vgSetPixels(X - 1, Y - 1, mCache, 0, 0, Width + 2, Height + 2);
                return;
            }

            mIsRealUpdate = false;

            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);

            #region fill rect
            {
                var colStops = new float[25];// xRGBA

                VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_LINEAR_GRADIENT);

                if (State == ButtonState.Released)
                {
                    colStops[0]  = 0.0f; colStops[1] = 0x2c / 255f; colStops[2] = 0x2d / 255f; colStops[3] = 0x2f / 255f; colStops[4] = 1.0f;
                    colStops[5]  = 0.20f; colStops[6] = 0x34 / 255f; colStops[7] = 0x35 / 255f; colStops[8] = 0x37 / 255f; colStops[9] = 1.0f;
                    colStops[10] = 0.80f; colStops[11] = 0x34 / 255f; colStops[12] = 0x35 / 255f; colStops[13] = 0x37 / 255f; colStops[14] = 1.0f;
                    colStops[15] = 1.0f; colStops[16] = 0x43 / 255f; colStops[17] = 0x43 / 255f; colStops[18] = 0x47 / 255f; colStops[19] = 1.0f;
                }
                else
                {
                    colStops[0]  = 0.0f; colStops[1] = 0x47 / 255f; colStops[2] = 0x49 / 255f; colStops[3] = 0x4d / 255f; colStops[4] = 1.0f;
                    colStops[5]  = 0.20f; colStops[6] = 0x2e / 255f; colStops[7] = 0x30 / 255f; colStops[8] = 0x32 / 255f; colStops[9] = 1.0f;
                    colStops[10] = 0.80f; colStops[11] = 0x2e / 255f; colStops[12] = 0x30 / 255f; colStops[13] = 0x32 / 255f; colStops[14] = 1.0f;
                    colStops[15] = 1.0f; colStops[16] = 0x16 / 255f; colStops[17] = 0x19 / 255f; colStops[18] = 0x19 / 255f; colStops[19] = 1.0f;
                }

                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y, X, Y + Height });
                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, 20, colStops);

                VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH);

                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound);
                VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);
                VG.vgFinish();
            }
            #endregion

            #region draw line
            {
                VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                var lineSize = 1.0f;

                if (State == ButtonState.Released)
                {
                    VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0x6b / 255f, 0x6c / 255f, 0x6c / 255f, 1.0f });
                }
                else
                {
                    lineSize = 3.0f;
                    VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4,
                                        IsLock()
                                            ? new[] { 0xd9 / 255f, 0x11 / 255f, 0x07 / 255f, 1.0f } // red
                                            : new[] { 0x31 / 255f, 0xa3 / 255f, 0x1f / 255f, 1.0f }); // freen
                }

                VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH);

                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, lineSize);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                VGU.vguRoundRect(mPath, X + (lineSize / 2f), Y + (lineSize / 2f), Width - lineSize, Height - lineSize, mRound, mRound);
                VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                VG.vgFinish();
            }
            #endregion


            base.Update();

            // copy render image to cache
            VG.vgGetPixels(mCache, 0, 0, X - 1, Y - 1, Width + 2, Height + 2);
        }
コード例 #14
0
        public override void Update()
        {
            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
            VG.vgLoadIdentity();

            #region fill rect
            {
                var colStops = new float[25];// xRGBA


                colStops[0] = 0.0f; colStops[1] = PressColor.R * 0.7f; colStops[2] = PressColor.G * 0.7f; colStops[3] = PressColor.B * 0.7f; colStops[4] = PressColor.A * 1.0f;
                colStops[5] = 0.2f; colStops[6] = PressColor.R * 1.0f; colStops[7] = PressColor.G * 1.0f; colStops[8] = PressColor.B * 1.0f; colStops[9] = PressColor.A * 1.0f;

                // Fill with linear gradient paint
                //VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_LINEAR_GRADIENT);
                //VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_RADIAL_GRADIENT);

                if (State == ButtonState.Pressed)
                {
                    //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, PressColor.Value);

                    colStops[1] = PressColor.R * 0.4f;
                    colStops[2] = PressColor.G * 0.4f;
                    colStops[3] = PressColor.B * 0.4f;
                    colStops[6] = PressColor.R * 0.7f;
                    colStops[7] = PressColor.G * 0.7f;
                    colStops[8] = PressColor.B * 0.7f;
                    VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y, X, Y + Height });
                    //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_RADIAL_GRADIENT, 5, new float[] { mX + mWidth / 2, mY,
                    //                                                                                             mX + mWidth / 2, mY + mHeight * 2,
                    //                                                                                             mWidth  });
                }
                else
                {
                    //VG.vgTranslate(3,-3);
                    //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, ReleaseColor.Value);

                    colStops[1] = PressColor.R * 0.7f;
                    colStops[2] = PressColor.G * 0.7f;
                    colStops[3] = PressColor.B * 0.7f;
                    colStops[6] = PressColor.R * 1.0f;
                    colStops[7] = PressColor.G * 1.0f;
                    colStops[8] = PressColor.B * 1.0f;
                    VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y, X, Y + Height });
                    //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_RADIAL_GRADIENT, 5, new float[] { mX + mWidth / 2, mY,
                    //                                                                                             mX + mWidth / 2, mY - mHeight * 2,
                    //                                                                                             mWidth  });
                }

                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, 10, colStops);

                VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH);

                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound);
                VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);
                VG.vgFinish();
            }
            #endregion

            #region draw line
            {
                VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 1.0f, 1.0f, 1.0f, 1.0f });
                VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH);

                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 3.0f);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound);
                VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                VG.vgFinish();
            }
            #endregion


            base.Update();
        }
コード例 #15
0
ファイル: PressureGraphic.cs プロジェクト: Mokarski/Vagonka
        public override void Draw()
        {
            if (!IsVisible)
            {
                return;
            }

            // draw bg
            if (Background != null)
            {
                VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, Background.Value);
                VG.vgClear(X, Y, Width, Height);
                VG.vgFinish();
            }

            if (Arrows != null)
            {
                Arrows.Update(X, Y);
            }


            VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f);
            VG.vgSetfv(VGParamType.VG_STROKE_DASH_PATTERN, 0, null);
            VG.vgSetParameterfv(mStrokePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(0x575959FF).Value);
            VG.vgSetPaint(mStrokePaint, VGPaintMode.VG_STROKE_PATH);

            switch (Type)
            {
            case VisializationType.Realtime:
            {
                //mApplication.DebugTimeToConsole("realtime");

                #region Realtime
                if (Grid != null)
                {
                    Grid.Update(X, Y);
                }

                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);


                // draw rectangles
                if (mGrapihcs.Count > 0)
                {
                    lock (mGrapihcs)
                        foreach (var data in from data in mGrapihcs where data != null where data.Data != null where data.Data.Length > 0 select data)
                        {
                            VG.vgLoadIdentity();
                            VG.vgTranslate(X + data.Position.X, Y + data.Position.Y);     // (40, 20)

                            var size = (data.Data.Length - 1) > (((uint)(kOxWidht)) - data.Position.X) ? (((uint)(kOxWidht)) - data.Position.X) : (data.Data.Length - 1);
                            for (var i = 0; i < size; i++)
                            {
                                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                                var maxY = data.Data[i] < 5 ? 5 : data.Data[i];     // минимальное значение - 5 единиц, чтобы было видно секции
                                maxY  = data.Data[i] == ushort.MaxValue ? 5 : maxY; // проверяем флаг на наличие датчика
                                maxY /= 2;

                                VGU.vguRect(mPath, i * (kOxWidht / 177f), 0, (kOxWidht / 177f), maxY);

                                var color = (data.Data[i] == ushort.MaxValue)
                                                    ? Palette.White
                                                    : new Color(GetColor(data.Data[i]));

                                VG.vgSetParameterfv(mFillPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, color.Value);
                                VG.vgSetPaint(mFillPaint, VGPaintMode.VG_FILL_PATH);
                                VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);

                                VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                            }
                        }
                }
                #endregion
            }
            break;

            case VisializationType.History:
            {
                if (HistoryReports != null)
                {
                    if (HistoryReports.Length > 0)
                    {
                        //Console.WriteLine("history: {0}", HistoryReports.Length);

                        VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                        VG.vgLoadIdentity();
                        VG.vgTranslate(X + 40, Y + 20);         // (40, 20)

                        foreach (var label in mVHistoryLabels)
                        {
                            label.Text = "";
                        }

                        var depth = 0;
                        for (var j = 0; j < HistoryReports.Length; j++)
                        {
                            var data = HistoryReports[j].Restore();

                            if (j % 5 == 0)
                            {
                                //Console.WriteLine("history: {0}", j);
                                var index = j / 5;
                                var date  = HistoryReports[j].Time;
                                mVHistoryLabels[2 * index].Text     = date.ToString("HH:mm");
                                mVHistoryLabels[2 * index + 1].Text = date.ToString("dd") + "/" + date.ToString("MM");
                            }

                            if (data != null)
                            {
                                var size = (data.Length - 1);

                                for (var i = 0; i < size; i++)
                                {
                                    if (data[i] == ushort.MaxValue)
                                    {
                                        continue;
                                    }

                                    VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                                    const int kRectHeight = 12;
                                    VGU.vguRect(mPath, i * (kOxWidht / 177f), depth * kRectHeight, (kOxWidht / 177f), kRectHeight);

                                    VG.vgSetParameterfv(mFillPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(GetColor(data[i])).Value);
                                    VG.vgSetPaint(mFillPaint, VGPaintMode.VG_FILL_PATH);
                                    VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);

                                    VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                                }
                            }
                            else
                            {
                                Console.WriteLine("oooops");
                            }

                            depth++;
                        }
                    }
                }
            }
            break;
            }


            //base.Update();
        }
コード例 #16
0
        public override void Update(GfxRect updateArea)
        {
            if (!IsVisible)
            {
                return;
            }

            if (OnPaint != null)
            {
                OnPaint(this);
            }

            //Console.WriteLine("->> {1}: to surface: {0}", Name, DateTime.Now.ToString("mm:ss.fff"));

            var position = ScreenPosition;

            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_IMAGE_USER_TO_SURFACE);

            VG.vgLoadIdentity();
            VG.vgTranslate(position.X, position.Y);

            switch (mFixState)
            {
            // отрисовка по текущему состоянию
            case null:
                if (State == ButtonState.Released)
                {
                    if (mNormal != null)
                    {
                        mNormal.Update();
                    }
                }
                else
                {
                    if (mActive != null)
                    {
                        mActive.Update();
                    }
                }
                break;

            // заблокировано в отжатом состоянии
            case ButtonState.Released:
                if (mNormal != null)
                {
                    mNormal.Update();
                }
                break;

            // заблокировано в нажатом состоянии
            default:
                if (mActive != null)
                {
                    mActive.Update();
                }
                break;
            }

            VG.vgFinish();

            //Console.WriteLine("<<- {1}: to surface: {0}", Name, DateTime.Now.ToString("mm:ss.fff"));

            foreach (var widget in mChilds.Where(widget => !(widget is ModalWindow)))
            {
                widget.Update();
            }
        }
コード例 #17
0
ファイル: InfoIcon.cs プロジェクト: Mokarski/Vagonka
        private void VguArc(IntPtr path, float x, float y, float width, float height, float startAngle, float angleExtent)
        {
            var commands   = new List <byte>();
            var parameters = new List <float>();

            var   dataArc = new float[5];
            float rx = width / 2, ry = height / 2;

            var last = startAngle + angleExtent;

            VG.vgClearPath(path, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);


            commands.Add((byte)VGPathCommand.VG_MOVE_TO_ABS);
            parameters.AddRange(new[] { x + Cos(startAngle) * rx, y + Sin(startAngle) * ry });

            dataArc[0] = rx;
            dataArc[1] = ry;
            dataArc[2] = 0.0f;

            if (angleExtent > 0)
            {
                var angle = startAngle + 180;
                while (angle < last)
                {
                    dataArc[3] = x + Cos(angle) * rx;
                    dataArc[4] = y + Sin(angle) * ry;
                    commands.Add((byte)VGPathCommand.VG_SCCWARC_TO_ABS);
                    parameters.AddRange(dataArc);

                    angle += 180.0f;
                }

                dataArc[3] = x + Cos(last) * rx;
                dataArc[4] = y + Sin(last) * ry;
                commands.Add((byte)VGPathCommand.VG_SCCWARC_TO_ABS);
                parameters.AddRange(dataArc);
            }
            else
            {
                var angle = startAngle - 180;
                while (angle > last)
                {
                    dataArc[3] = x + Cos(angle) * rx;
                    dataArc[4] = y + Sin(angle) * ry;
                    commands.Add((byte)VGPathCommand.VG_SCWARC_TO_ABS);
                    parameters.AddRange(dataArc);

                    angle -= 180.0f;
                }

                dataArc[3] = x + Cos(last) * rx;
                dataArc[4] = y + Sin(last) * ry;
                commands.Add((byte)VGPathCommand.VG_SCWARC_TO_ABS);
                parameters.AddRange(dataArc);
            }

            VG.vgAppendPathData(path, commands.Count, commands.ToArray(), parameters.ToArray());
            VG.vgDrawPath(path, VGPaintMode.VG_STROKE_PATH);
            VG.vgFinish();
        }
コード例 #18
0
        public override void Update()
        {
            if (Width == 0 || Height == 0)
            {
                return;
            }

            VG.vgLoadIdentity();
            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);

            #region draw line
            {
                VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);

                //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0xe0 / 255f, 0x8f / 255f, 0x1e / 255f, 1.0f });
                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0xef / 255f, 0xf0 / 255f, 0xf0 / 255f, 1.0f });
                var lineSize = 2.0f;

                VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH);
                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, lineSize);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                VGU.vguRoundRect(mPath, X + (lineSize / 2f), Y + (lineSize / 2f), Width - lineSize, Height - lineSize, mRound, mRound);
                VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                VG.vgFinish();
            }
            #endregion

            #region fill rect
            {
                var colStops = new float[25];// xRGBA

                VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_LINEAR_GRADIENT);


                colStops[0]  = 0.0f; colStops[1] = 0xe9 / 255f; colStops[2] = 0xae / 255f; colStops[3] = 0x5d / 255f; colStops[4] = 1.0f;
                colStops[5]  = 0.20f; colStops[6] = 0xe9 / 255f; colStops[7] = 0xae / 255f; colStops[8] = 0x5d / 255f; colStops[9] = 1.0f;
                colStops[10] = 0.80f; colStops[11] = 0xe0 / 255f; colStops[12] = 0x8f / 255f; colStops[13] = 0x1e / 255f; colStops[14] = 1.0f;
                colStops[15] = 1.0f; colStops[16] = 0xe0 / 255f; colStops[17] = 0x8f / 255f; colStops[18] = 0x1e / 255f; colStops[19] = 1.0f;


                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y + Height, X, Y });
                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, 20, colStops);

                VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH);

                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                var lineSize = 10.0f;
                VGU.vguRoundRect(mPath, X + Width - mParamWidth - lineSize, Y + (lineSize / 2f), mParamWidth + (lineSize / 2f), Height - lineSize, 5.0f, 5.0f);
                //VGU.vguRoundRect(mPath, X + Width - mParamWidth - lineSize, Y + (lineSize / 2f), mParamWidth + (lineSize / 2f), Height - lineSize, mRound, mRound);
                VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);
                VG.vgFinish();
            }
            #endregion

            base.Update();
        }
コード例 #19
0
        public override void Update()
        {
            if (!IsVisible)
            {
                return;
            }

            if (Width == 0 || Height == 0)
            {
                return;
            }

            if (!mIsRealUpdate)
            {
                // copy image from mCache
                VG.vgSetPixels(X, Y, mCache, 0, 0, Width, Height);
                return;
            }

            mIsRealUpdate = false;
            VG.vgLoadIdentity();
            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);

            #region draw line
            {
                VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);

                float lineSize;
                if (!mActivated)
                {
                    VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, ParentWindow.Background.Value);
                    lineSize = 10.0f;
                }
                else
                {
                    VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0xe0 / 255f, 0x8f / 255f, 0x1e / 255f, 1.0f });
                    lineSize = 2.0f;
                }


                VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH);

                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);


                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, lineSize);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                VGU.vguRoundRect(mPath, X + (lineSize / 2f), Y + (lineSize / 2f), Width - lineSize, Height - lineSize, mRound, mRound);
                VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                VG.vgFinish();
            }
            #endregion

            #region fill rect
            {
                var colStops = new float[25];// xRGBA

                VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_LINEAR_GRADIENT);

                if (!mActivated)
                {
                    colStops[0]  = 0.0f; colStops[1] = 0xb3 / 255f; colStops[2] = 0xb4 / 255f; colStops[3] = 0xb5 / 255f; colStops[4] = 1.0f;
                    colStops[5]  = 0.20f; colStops[6] = 0xb3 / 255f; colStops[7] = 0xb4 / 255f; colStops[8] = 0xb5 / 255f; colStops[9] = 1.0f;
                    colStops[10] = 0.80f; colStops[11] = 0x8a / 255f; colStops[12] = 0x8b / 255f; colStops[13] = 0x8c / 255f; colStops[14] = 1.0f;
                    colStops[15] = 1.0f; colStops[16] = 0x8a / 255f; colStops[17] = 0x8b / 255f; colStops[18] = 0x8c / 255f; colStops[19] = 1.0f;
                }
                else
                {
                    colStops[0]  = 0.0f; colStops[1] = 0xef / 255f; colStops[2] = 0xf0 / 255f; colStops[3] = 0xf0 / 255f; colStops[4] = 1.0f;
                    colStops[5]  = 0.20f; colStops[6] = 0xef / 255f; colStops[7] = 0xf0 / 255f; colStops[8] = 0xf0 / 255f; colStops[9] = 1.0f;
                    colStops[10] = 0.80f; colStops[11] = 0xb6 / 255f; colStops[12] = 0xb6 / 255f; colStops[13] = 0xb6 / 255f; colStops[14] = 1.0f;
                    colStops[15] = 1.0f; colStops[16] = 0xb6 / 255f; colStops[17] = 0xb6 / 255f; colStops[18] = 0xb6 / 255f; colStops[19] = 1.0f;
                }

                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y + Height, X, Y });
                VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, 20, colStops);

                VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH);

                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f);
                VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                var lineSize = 10.0f;
                VGU.vguRoundRect(mPath, X + (lineSize / 2f), Y + (lineSize / 2f), Width - lineSize, Height - lineSize, mRound, mRound);
                //VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound);
                VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);
                VG.vgFinish();
            }
            #endregion

            base.Update();

            // copy render image to cache
            VG.vgGetPixels(mCache, 0, 0, X, Y, Width, Height);
        }
コード例 #20
0
        protected override void Draw()
        {
            if (!IsVisible)
            {
                return;
            }

            VG.vgLoadIdentity();
            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);

            var position = ScreenPosition;

            VG.vgTranslate(position.X, position.Y);

            //VG.vgRotate(mRotate);
            //Status.Rotate(mRotate);

            #region draw percent
            if (mPercent > 0)
            {
                VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
                VGU.vguRoundRect(mPath, 0, 0, Width, Height, mRound, mRound);

                // draw percent line
                if (PercentLine != null)
                {
                    PercentLine.SetPaint(VGPaintMode.VG_FILL_PATH);
                }

                VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);
                VG.vgFinish();
            }
            #endregion

            #region draw background
            VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
            //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, RootWindow.Background.Value);
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0.0f, 0.0f, 0.0f, 1.0f });
            VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH);

            var percentWidth = (Width * Percent) / 100f;
            VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            VGU.vguRect(mPath, percentWidth, 0, Width - percentWidth, Height);
            VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH);
            VG.vgFinish();
            #endregion

            #region draw line
            {
                if (Border != null)
                {
                    Border.SetPaint(VGPaintMode.VG_STROKE_PATH);

                    VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, kLineSize);
                    VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                    VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                    VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
                    //VGU.vguRoundRect(mPath, kLineSize / 2f, kLineSize / 2f, Width - kLineSize, Height - kLineSize, mRound, mRound);
                    VGU.vguRoundRect(mPath, 0, 0, Width, Height, mRound, mRound);
                    VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH);
                    VG.vgFinish();
                }
            }
            #endregion

            //base.Update();
            VG.vgFinish();
        }