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 /// <since_tizen> 3 </since_tizen>
28 public class CameraDisplaySettings
30 internal readonly Camera _camera;
32 internal CameraDisplaySettings(Camera camera)
40 /// <since_tizen> 3 </since_tizen>
42 /// This property is meaningful only in overlay or EVAS surface display type.
44 /// <value>A <see cref="CameraDisplayMode"/> that specifies the display mode.</value>
45 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
46 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
47 public CameraDisplayMode Mode
51 CameraErrorFactory.ThrowIfError(Native.GetMode(_camera.GetHandle(), out var val),
52 "Failed to get camera display mode");
59 ValidationUtil.ValidateEnum(typeof(CameraDisplayMode), value);
60 CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value),
61 "Failed to set camera display mode.");
66 /// The display visibility.
68 /// <value>true if camera display is visible, otherwise false.</value>
69 /// <since_tizen> 3 </since_tizen>
71 /// This property is meaningful only in overlay or EVAS surface display type.
73 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
74 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
79 CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out bool val),
80 "Failed to get visible value");
87 CameraErrorFactory.ThrowIfError(Native.SetVisible(_camera.GetHandle(), value),
88 "Failed to set display visible.");
93 /// The display rotation.
95 /// <since_tizen> 3 </since_tizen>
97 /// This property is meaningful only in overlay or EVAS surface display type.
99 /// <value>A <see cref="Rotation"/> that specifies the rotation of the camera device.</value>
100 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
101 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
102 public Rotation Rotation
106 CameraErrorFactory.ThrowIfError(Native.GetRotation(_camera.GetHandle(), out var val),
107 "Failed to get display rotation");
114 ValidationUtil.ValidateEnum(typeof(Rotation), value);
116 CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value),
117 "Failed to set display rotation.");
122 /// The display flip.
124 /// <since_tizen> 3 </since_tizen>
126 /// This property is meaningful only in overlay or EVAS surface display type.
128 /// <value>A <see cref="Flips"/> that specifies the camera flip type.</value>
129 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
130 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
135 CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val),
136 "Failed to get display flip");
143 ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips));
145 CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
146 "Failed to set display flip.");
151 /// the ROI(Region Of Interest) area of display.
153 /// <since_tizen> 3 </since_tizen>
155 /// This property is meaningful only in overlay or EVAS surface display type.
157 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
158 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
159 public Rectangle RoiArea
163 CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(),
164 out int x, out int y, out int width, out int height), "Failed to get display roi area");
166 return new Rectangle(x, y, width, height);
171 CameraErrorFactory.ThrowIfError(Native.SetRoiArea(_camera.GetHandle(),
172 value.X, value.Y, value.Width, value.Height), "Failed to set display roi area.");