protected override void CreateRenderGraphs(RenderGraphCollection graphs, HashSet <string> reportingTags) { // define source object source; switch (Path.GetExtension(_options.FileName.ToLower())) { case ".png": case ".jpg": source = new ImageSourceBitmap(_options.FileName); break; case ".gif": source = new GifSource(_options.FileName); break; case ".bin": source = new RawSource(_options.FileName); break; default: throw new UnknownFormatException("Unknown format " + Path.GetExtension(_options.FileName.ToLower()) + ". Known formats: png, jpg, gif, bin."); } // define renderers var renderers = GetRenderers(_config, reportingTags); var frameSource = source as ISource; if (frameSource != null) { // chain them up graphs.Add(new RenderGraph { Source = frameSource, Destinations = renderers, Resize = _config.Global.Resize, FlipHorizontally = _config.Global.FlipHorizontally, FlipVertically = _config.Global.FlipVertically }); return; } // not an ISource, so it must be a IRawSource. var rawSource = (IRawSource)source; IRawOutput rawOutput = null; foreach (var dest in renderers.OfType <IRawOutput>()) { if (rawOutput != null) { throw new MultipleRawSourcesException("Cannot use multiple destinations when using a raw source."); } rawOutput = dest; } if (rawOutput == null) { throw new NoRawDestinationException("No device supporting raw data available."); } graphs.Add(new RawRenderer(rawSource, rawOutput)); }
protected override void CreateRenderGraphs(RenderGraphCollection graphs) { var renderers = GetRenderers(_config); var websocketServer = new WebsocketServer(_serverOptions.Ip, _serverOptions.Port, _serverOptions.Path); websocketServer.SetupGraphs(graphs, renderers); }
public void SetupGraphs(RenderGraphCollection graphs, List <IDestination> renderers) { _graphs = graphs; graphs.Add(new RenderGraph { Name = "2-bit Websocket Graph", Source = Gray2Source, Destinations = renderers, }); graphs.Add(new RenderGraph { Name = "4-bit Websocket Graph", Source = Gray4Source, Destinations = renderers, }); graphs.Add(new RenderGraph { Name = "Colored 2-bit Websocket Graph", Source = ColoredGray2Source, Destinations = renderers, }); graphs.Add(new RenderGraph { Name = "Colored 4-bit Websocket Graph", Source = ColoredGray4Source, Destinations = renderers, }); graphs.Add(new RenderGraph { Name = "24-bit RGB Websocket Graph", Source = Rgb24Source, Destinations = renderers, }); }
protected override void CreateRenderGraphs(RenderGraphCollection graphs, HashSet <string> reportingTags) { var renderers = GetRenderers(_config, reportingTags); var websocketServer = new WebsocketServer(_serverOptions.Ip, _serverOptions.Port, _serverOptions.Path); websocketServer.SetupGraphs(graphs, renderers); reportingTags.Add("Server"); }
public RenderGraphCollection GetRenderGraphs() { if (_graphs == null) { _graphs = new RenderGraphCollection(); CreateRenderGraphs(_graphs); } return(_graphs); }
public RenderGraphCollection GetRenderGraphs(HashSet <string> reportingTags) { if (_graphs == null) { _graphs = new RenderGraphCollection(); CreateRenderGraphs(_graphs, reportingTags); } return(_graphs); }
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); }
protected override void CreateRenderGraphs(RenderGraphCollection graphs, HashSet <string> reportingTags) { // create graph with renderers _graph = new RenderGraph { Destinations = GetRenderers(_config, reportingTags), Resize = _config.Global.Resize, FlipHorizontally = _config.Global.FlipHorizontally, FlipVertically = _config.Global.FlipVertically, IdleAfter = _options.IdleAfter, IdlePlay = _options.IdlePlay }; _graph.SetColor(_config.Global.DmdColor); // setup source and additional processors switch (_options.Source) { case SourceType.PinballFX2: { _graph.Source = new PinballFX2Grabber { FramesPerSecond = _options.FramesPerSecond }; reportingTags.Add("In:PinballFX2"); break; } case SourceType.PinballFX3: { if (_options.Fx3GrabScreen) { _graph.Source = new PinballFX3Grabber { FramesPerSecond = _options.FramesPerSecond }; reportingTags.Add("In:PinballFX3Legacy"); } else { _graph.Source = new PinballFX3MemoryGrabber { FramesPerSecond = _options.FramesPerSecond }; reportingTags.Add("In:PinballFX3"); } break; } case SourceType.PinballArcade: { _graph.Source = new TPAGrabber { FramesPerSecond = _options.FramesPerSecond }; reportingTags.Add("In:PinballArcade"); break; } case SourceType.ProPinball: { _graph.Source = new ProPinballSlave(_options.ProPinballArgs); reportingTags.Add("In:ProPinball"); break; } case SourceType.Screen: var grabber = new ScreenGrabber { FramesPerSecond = _options.FramesPerSecond, Left = _options.Position[0], Top = _options.Position[1], Width = _options.Position[2], Height = _options.Position[3], DestinationWidth = _options.ResizeTo[0], DestinationHeight = _options.ResizeTo[1] }; if (_options.GridSpacing > 0) { grabber.Processors.Add(new GridProcessor { Width = _options.ResizeTo[0], Height = _options.ResizeTo[1], Spacing = _options.GridSpacing }); } _graph.Source = grabber; reportingTags.Add("In:ScreenGrab"); break; default: throw new ArgumentOutOfRangeException(); } graphs.Add(_graph); }
protected abstract void CreateRenderGraphs(RenderGraphCollection graphs);
protected abstract void CreateRenderGraphs(RenderGraphCollection graphs, HashSet <string> reportingTags);