Ejemplo n.º 1
0
        private void DrawSlider(float pos, float x, float y, float w, float h)
        {
            float cy = y + (int)(h * 0.5f);
            float kr = (int)(h * 0.25f);

            _nvg.Save();

            Paint bg = _nvg.BoxGradient(x, cy - 2.0f + 1.0f, w, 4.0f, 2.0f, 2.0f, _nvg.Rgba(0, 0, 0, 32), _nvg.Rgba(0, 0, 0, 128));

            _nvg.BeginPath();
            _nvg.RoundedRect(x, cy - 2.0f, w, 4.0f, 2.0f);
            _nvg.FillPaint(bg);
            _nvg.Fill();

            bg = _nvg.RadialGradient(x + (int)(pos * w), cy + 1.0f, kr - 3.0f, kr + 3.0f, _nvg.Rgba(0, 0, 0, 64), _nvg.Rgba(0, 0, 0, 0));
            _nvg.BeginPath();
            _nvg.Rect(x + (int)(pos * w) - kr - 5, cy - kr - 5, kr * 2.0f + 5.0f + 5.0f, kr * 2.0f + 5.0f + 5.0f + 3.0f);
            _nvg.Circle(x + (int)(pos * w), cy, kr);
            _nvg.PathWinding(Solidity.Hole);
            _nvg.FillPaint(bg);
            _nvg.Fill();

            Paint knob = Paint.LinearGradient(x, cy - kr, x, cy + kr, _nvg.Rgba(255, 255, 255, 16), _nvg.Rgba(0, 0, 0, 16));

            _nvg.BeginPath();
            _nvg.Circle(x + (int)(pos * w), cy, kr - 1.0f);
            _nvg.FillColour(_nvg.Rgba(40, 43, 48, 255));
            _nvg.Fill();
            _nvg.FillPaint(knob);
            _nvg.Fill();

            _nvg.BeginPath();
            _nvg.Circle(x + (int)(pos * w), cy, kr - 0.5f);
            _nvg.StrokeColour(_nvg.Rgba(0, 0, 0, 92));
            _nvg.Stroke();

            _nvg.Restore();
        }