/// <summary> /// This API sets the Mosaic topology and performs a mode switch using the given display settings. /// </summary> /// <param name="topoBrief"> /// The topology to set. This must be one of the topologies returned from GetSupportedTopoInfo(), /// and it must have an isPossible value of true. /// </param> /// <param name="displaySettings"> /// The per display settings to be used in the Mosaic mode. This must be one of the settings /// returned from GetSupportedTopoInfo(). /// </param> /// <param name="overlapX"> /// The pixel overlap to use between horizontal displays (use positive a number for overlap, or a /// negative number to create a gap.) If the overlap is out of bounds for what is possible given the topo and display /// setting, the overlap will be clamped. /// </param> /// <param name="overlapY"> /// The pixel overlap to use between vertical displays (use positive a number for overlap, or a /// negative number to create a gap.) If the overlap is out of bounds for what is possible given the topo and display /// setting, the overlap will be clamped. /// </param> /// <param name="enable"> /// If true, the topology being set will also be enabled, meaning that the mode set will occur. If /// false, you don't want to be in Mosaic mode right now, but want to set the current Mosaic topology so you can enable /// it later with EnableCurrentTopo() /// </param> /// <exception cref="ArgumentException">displaySettings is of invalid type.</exception> /// <exception cref="NVIDIAApiException">Status.NotSupported: Mosaic is not supported with the existing hardware.</exception> /// <exception cref="NVIDIAApiException">Status.InvalidArgument: One or more arguments passed in are invalid.</exception> /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: The NvAPI API needs to be initialized first.</exception> /// <exception cref="NVIDIAApiException">Status.NoImplementation: This entry point not available.</exception> /// <exception cref="NVIDIAApiException">Status.Error: Miscellaneous error occurred.</exception> /// <exception cref="Exception">A delegate callback throws an exception.</exception> // ReSharper disable once TooManyArguments public static void SetCurrentTopology( TopologyBrief topoBrief, IDisplaySettings displaySettings, int overlapX, int overlapY, bool enable) { var mosaicSetCurrentTopo = DelegateFactory.GetDelegate <Delegates.Mosaic.NvAPI_Mosaic_SetCurrentTopo>(); if (!mosaicSetCurrentTopo.Accepts().Contains(displaySettings.GetType())) { throw new ArgumentException("Parameter type is not supported.", nameof(displaySettings)); } using ( var displaySettingsByRef = ValueTypeReference.FromValueType(displaySettings, displaySettings.GetType())) { var status = mosaicSetCurrentTopo(topoBrief, displaySettingsByRef, overlapX, overlapY, (uint)(enable ? 1 : 0)); if (status != Status.Ok) { throw new NVIDIAApiException(status); } } }
/// <summary> /// This API returns information for the current Mosaic topology. /// This includes topology, display settings, and overlap values. /// You can call NvAPI_Mosaic_GetTopoGroup() with the topology if you require more information. /// If there isn't a current topology, then TopologyBrief.Topology will be Topology.None. /// </summary> /// <param name="topoBrief">The current Mosaic topology</param> /// <param name="displaySettings">The current per-display settings</param> /// <param name="overlapX">The pixel overlap between horizontal displays</param> /// <param name="overlapY">The pixel overlap between vertical displays</param> /// <exception cref="NVIDIAApiException">Status.NotSupported: Mosaic is not supported with the existing hardware.</exception> /// <exception cref="NVIDIAApiException">Status.InvalidArgument: One or more argumentss passed in are invalid.</exception> /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: The NvAPI API needs to be initialized first.</exception> /// <exception cref="NVIDIAApiException">Status.NoImplementation: This entry point not available.</exception> /// <exception cref="NVIDIAApiException">Status.Error: Miscellaneous error occurred.</exception> /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception> public static void GetCurrentTopology(out TopologyBrief topoBrief, out IDisplaySettings displaySettings, out int overlapX, out int overlapY) { var mosaicGetCurrentTopo = DelegateFactory.Get <Delegates.Mosaic.NvAPI_Mosaic_GetCurrentTopo>(); topoBrief = typeof(TopologyBrief).Instantiate <TopologyBrief>(); foreach (var acceptType in mosaicGetCurrentTopo.Accepts()) { displaySettings = acceptType.Instantiate <IDisplaySettings>(); using (var displaySettingsByRef = ValueTypeReference.FromValueType(displaySettings, acceptType)) { var status = mosaicGetCurrentTopo(ref topoBrief, displaySettingsByRef, out overlapX, out overlapY); if (status == Status.IncompatibleStructureVersion) { continue; } if (status != Status.Ok) { throw new NVIDIAApiException(status); } displaySettings = displaySettingsByRef.ToValueType <IDisplaySettings>(acceptType); return; } } throw new NVIDIANotSupportedException("This operation is not supported."); }
/// <summary> /// This API returns the X and Y overlap limits required if the given Mosaic topology and display settings are to be /// used. /// </summary> /// <param name="topoBrief"> /// The topology for getting limits This must be one of the topo briefs returned from /// GetSupportedTopoInfo(). /// </param> /// <param name="displaySettings"> /// The display settings for getting the limits. This must be one of the settings returned /// from GetSupportedTopoInfo(). /// </param> /// <param name="minOverlapX">X overlap minimum</param> /// <param name="maxOverlapX">X overlap maximum</param> /// <param name="minOverlapY">Y overlap minimum</param> /// <param name="maxOverlapY">Y overlap maximum</param> /// <exception cref="ArgumentException">displaySettings is of invalid type.</exception> /// <exception cref="NVIDIAApiException">Status.NotSupported: Mosaic is not supported with the existing hardware.</exception> /// <exception cref="NVIDIAApiException">Status.InvalidArgument: One or more arguments passed in are invalid.</exception> /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: The NvAPI API needs to be initialized first.</exception> /// <exception cref="NVIDIAApiException">Status.NoImplementation: This entry point not available.</exception> /// <exception cref="NVIDIAApiException">Status.Error: Miscellaneous error occurred.</exception> /// <exception cref="Exception">A delegate callback throws an exception.</exception> // ReSharper disable once TooManyArguments public static void GetOverlapLimits( TopologyBrief topoBrief, IDisplaySettings displaySettings, out int minOverlapX, out int maxOverlapX, out int minOverlapY, out int maxOverlapY) { var mosaicGetOverlapLimits = DelegateFactory.GetDelegate <Delegates.Mosaic.NvAPI_Mosaic_GetOverlapLimits>(); if (!mosaicGetOverlapLimits.Accepts().Contains(displaySettings.GetType())) { throw new ArgumentException("Parameter type is not supported.", nameof(displaySettings)); } using ( var displaySettingsByRef = ValueTypeReference.FromValueType(displaySettings, displaySettings.GetType())) { var status = mosaicGetOverlapLimits(topoBrief, displaySettingsByRef, out minOverlapX, out maxOverlapX, out minOverlapY, out maxOverlapY); if (status != Status.Ok) { throw new NVIDIAApiException(status); } } }
public Display(IDisplaySettings displaySettings, IColorTheme colorTheme) { ds = displaySettings; ct = colorTheme; Initialize(); }
public Display(IDisplaySettings displaySettings) { ds = displaySettings; ct = new DefaultColorTheme(); Initialize(); }
// ReSharper disable once ExcessiveIndentation public GridTopology ToGridTopology() { var gridTopology = new GridTopology(Rows, Columns, Displays.Select(display => display.ToGridTopologyDisplay()).ToArray()) { ApplyWithBezelCorrectedResolution = ApplyWithBezelCorrectedResolution, ImmersiveGaming = ImmersiveGaming, BaseMosaicPanoramic = BaseMosaicPanoramic, DriverReloadAllowed = DriverReloadAllowed, AcceleratePrimaryDisplay = AcceleratePrimaryDisplay }; IDisplaySettings bestDisplaySettings = null; foreach (var displaySetting in gridTopology.GetPossibleDisplaySettings()) { if (displaySetting.Width == Resolution.Width && displaySetting.Height == Resolution.Height) { if (displaySetting.BitsPerPixel == ColorDepth) { if (displaySetting.Frequency == Frequency) { bestDisplaySettings = displaySetting; break; } if (bestDisplaySettings == null || displaySetting.Frequency > bestDisplaySettings.Frequency) { bestDisplaySettings = displaySetting; } } else if (bestDisplaySettings == null || displaySetting.BitsPerPixel > bestDisplaySettings.BitsPerPixel) { bestDisplaySettings = displaySetting; } } else if (bestDisplaySettings == null || displaySetting.Width * displaySetting.Height > bestDisplaySettings.Width * bestDisplaySettings.Height) { bestDisplaySettings = displaySetting; } } if (bestDisplaySettings != null) { gridTopology.SetDisplaySettings(bestDisplaySettings); } return(gridTopology); }
/// <summary> /// Initializes a new instance of the MainViewModel class /// </summary> /// <param name="displayResponder">Captures all responses from the reader and relays them to the user interface</param> /// <param name="commander">Used to setup the responder chain and execute ASCII commands</param> /// <param name="settings">The display settings</param> public MainViewModel(DisplayResponder displayResponder, IAsciiCommandExecuting commander, IDisplaySettings settings, serviceSocket socket) { InventoryCommand inventoryResponder; BarcodeCommand barcodeResponder; if (displayResponder == null) { throw new ArgumentNullException("displayResponder"); } if (commander == null) { throw new ArgumentNullException("commander"); } if (settings == null) { throw new ArgumentNullException("settings"); } this.socket = socket; this.settings = settings; // Create a display responder to capture and display all reader responses displayResponder.ReceivedLine += delegate(object sender, AsciiLineEventArgs e) { this.OnResponseLine(e.Line.FullLine); }; // setup an asynchronous responder for inventory inventoryResponder = new InventoryCommand(); inventoryResponder.TransponderReceived += this.AsynchronousTransponder_Received; // setup an asynchronous responder for barcodes barcodeResponder = new BarcodeCommand(); barcodeResponder.BarcodeReceived += this.AsynchronousBarcode_Received; // set up the responder chain this.commander = commander; this.commander.ClearResponders(); this.commander.AddResponder(new LoggerResponder()); this.commander.AddResponder(displayResponder); this.commander.AddSynchronousResponder(); this.commander.AddResponder(inventoryResponder.Responder); this.commander.AddResponder(barcodeResponder.Responder); this.synchronousBarcodeCommand = new BarcodeCommand(); this.synchronousBarcodeCommand.BarcodeReceived += this.SynchronousBarcode_Received; this.synchronousInventoryCommand = new InventoryCommand(); this.synchronousInventoryCommand.TransponderReceived += this.SynchronousTransponder_Received; }
/// <summary> /// Changes display settings for the topology /// </summary> /// <param name="displaySettings">Display settings to use</param> public void SetDisplaySettings(IDisplaySettings displaySettings) { Resolution = new Resolution(displaySettings.Width, displaySettings.Height, displaySettings.BitsPerPixel); Frequency = displaySettings.Frequency; }