Пример #1
0
 public void Dispose()
 {
     if (mPaint != new IntPtr())
     {
         VG.vgDestroyPaint(mPaint);
     }
 }
Пример #2
0
        public override void Dispose()
        {
            if (mPaint != new IntPtr())
            {
                VG.vgDestroyPaint(mPaint);
            }

            base.Dispose();
        }
Пример #3
0
        public override void Dispose()
        {
            if (mPath != new IntPtr())
            {
                VG.vgDestroyPath(mPath);
            }

            if (mPaint != new IntPtr())
            {
                VG.vgDestroyPaint(mPaint);
            }
        }
Пример #4
0
        public override void Dispose()
        {
            if (mPath != IntPtr.Zero)
            {
                VG.vgDestroyPath(mPath);
            }

            if (mPaint != IntPtr.Zero)
            {
                VG.vgDestroyPaint(mPaint);
            }

            base.Dispose();
        }
Пример #5
0
        public override void Dispose()
        {
            if (Status != null)
            {
                Status.Dispose();
            }

            if (mPath != new IntPtr())
            {
                VG.vgDestroyPath(mPath);
            }

            if (mPaint != new IntPtr())
            {
                VG.vgDestroyPaint(mPaint);
            }

            base.Dispose();
        }
Пример #6
0
        public override void Update()
        {
            // render table
            {
                VG.vgSeti(VGParamType.VG_BLEND_MODE, (int)VGBlendMode.VG_BLEND_SRC_OVER);
                VG.vgSeti(VGParamType.VG_FILL_RULE, (int)VGFillRule.VG_NON_ZERO);
                VG.vgSetfv(VGParamType.VG_STROKE_DASH_PATTERN, 0, null);

                // create some paths
                var path0 = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                // create and set a paint for fill
                var fillPaint   = VG.vgCreatePaint();
                var strokePaint = VG.vgCreatePaint();

                // set model view matrix
                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                VG.vgLoadIdentity();

                #region draw border
                if (Border)
                {
                    VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 5.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);

                    VG.vgSetParameteri(strokePaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                    const float kGreyColor = 192f / 256f;
                    VG.vgSetParameterfv(strokePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { kGreyColor, kGreyColor, kGreyColor, 1.0f });
                    VG.vgSetPaint(strokePaint, VGPaintMode.VG_STROKE_PATH);

                    var tableLenght = 0;
                    for (var i = 0; i < mLenghtX.Length; i++)
                    {
                        tableLenght += mLenghtX[i];
                    }


                    VGU.vguRect(path0, (mX - 2.5f), (mY - 2.5f), tableLenght + 5, GetLenght(mLenghtY.Length, mLenghtY) + 5.0f);
                    VG.vgDrawPath(path0, VGPaintMode.VG_STROKE_PATH);
                }
                #endregion

                #region fill cells
                if (CellFill)
                {
                    for (var i = 0; i < mLenghtX.Length; i++)
                    {
                        for (var j = 0; j < mLenghtY.Length; j++)
                        {
                            VG.vgSetParameteri(fillPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                            VG.vgSetParameterfv(fillPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, CellColors[i, j].Value);
                            VG.vgSetPaint(fillPaint, VGPaintMode.VG_FILL_PATH);

                            VG.vgClearPath(path0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
                            VGU.vguRect(path0, mX + GetLenght(i, mLenghtX), mY + GetLenght(j, mLenghtY), mLenghtX[i], mLenghtY[j]);
                            VG.vgDrawPath(path0, VGPaintMode.VG_FILL_PATH);
                        }
                    }
                }
                #endregion

                #region draw cells borders
                if (CellBorder)
                {
                    VG.vgSetParameteri(strokePaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                    VG.vgSetParameterfv(strokePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0.0f, 0.0f, 0.0f, 1.0f });
                    VG.vgSetPaint(strokePaint, VGPaintMode.VG_STROKE_PATH);

                    VG.vgClearPath(path0, 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);


                    for (var i = 0; i < mLenghtX.Length; i++)
                    {
                        for (var j = 0; j < mLenghtY.Length; j++)
                        {
                            VGU.vguRect(path0, mX + GetLenght(i, mLenghtX), mY + GetLenght(j, mLenghtY), mLenghtX[i], mLenghtY[j]);
                        }
                    }

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

                VG.vgDestroyPath(path0);
                VG.vgDestroyPaint(strokePaint);
            }

            base.Update();
        }