Exemple #1
0
        protected override IRenderer CreateRenderGraph()
        {
            // define renderers
            var renderers = GetRenderers(_config);

            renderers.ForEach(renderer => {
                (renderer as IRgb24Destination)?.SetPalette(new[] {
                    Color.FromRgb(0x0, 0x0, 0xff),
                    Color.FromRgb(0xff, 0x0, 0x0),
                });
            });

            // retrieve image
            var bmp = new BitmapImage();

            bmp.BeginInit();
            bmp.UriSource = new Uri("pack://application:,,,/dmdext;component/Test/TestImage.png");
            bmp.EndInit();

            // chain them up
            if (_config.VirtualAlphaNumericDisplay.Enabled)
            {
                var alphaNumericFrame = new AlphaNumericFrame(NumericalLayout.__2x20Alpha,
                                                              new ushort[] {
                    0, 10767, 2167, 8719, 0, 2109, 8713, 6259, 56, 2157, 0, 4957, 0, 8719, 62, 8719, 121, 2157, 0,
                    0, 0, 0, 5120, 8704, 16640, 0, 0, 0, 0, 2112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                });
                _graph = new RenderGraph {
                    Source           = new VpmAlphaNumericSource(alphaNumericFrame),
                    Destinations     = renderers,
                    Resize           = _config.Global.Resize,
                    FlipHorizontally = _config.Global.FlipHorizontally,
                    FlipVertically   = _config.Global.FlipVertically
                };
            }
            else
            {
                _graph = new RenderGraph {
                    Source           = new ImageSource(bmp),
                    Destinations     = renderers,
                    Resize           = _config.Global.Resize,
                    FlipHorizontally = _config.Global.FlipHorizontally,
                    FlipVertically   = _config.Global.FlipVertically
                };
            }

            return(_graph);
        }
Exemple #2
0
        protected override void CreateRenderGraphs(RenderGraphCollection graphs)
        {
            // define renderers
            var renderers = GetRenderers(_config);

            // retrieve image
            var bmp = new BitmapImage();

            bmp.BeginInit();
            bmp.UriSource = new Uri("pack://application:,,,/dmdext;component/Test/TestImage.png");
            bmp.EndInit();

            // chain them up
            if (_config.VirtualAlphaNumericDisplay.Enabled)
            {
                var alphaNumericFrame = new AlphaNumericFrame(NumericalLayout.__2x20Alpha,
                                                              new ushort[] {
                    0, 10767, 2167, 8719, 0, 2109, 8713, 6259, 56, 2157, 0, 4957, 0, 8719, 62, 8719, 121, 2157, 0,
                    0, 0, 0, 5120, 8704, 16640, 0, 0, 0, 0, 2112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                });
                _graph = new RenderGraph {
                    Source           = new VpmAlphaNumericSource(alphaNumericFrame),
                    Destinations     = renderers,
                    Resize           = _config.Global.Resize,
                    FlipHorizontally = _config.Global.FlipHorizontally,
                    FlipVertically   = _config.Global.FlipVertically
                };
            }
            else
            {
                ISource source;
                switch (_testOptions.FrameFormat)
                {
                case FrameFormat.Gray2:
                    source = new ImageSourceGray2(bmp);
                    break;

                case FrameFormat.Gray4:
                    source = new ImageSourceGray4(bmp);
                    break;

                case FrameFormat.ColoredGray2:
                    source = new ImageSourceColoredGray2(bmp);
                    break;

                case FrameFormat.ColoredGray4:
                    source = new ImageSourceColoredGray4(bmp);
                    break;

                default:
                    source = new ImageSourceBitmap(bmp);
                    break;
                }
                _graph = new RenderGraph {
                    Source           = source,
                    Destinations     = renderers,
                    Resize           = _config.Global.Resize,
                    FlipHorizontally = _config.Global.FlipHorizontally,
                    FlipVertically   = _config.Global.FlipVertically
                };
            }

            graphs.Add(_graph);
        }
Exemple #3
0
 public void NextFrame(AlphaNumericFrame frame)
 {
     _framesAlphaNumeric.OnNext(frame);
     _lastFrameFormat.OnNext(FrameFormat.AlphaNumeric);
 }
Exemple #4
0
 public VpmAlphaNumericSource(AlphaNumericFrame initialFrame)
 {
     _framesAlphaNumeric = new BehaviorSubject <AlphaNumericFrame>(initialFrame);
 }
Exemple #5
0
        public void RenderAlphaNumeric(AlphaNumericFrame frame)
        {
            if (_currentLayout == NumericalLayout.None || _currentLayout != frame.SegmentLayout)
            {
                ShowDisplays(frame.SegmentLayout);
                _currentLayout = frame.SegmentLayout;
            }
            Logger.Info("New frame type {0}", frame.SegmentLayout);

            switch (frame.SegmentLayout)
            {
            case NumericalLayout.__2x16Alpha:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 16).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 16, 16).ToArray());
                break;

            case NumericalLayout.__2x20Alpha:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 20).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 20, 20).ToArray());
                break;

            case NumericalLayout.__2x7Alpha_2x7Num:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 7).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 7, 7).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 14, 7).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 21, 7).ToArray());
                break;

            case NumericalLayout.__2x7Alpha_2x7Num_4x1Num:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 7).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 7, 7).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 14, 7).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 21, 7).ToArray());
                SendToDisplay(4, new ArraySegment <ushort>(frame.SegmentData, 28, 2).ToArray());
                SendToDisplay(5, new ArraySegment <ushort>(frame.SegmentData, 30, 2).ToArray());
                break;

            case NumericalLayout.__2x7Num_2x7Num_4x1Num:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 7).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 7, 7).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 14, 7).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 21, 7).ToArray());
                SendToDisplay(4, new ArraySegment <ushort>(frame.SegmentData, 28, 2).ToArray());
                SendToDisplay(5, new ArraySegment <ushort>(frame.SegmentData, 30, 2).ToArray());
                break;

            case NumericalLayout.__2x7Num_2x7Num_10x1Num:
                var data10x1 = new ushort[10];
                new ArraySegment <ushort>(frame.SegmentData, 28, 4).ToArray().CopyTo(data10x1, 0);
                new ArraySegment <ushort>(frame.SegmentDataExtended, 0, 6).ToArray().CopyTo(data10x1, 4);
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 7).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 7, 7).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 14, 7).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 21, 7).ToArray());
                SendToDisplay(5, data10x1);
                break;

            case NumericalLayout.__2x7Num_2x7Num_4x1Num_gen7:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 7).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 7, 7).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 14, 7).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 21, 7).ToArray());
                SendToDisplay(4, new ArraySegment <ushort>(frame.SegmentData, 28, 2).ToArray());
                SendToDisplay(5, new ArraySegment <ushort>(frame.SegmentData, 30, 2).ToArray());
                break;

            case NumericalLayout.__2x7Num10_2x7Num10_4x1Num:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 7).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 7, 7).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 14, 7).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 21, 7).ToArray());
                SendToDisplay(4, new ArraySegment <ushort>(frame.SegmentData, 28, 2).ToArray());
                SendToDisplay(5, new ArraySegment <ushort>(frame.SegmentData, 30, 2).ToArray());
                break;

            case NumericalLayout.__2x6Num_2x6Num_4x1Num:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 6).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 6, 6).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 12, 6).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 18, 6).ToArray());
                SendToDisplay(4, new ArraySegment <ushort>(frame.SegmentData, 24, 2).ToArray());
                SendToDisplay(5, new ArraySegment <ushort>(frame.SegmentData, 26, 2).ToArray());
                break;

            case NumericalLayout.__2x6Num10_2x6Num10_4x1Num:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 6).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 6, 6).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 12, 6).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 18, 6).ToArray());
                SendToDisplay(4, new ArraySegment <ushort>(frame.SegmentData, 24, 2).ToArray());
                SendToDisplay(5, new ArraySegment <ushort>(frame.SegmentData, 26, 2).ToArray());
                break;

            case NumericalLayout.__4x7Num10:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 7).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 7, 7).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 14, 7).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 21, 7).ToArray());
                break;

            case NumericalLayout.__6x4Num_4x1Num:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 4).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 4, 4).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 8, 4).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 12, 4).ToArray());
                SendToDisplay(4, new ArraySegment <ushort>(frame.SegmentData, 16, 4).ToArray());
                SendToDisplay(5, new ArraySegment <ushort>(frame.SegmentData, 20, 4).ToArray());
                SendToDisplay(6, new ArraySegment <ushort>(frame.SegmentData, 24, 2).ToArray());
                SendToDisplay(7, new ArraySegment <ushort>(frame.SegmentData, 26, 2).ToArray());
                break;

            case NumericalLayout.__2x7Num_4x1Num_1x16Alpha:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 7).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 7, 7).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 14, 4).ToArray());
                SendToDisplay(3, new ArraySegment <ushort>(frame.SegmentData, 18, 16).ToArray());
                break;

            case NumericalLayout.__1x16Alpha_1x16Num_1x7Num:
                SendToDisplay(0, new ArraySegment <ushort>(frame.SegmentData, 0, 16).ToArray());
                SendToDisplay(1, new ArraySegment <ushort>(frame.SegmentData, 16, 16).ToArray());
                SendToDisplay(2, new ArraySegment <ushort>(frame.SegmentData, 32, 7).ToArray());
                break;
            }
        }
Exemple #6
0
 public void NextFrame(AlphaNumericFrame frame)
 {
     _framesAlphaNumeric.OnNext(frame);
 }