+
+ /// <summary>
+ /// Set the relative ROI (Region Of Interest) area as a decimal fraction based on the video source.
+ /// It can be regarded as zooming operation because the specified video area will be rendered to fit to the display.
+ /// </summary>
+ /// <param name="scaleRectangle">The containing the ROI area information.</param>
+ /// <remarks>
+ /// This function requires the ratio of the each coordinate and size to the video resolution size
+ /// to guarantee of showing the same area for the dynamic resolution video content.
+ /// This function have to be called after setting <see cref="Display"/>
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Operation failed; internal error.
+ /// -or-<br/>
+ /// The <see cref="PlayerDisplayType"/> is not set to <see cref="PlayerDisplayType.Overlay"/>.
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="scaleRectangle.ScaleX"/> is less than 0.0 or greater than 1.0.<br/>
+ /// -or-<br/>
+ /// <paramref name="scaleRectangle.ScaleY"/> is less than 0.0 or greater than 1.0.<br/>
+ /// -or-<br/>
+ /// <paramref name="scaleRectangle.ScaleWidth"/> is less than or equal to 0.0 or greater than 1.0.<br/>
+ /// -or-<br/>
+ /// <paramref name="scaleRectangle.ScaleHeight"/> is less than or equal to 0.0 or greater than 1.0.
+ /// </exception>
+ /// <seealso cref="ScaleRectangle"/>
+ /// <seealso cref="Display"/>
+ /// <seealso cref="StreamInfo.GetVideoProperties"/>
+ /// <seealso cref="GetVideoRoi"/>
+ /// <since_tizen> 5 </since_tizen>
+ public void SetVideoRoi(ScaleRectangle scaleRectangle)
+ {
+ ValidateNotDisposed();
+
+ if (scaleRectangle.ScaleX < 0 || scaleRectangle.ScaleX > 1)
+ {
+ throw new ArgumentOutOfRangeException(nameof(scaleRectangle.ScaleX), scaleRectangle.ScaleX, "Valid range is 0 to 1.0");
+ }
+ if (scaleRectangle.ScaleY < 0 || scaleRectangle.ScaleY > 1)
+ {
+ throw new ArgumentOutOfRangeException(nameof(scaleRectangle.ScaleY), scaleRectangle.ScaleY, "Valid range is 0 to 1.0");
+ }
+ if (scaleRectangle.ScaleWidth <= 0 || scaleRectangle.ScaleWidth > 1)
+ {
+ throw new ArgumentOutOfRangeException(nameof(scaleRectangle.ScaleWidth), scaleRectangle.ScaleWidth, "Valid range is 0 to 1.0 (except 0.0)");
+ }
+ if (scaleRectangle.ScaleHeight <= 0 || scaleRectangle.ScaleHeight > 1)
+ {
+ throw new ArgumentOutOfRangeException(nameof(scaleRectangle.ScaleHeight), scaleRectangle.ScaleHeight, "Valid range is 0 to 1.0 (except 0.0)");
+ }
+
+ NativePlayer.SetVideoRoi(Handle, scaleRectangle.ScaleX, scaleRectangle.ScaleY, scaleRectangle.ScaleWidth, scaleRectangle.ScaleHeight).ThrowIfFailed(this, "Failed to set the video roi area.");
+ }
+
+ /// <summary>
+ /// Get the relative ROI (Region Of Interest) area as a decimal fraction based on the video source.
+ /// </summary>
+ /// <returns>The <see cref="ScaleRectangle"/> containing the ROI area information.</returns>
+ /// <remarks>The specified ROI area is valid only in <see cref="PlayerDisplayType.Overlay"/>.</remarks>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Operation failed; internal error.
+ /// </exception>
+ /// <seealso cref="Display"/>
+ /// <seealso cref="StreamInfo.GetVideoProperties"/>
+ /// <seealso cref="SetVideoRoi"/>
+ /// <since_tizen> 5 </since_tizen>
+ public ScaleRectangle GetVideoRoi()
+ {
+ ValidateNotDisposed();
+
+ NativePlayer.GetVideoRoi(Handle, out var scaleX, out var scaleY,
+ out var scaleWidth, out var scaleHeight).ThrowIfFailed(this, "Failed to get the video roi area");
+
+ return new ScaleRectangle(scaleX, scaleY, scaleWidth, scaleHeight);
+ }