protected unsafe override void OnResize(EventArgs e) { base.OnResize(e); this._performNeeded = true; Rectangle clientRectangle = base.ClientRectangle; if (clientRectangle.Width > 60) { clientRectangle = base.ClientRectangle; if (clientRectangle.Height > 60) { Bitmap buffer = this._buffer; clientRectangle = base.ClientRectangle; int width = clientRectangle.Width; clientRectangle = base.ClientRectangle; this._buffer = new Bitmap(width, clientRectangle.Height, PixelFormat.Format32bppPArgb); Bitmap buffer2 = this._buffer2; clientRectangle = base.ClientRectangle; int width2 = clientRectangle.Width; clientRectangle = base.ClientRectangle; this._buffer2 = new Bitmap(width2, clientRectangle.Height, PixelFormat.Format32bppPArgb); int num = this._buffer.Width - 60; float[] smoothedSpectrum = this._smoothedSpectrum; this._scaledSpectrum = new byte[num]; this._smoothedSpectrum = new float[num]; this._temp = new float[num]; float[] array = smoothedSpectrum; fixed(float *powerSpectrum = array) { this.ExtractSpectrum(powerSpectrum, smoothedSpectrum.Length, 0f, 1f, false); } this._graphics.Dispose(); this._graphics = Graphics.FromImage(this._buffer); SpectrumAnalyzer.ConfigureGraphics(this._graphics, false); this._graphics2.Dispose(); this._graphics2 = Graphics.FromImage(this._buffer2); SpectrumAnalyzer.ConfigureGraphics(this._graphics2, false); this._graphics.Clear(Color.Black); Rectangle destRect = new Rectangle(30, 0, this._buffer.Width - 60, buffer.Height); this._graphics.DrawImage(buffer, destRect, 30, 0, buffer.Width - 60, buffer.Height, GraphicsUnit.Pixel); buffer.Dispose(); buffer2.Dispose(); if (this._spectrumWidth > 0) { this._xIncrement = this._scale * (float)(this._buffer.Width - 60) / (float)this._spectrumWidth; } this._gradientBrush.Dispose(); this._gradientBrush = new LinearGradientBrush(new RectangleF(15f, 15f, (float)base.Width - 15f, (float)this._buffer.Height - 15f), Color.White, Color.Black, LinearGradientMode.Vertical); this._gradientBrush.InterpolationColors = this._gradientColorBlend; this.Perform(true); } } }
protected override void OnResize(EventArgs e) { base.OnResize(e); if (ClientRectangle.Width <= AxisMargin || ClientRectangle.Height <= AxisMargin) { return; } var temp = new byte[ClientRectangle.Width - 2 * AxisMargin]; Fourier.SmoothCopy(_powerSpectrum, temp, _powerSpectrum.Length, (_temp.Length + temp.Length) / (float)_temp.Length, 0); _powerSpectrum = temp; _temp = new byte[_powerSpectrum.Length]; var oldBuffer = _buffer; _buffer = new Bitmap(ClientRectangle.Width, ClientRectangle.Height, PixelFormat.Format32bppPArgb); var oldBuffer2 = _buffer2; _buffer2 = new Bitmap(ClientRectangle.Width, ClientRectangle.Height, PixelFormat.Format32bppPArgb); _graphics.Dispose(); _graphics = Graphics.FromImage(_buffer); SpectrumAnalyzer.ConfigureGraphics(_graphics); _graphics2.Dispose(); _graphics2 = Graphics.FromImage(_buffer2); SpectrumAnalyzer.ConfigureGraphics(_graphics2); _graphics.Clear(Color.Black); var rect = new Rectangle(AxisMargin, 0, _buffer.Width - 2 * AxisMargin, _buffer.Height); _graphics.DrawImage(oldBuffer, rect, AxisMargin, 0, oldBuffer.Width - 2 * AxisMargin, oldBuffer.Height, GraphicsUnit.Pixel); oldBuffer.Dispose(); oldBuffer2.Dispose(); if (_spectrumWidth > 0) { _xIncrement = _scale * (ClientRectangle.Width - 2 * AxisMargin) / _spectrumWidth; } _gradientBrush.Dispose(); _gradientBrush = new LinearGradientBrush(new Rectangle(AxisMargin / 2, AxisMargin / 2, Width - AxisMargin / 2, ClientRectangle.Height - AxisMargin / 2), Color.White, Color.Black, LinearGradientMode.Vertical); _gradientPixels = null; _gradientBrush.InterpolationColors = _gradientColorBlend; DrawGradient(); BuildGradientVector(); _performNeeded = true; var oldMouseIn = _mouseIn; _mouseIn = true; Perform(); _mouseIn = oldMouseIn; }
protected override void OnPaint(PaintEventArgs e) { Rectangle clientRectangle = base.ClientRectangle; if (clientRectangle.Width > 60) { clientRectangle = base.ClientRectangle; if (clientRectangle.Height <= 60) { goto IL_0024; } SpectrumAnalyzer.ConfigureGraphics(e.Graphics, false); e.Graphics.DrawImageUnscaled(this._buffer2, 0, 0); return; } goto IL_0024; IL_0024: e.Graphics.Clear(Color.Black); }
protected override void OnPaint(PaintEventArgs e) { SpectrumAnalyzer.ConfigureGraphics(e.Graphics); e.Graphics.DrawImageUnscaled(_mouseIn ? _buffer2 : _buffer, 0, 0); }