private void DrawCircle(Graphics g, float[] heights)
        {
            List <PointF> points = GetCircularPoints(heights, 1.0f, g);

            Pen p = new Pen(Settings.GetColor("Color"), 2.0f);

            g.DrawPolygon(p, points.ToArray());
        }
Ejemplo n.º 2
0
        private void DrawOutline(Graphics g, float[] heights)
        {
            List <PointF> points = GetCircularPoints(heights, 3.0f, g, 200f);

            PathGradientBrush b = new PathGradientBrush(points.ToArray());

            b.CenterColor    = Settings.GetColor("Inner Shadow");
            b.SurroundColors = new Color[] { Settings.GetColor("Outer Shadow") };

            g.FillPolygon(b, points.ToArray());
        }
Ejemplo n.º 3
0
        public override void Render(Graphics g, float[] heights)
        {
            List <PointF> points = new List <PointF>();

            for (int i = 0; i < heights.Length; i++)
            {
                float height = Smooth(heights, i, Settings.Smoothing);

                points.Add(new PointF(i / (float)heights.Length * g.VisibleClipBounds.Width * Settings.XScale, (float)(g.VisibleClipBounds.Size.Height / 2 - height * Settings.YScale)));

                if (i / (float)heights.Length * g.VisibleClipBounds.Width * Settings.XScale > g.VisibleClipBounds.Width)
                {
                    break;
                }
            }

            Pen p = new Pen(Settings.GetColor("Color"), 2.0f);

            g.DrawLines(p, points.ToArray());
        }
Ejemplo n.º 4
0
        public override void Render(Graphics g, float[] samples)
        {
            float[] heights = FFT.SampleToFreq(samples, Settings.SampleCount);
            GetLastIndex(heights);
            List <PointF> points = new List <PointF>();

            points.Add(new PointF(0, g.VisibleClipBounds.Height / 2));

            for (int i = 0; i < lastIndex; i++)
            {
                float height = Smooth(heights, i, Settings.Smoothing);
                float x      = i / (float)heights.Length * g.VisibleClipBounds.Width * Settings.XScale;
                float y      = (float)(g.VisibleClipBounds.Height / 2 - height * Settings.YScale * ((i % 2) * 2 - 1));

                points.Add(new PointF(x, y));
            }

            points.Add(new PointF(g.VisibleClipBounds.Width, g.VisibleClipBounds.Height / 2));

            Pen p = new Pen(Settings.GetColor("Color"), 2.0f);

            g.DrawLines(p, points.ToArray());
        }
        public override void Render(Graphics g, float[] samples)
        {
            float[] heights = FFT.SampleToFreq(samples, Settings.SampleCount);
            GetLastIndex(heights);

            float minX = g.VisibleClipBounds.Width;
            float maxX = 0;

            List <PointF> points = new List <PointF>();
            int           i;

            for (i = 0; i < lastIndex; i++)
            {
                double angle = (double)i / heights.Length * Math.PI * Settings.XScale;

                float height = Smooth(heights, i, Settings.Smoothing);

                double x = Math.Cos(angle - Math.PI / 2) * (height * Settings.YScale + 100) + g.VisibleClipBounds.Width / 2;
                double y = Math.Sin(angle - Math.PI / 2) * (height * Settings.YScale + 100) + g.VisibleClipBounds.Height / 2;
                points.Add(new PointF((float)x, (float)y));

                minX = (float)Math.Min(minX, x);
                maxX = (float)Math.Max(maxX, x);
            }
            i--;
            for (  ; i > 0; i--)
            {
                double angle = (double)-i / heights.Length * Math.PI * Settings.XScale;

                float height = Smooth(heights, i, Settings.Smoothing);

                double x = Math.Cos(angle - Math.PI / 2) * (height * Settings.YScale + 100) + g.VisibleClipBounds.Width / 2;
                double y = Math.Sin(angle - Math.PI / 2) * (height * Settings.YScale + 100) + g.VisibleClipBounds.Height / 2;
                points.Add(new PointF((float)x, (float)y));

                minX = (float)Math.Min(minX, x);
                maxX = (float)Math.Max(maxX, x);
            }

            LinearGradientBrush b = new LinearGradientBrush(new PointF(minX, 0), new PointF(maxX, 0), Settings.GetColor("Left"), Settings.GetColor("Right"));

            g.FillPolygon(b, points.ToArray());
        }
Ejemplo n.º 6
0
        public override void Render(Graphics g, float[] samples)
        {
            float[] heights = FFT.SampleToFreq(samples, Settings.SampleCount);

            List <PointF> points          = new List <PointF>();
            List <PointF> pointsReflected = new List <PointF>();

            points.Add(new PointF(0, g.VisibleClipBounds.Height / 2));
            pointsReflected.Add(new PointF(0, g.VisibleClipBounds.Height / 2));

            for (int i = 0; i < heights.Length; i++)
            {
                float height = Smooth(heights, i, Settings.Smoothing);

                points.Add(new PointF(i / (float)heights.Length * g.VisibleClipBounds.Width * Settings.XScale, (float)(g.VisibleClipBounds.Height / 2 - height * Settings.YScale)));
                pointsReflected.Add(new PointF(i / (float)heights.Length * g.VisibleClipBounds.Width * Settings.XScale, (float)(g.VisibleClipBounds.Height / 2 + height * Settings.YScale)));


                if (i / (float)heights.Length * g.VisibleClipBounds.Width * Settings.XScale > g.VisibleClipBounds.Width)
                {
                    break;
                }
            }

            points.Add(new PointF(g.VisibleClipBounds.Width, g.VisibleClipBounds.Height / 2));
            pointsReflected.Add(new PointF(g.VisibleClipBounds.Width, g.VisibleClipBounds.Height / 2));

            LinearGradientBrush b = new LinearGradientBrush(new PointF(0, 0), new PointF(g.VisibleClipBounds.Width, 0), Settings.GetColor("Left"), Settings.GetColor("Right"));

            List <PointF> totalShape = new List <PointF>();

            totalShape.AddRange(points);
            totalShape.AddRange(pointsReflected);

            g.FillPolygon(b, totalShape.ToArray());

            //Draw top

            b          = new LinearGradientBrush(new PointF(0, 0), new PointF(0, g.VisibleClipBounds.Height / 2 + 5), Settings.GetColor("Top"), Color.FromArgb(0, Settings.GetColor("Top")));
            b.WrapMode = WrapMode.TileFlipY;

            g.FillPolygon(b, points.ToArray());

            //Draw bottom

            b          = new LinearGradientBrush(new PointF(0, g.VisibleClipBounds.Height / 2 - 1), new PointF(0, g.VisibleClipBounds.Height), Color.FromArgb(0, Settings.GetColor("Bottom")), Settings.GetColor("Bottom"));
            b.WrapMode = WrapMode.TileFlipY;

            g.FillPolygon(b, pointsReflected.ToArray());
        }
Ejemplo n.º 7
0
        private void DrawCircle(Graphics g, float[] heights)
        {
            List <PointF> points = GetCircularPoints(heights, 1.0f, g);

            g.FillPolygon(new SolidBrush(Settings.GetColor("Center")), points.ToArray());
        }
Ejemplo n.º 8
0
        public override void Render(Graphics g, float[] samples)
        {
            float[] heights = FFT.SampleToFreq(samples, Settings.SampleCount);

            List <PointF> points = new List <PointF>();

            points.Add(new PointF(0, g.VisibleClipBounds.Height));

            for (int i = 0; i < heights.Length; i++)
            {
                float height = Smooth(heights, i, Settings.Smoothing);
                points.Add(new PointF(i / (float)heights.Length * g.VisibleClipBounds.Width * Settings.XScale, (float)(g.VisibleClipBounds.Height - 20.0f - height * Settings.YScale)));

                if (i / (float)heights.Length * g.VisibleClipBounds.Width * Settings.XScale > g.VisibleClipBounds.Width)
                {
                    break;
                }
            }

            points.Add(new PointF(g.VisibleClipBounds.Width, g.VisibleClipBounds.Height));

            LinearGradientBrush b = new LinearGradientBrush(new PointF(0, 0), new PointF(g.VisibleClipBounds.Width, 0), Settings.GetColor("Left"), Settings.GetColor("Right"));

            g.FillPolygon(b, points.ToArray());

            b = new LinearGradientBrush(new PointF(0, 0), new PointF(0, g.VisibleClipBounds.Height), Settings.GetColor("Top"), Color.FromArgb(0, Settings.GetColor("Top")));

            g.FillPolygon(b, points.ToArray());
        }