Esempio n. 1
0
        public async Task Clear()
        {
            var bitmap  = default(WriteableBitmap);
            var success = default(bool);
            var info    = default(BitmapHelper.RenderInfo);

            await Windows.Invoke(() =>
            {
                bitmap  = this.Bitmap;
                success = bitmap.TryLock(LockTimeout);
                if (!success)
                {
                    return;
                }
                info = BitmapHelper.CreateRenderInfo(bitmap, Colors.Transparent);
            }).ConfigureAwait(false);

            BitmapHelper.Clear(info);

            await Windows.Invoke(() =>
            {
                bitmap.AddDirtyRect(new Int32Rect(0, 0, bitmap.PixelWidth, bitmap.PixelHeight));
                bitmap.Unlock();
            }).ConfigureAwait(false);
        }
Esempio n. 2
0
        private static void Render(BitmapHelper.RenderInfo info, SpectrumRendererData rendererData)
        {
            var elements = rendererData.Elements;
            var peaks    = rendererData.Peaks;

            BitmapHelper.Clear(info);

            for (var a = 0; a < rendererData.Count; a++)
            {
                BitmapHelper.DrawRectangle(
                    info,
                    elements[a].X,
                    elements[a].Y,
                    elements[a].Width,
                    elements[a].Height
                    );
                if (peaks != null)
                {
                    if (peaks[a].Y >= elements[a].Y)
                    {
                        continue;
                    }
                    BitmapHelper.DrawRectangle(
                        info,
                        peaks[a].X,
                        peaks[a].Y,
                        peaks[a].Width,
                        peaks[a].Height
                        );
                }
            }
        }
Esempio n. 3
0
 protected virtual Task Clear()
 {
     return(Windows.Invoke(() =>
     {
         if (!this.Bitmap.TryLock(LockTimeout))
         {
             return;
         }
         BitmapHelper.Clear(BitmapHelper.CreateRenderInfo(this.Bitmap, this.Color));
         this.Bitmap.AddDirtyRect(new Int32Rect(0, 0, this.Bitmap.PixelWidth, this.Bitmap.PixelHeight));
         this.Bitmap.Unlock();
     }));
 }
Esempio n. 4
0
        public static void Render(WaveFormRendererData rendererData, BitmapHelper.RenderInfo waveRenderInfo, BitmapHelper.RenderInfo powerRenderInfo, bool rms, WaveFormRendererMode mode)
        {
            BitmapHelper.Clear(waveRenderInfo);
            switch (mode)
            {
            case WaveFormRendererMode.Mono:
                RenderMono(rendererData, waveRenderInfo, powerRenderInfo, rms);
                break;

            case WaveFormRendererMode.Seperate:
                RenderSeperate(rendererData, waveRenderInfo, powerRenderInfo, rms);
                break;

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 5
0
        private static void Render(BitmapHelper.RenderInfo info, OscilloscopeRendererData data)
        {
            BitmapHelper.Clear(info);

            if (data.Elements != null)
            {
                switch (data.Mode)
                {
                default:
                case OscilloscopeRendererMode.Mono:
                    RenderMono(info, data.Elements, data.Width);
                    break;

                case OscilloscopeRendererMode.Seperate:
                    RenderSeperate(info, data.Elements, data.Channels, data.Width);
                    break;
                }
            }
        }
Esempio n. 6
0
        private static void Render(BitmapHelper.RenderInfo valueRenderInfo, BitmapHelper.RenderInfo rmsRenderInfo, PeakRendererData rendererData)
        {
            var valueElements = rendererData.ValueElements;
            var rmsElements   = rendererData.RmsElements;
            var peakElements  = rendererData.PeakElements;
            var orientation   = rendererData.Orientation;

            BitmapHelper.Clear(valueRenderInfo);

            if (valueElements != null)
            {
                for (var a = 0; a < valueElements.Length; a++)
                {
                    BitmapHelper.DrawRectangle(
                        valueRenderInfo,
                        valueElements[a].X,
                        valueElements[a].Y,
                        valueElements[a].Width,
                        valueElements[a].Height
                        );
                    if (rmsElements != null)
                    {
                        if (rmsElements[a].Height > 0)
                        {
                            BitmapHelper.DrawRectangle(
                                rmsRenderInfo,
                                rmsElements[a].X,
                                rmsElements[a].Y,
                                rmsElements[a].Width,
                                rmsElements[a].Height
                                );
                        }
                    }
                    if (peakElements != null)
                    {
                        if (orientation == Orientation.Horizontal)
                        {
                            if (peakElements[a].X > valueElements[a].Width)
                            {
                                BitmapHelper.DrawRectangle(
                                    valueRenderInfo,
                                    peakElements[a].X,
                                    peakElements[a].Y,
                                    peakElements[a].Width,
                                    peakElements[a].Height
                                    );
                            }
                        }
                        else if (orientation == Orientation.Vertical)
                        {
                            if (peakElements[a].Y < valueElements[a].Y)
                            {
                                BitmapHelper.DrawRectangle(
                                    valueRenderInfo,
                                    peakElements[a].X,
                                    peakElements[a].Y,
                                    peakElements[a].Width,
                                    peakElements[a].Height
                                    );
                            }
                        }
                    }
                }
            }
        }
        private static void Render(BitmapHelper.RenderInfo valueRenderInfo, BitmapHelper.RenderInfo rmsRenderInfo, BitmapHelper.RenderInfo crestRenderInfo, SpectrumRendererData rendererData)
        {
            var valueElements = rendererData.ValueElements;
            var rmsElements   = rendererData.RmsElements;
            var crestPoints   = rendererData.CrestPoints;
            var peakElements  = rendererData.PeakElements;

            BitmapHelper.Clear(valueRenderInfo);

            for (var a = 0; a < valueElements.Length; a++)
            {
                BitmapHelper.DrawRectangle(
                    valueRenderInfo,
                    valueElements[a].X,
                    valueElements[a].Y,
                    valueElements[a].Width,
                    valueElements[a].Height
                    );
                if (rmsElements != null)
                {
                    if (rmsElements[a].Height > 0)
                    {
                        BitmapHelper.DrawRectangle(
                            rmsRenderInfo,
                            rmsElements[a].X,
                            rmsElements[a].Y,
                            rmsElements[a].Width,
                            rmsElements[a].Height
                            );
                    }
                }
                if (peakElements != null)
                {
                    if (peakElements[a].Y < valueElements[a].Y)
                    {
                        BitmapHelper.DrawRectangle(
                            valueRenderInfo,
                            peakElements[a].X,
                            peakElements[a].Y,
                            peakElements[a].Width,
                            peakElements[a].Height
                            );
                    }
                }
            }

            if (crestPoints != null)
            {
                for (var a = 0; a < crestPoints.Length - 1; a++)
                {
                    var point1 = crestPoints[a];
                    var point2 = crestPoints[a + 1];
                    BitmapHelper.DrawLine(
                        crestRenderInfo,
                        point1.X,
                        point1.Y,
                        point2.X,
                        point2.Y
                        );
                }
            }
        }