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, nameof(value));
61 CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value),
62 "Failed to set camera display mode.");
67 /// The display visibility.
69 /// <value>true if camera display is visible, otherwise false.</value>
70 /// <since_tizen> 3 </since_tizen>
72 /// This property is meaningful only in overlay or EVAS surface display type.
74 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
75 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
80 CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out bool val),
81 "Failed to get visible value");
88 CameraErrorFactory.ThrowIfError(Native.SetVisible(_camera.GetHandle(), value),
89 "Failed to set display visible.");
94 /// The display rotation.
96 /// <since_tizen> 3 </since_tizen>
98 /// This property is meaningful only in overlay or EVAS surface display type.
100 /// <value>A <see cref="Rotation"/> that specifies the rotation of the camera device.</value>
101 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
102 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
103 public Rotation Rotation
107 CameraErrorFactory.ThrowIfError(Native.GetRotation(_camera.GetHandle(), out var val),
108 "Failed to get display rotation");
115 ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
117 CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value),
118 "Failed to set display rotation.");
123 /// The display flip.
125 /// <since_tizen> 3 </since_tizen>
127 /// This property is meaningful only in overlay or EVAS surface display type.
129 /// <value>A <see cref="Flips"/> that specifies the camera flip type.</value>
130 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
131 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
136 CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val),
137 "Failed to get display flip");
144 ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips));
146 CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
147 "Failed to set display flip.");
152 /// the ROI(Region Of Interest) area of display.
154 /// <since_tizen> 3 </since_tizen>
156 /// This property is meaningful only in overlay or EVAS surface display type.
158 /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
159 /// <exception cref="ObjectDisposedException" > The camera already has been disposed of.</exception>
160 public Rectangle RoiArea
164 CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(),
165 out int x, out int y, out int width, out int height), "Failed to get display roi area");
167 return new Rectangle(x, y, width, height);
172 CameraErrorFactory.ThrowIfError(Native.SetRoiArea(_camera.GetHandle(),
173 value.X, value.Y, value.Width, value.Height), "Failed to set display roi area.");