Ejemplo n.º 1
0
        /// <summary>
        /// Sets the roi(region of interest).
        /// </summary>
        /// <param name="roi">The region.</param>
        /// <remarks>
        /// the roi can be set before setting <see cref="PlayerDisplayMode.Roi"/>. (since 4.0)
        /// </remarks>
        /// <exception cref="InvalidOperationException">
        ///     Operation failed; internal error.
        /// </exception>
        /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
        /// <exception cref="ArgumentOutOfRangeException">The width or the height is less than or equal to zero.</exception>
        /// <since_tizen> 3 </since_tizen>
        public void SetRoi(Rectangle roi)
        {
            if (roi.Width <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(roi), roi.Width,
                                                      $"The width of the roi can't be less than or equal to zero.");
            }

            if (roi.Height <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(roi), roi.Height,
                                                      $"The height of the roi can't be less than or equal to zero.");
            }

            Native.SetRoi(Player.Handle, roi.X, roi.Y, roi.Width, roi.Height).
            ThrowIfFailed(Player, "Failed to set the roi");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the roi(region of interest).
        /// </summary>
        /// <param name="roi">The region.</param>
        /// <remarks>
        /// To set roi, <see cref="Mode"/> must be set to <see cref="PlayerDisplayMode.Roi"/> first.
        /// </remarks>
        /// <exception cref="InvalidOperationException">
        ///     Operation failed; internal error.<br/>
        ///     -or-<br/>
        ///     <see cref="Mode"/> is not set to <see cref="PlayerDisplayMode.Roi"/>.
        /// </exception>
        /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
        /// <exception cref="ArgumentOutOfRangeException">The width or the height is less than or equal to zero.</exception>
        /// <since_tizen> 3 </since_tizen>
        public void SetRoi(Rectangle roi)
        {
            if (roi.Width <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(roi), roi.Width,
                                                      $"The width of the roi can't be less than or equal to zero.");
            }
            if (roi.Height <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(roi), roi.Height,
                                                      $"The height of the roi can't be less than or equal to zero.");
            }

            if (Mode != PlayerDisplayMode.Roi)
            {
                throw new InvalidOperationException("Mode is not set to Roi");
            }

            Native.SetRoi(Player.Handle, roi.X, roi.Y, roi.Width, roi.Height).
            ThrowIfFailed("Failed to set the roi");
        }