2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using Native = Interop.CameraDisplay;
20 namespace Tizen.Multimedia
23 /// The CameraDisplay class allows you to manage display for the camera.
24 /// It allows to set and get various display properties, such as
25 /// rotation, display visibility, and display mode.
27 public class CameraDisplaySettings
29 internal readonly Camera _camera;
31 internal CameraDisplaySettings(Camera camera)
39 /// <since_tizen> 3 </since_tizen>
41 /// This property is meaningful only in overlay or EVAS surface display type.
43 /// <value>A <see cref="CameraDisplayMode"/> that specifies the display mode.</value>
44 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
45 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
46 public CameraDisplayMode Mode
50 CameraErrorFactory.ThrowIfError(Native.GetMode(_camera.GetHandle(), out var val),
51 "Failed to get camera display mode");
58 ValidationUtil.ValidateEnum(typeof(CameraDisplayMode), value);
59 CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value),
60 "Failed to set camera display mode.");
65 /// The display visibility.
67 /// <value>true if camera display is visible, otherwise false.</value>
68 /// <since_tizen> 3 </since_tizen>
70 /// This property is meaningful only in overlay or EVAS surface display type.
72 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
73 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
78 CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out bool val),
79 "Failed to get visible value");
86 CameraErrorFactory.ThrowIfError(Native.SetVisible(_camera.GetHandle(), value),
87 "Failed to set display visible.");
92 /// The display rotation.
94 /// <since_tizen> 3 </since_tizen>
96 /// This property is meaningful only in overlay or EVAS surface display type.
98 /// <value>A <see cref="Rotation"/> that specifies the rotation of the camera device.</value>
99 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
100 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
101 public Rotation Rotation
105 CameraErrorFactory.ThrowIfError(Native.GetRotation(_camera.GetHandle(), out var val),
106 "Failed to get display rotation");
113 ValidationUtil.ValidateEnum(typeof(Rotation), value);
115 CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value),
116 "Failed to set display rotation.");
121 /// The display flip.
123 /// <since_tizen> 3 </since_tizen>
125 /// This property is meaningful only in overlay or EVAS surface display type.
127 /// <value>A <see cref="Flips"/> that specifies the camera flip type.</value>
128 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
129 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
134 CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val),
135 "Failed to get display flip");
142 ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips));
144 CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
145 "Failed to set display flip.");
150 /// the ROI(Region Of Interest) area of display.
152 /// <since_tizen> 3 </since_tizen>
154 /// This property is meaningful only in overlay or EVAS surface display type.
156 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
157 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
158 public Rectangle RoiArea
162 CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(),
163 out int x, out int y, out int width, out int height), "Failed to get display roi area");
165 return new Rectangle(x, y, width, height);
170 CameraErrorFactory.ThrowIfError(Native.SetRoiArea(_camera.GetHandle(),
171 value.X, value.Y, value.Width, value.Height), "Failed to set display roi area.");