Exemple #1
0
        public override void Dispose()
        {
            if (mPath != new IntPtr())
            {
                VG.vgDestroyPath(mPath);
            }

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

            if (mCache != new IntPtr())
            {
                VG.vgDestroyImage(mCache);
            }
        }
Exemple #2
0
        public override void Update()
        {
            VG.vgSeti(VGParamType.VG_IMAGE_MODE, (int)VGImageMode.VG_DRAW_IMAGE_NORMAL);
            VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_IMAGE_USER_TO_SURFACE);

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

            // draw bg
            int width, height;
            var image = CopyImageToVgBuffer(File.ReadAllBytes(Path.Combine(mRootImageDirUrl, @"generic/progressbar/bg.raw")), out width, out height);

            VG.vgDrawImage(image);
            VG.vgDestroyImage(image);

            // draw left border
            if (Percent > 0)
            {
                image = CopyImageToVgBuffer(File.ReadAllBytes(Path.Combine(mRootImageDirUrl, @"generic/progressbar/left.raw")), out width, out height);
                VG.vgDrawImage(image);
                VG.vgDestroyImage(image);
            }

            // draw right border
            VG.vgTranslate(300, 0);
            if (Percent == 100)
            {
                image = CopyImageToVgBuffer(File.ReadAllBytes(Path.Combine(mRootImageDirUrl, @"generic/progressbar/right.raw")), out width, out height);
                VG.vgDrawImage(image);
                VG.vgDestroyImage(image);
            }

            if (Percent > 0)
            {
                VG.vgTranslate(-293, 1);
                VG.vgScale(1.465f * Percent, 1.0f);
                image = CopyImageToVgBuffer(File.ReadAllBytes(Path.Combine(mRootImageDirUrl, @"generic/progressbar/1.raw")), out width, out height);
                VG.vgDrawImage(image);
                VG.vgDestroyImage(image);
            }

            mTextArea.Update();
        }