Exemplo n.º 1
0
        /// <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);
                }
            }
        }
Exemplo n.º 2
0
        /// <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);
                }
            }
        }