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.
17 using Native = Interop.CameraDisplay;
19 namespace Tizen.Multimedia
22 /// The CameraDisplay class allows you to manage display for the camera.
23 /// It allows to set and get various display properties such as
24 /// rotation, display visibility and display mode.
26 public class CameraDisplaySettings
28 internal readonly Camera _camera;
30 internal CameraDisplaySettings(Camera camera)
38 /// <since_tizen> 3 </since_tizen>
39 /// <value>A <see cref="CameraDisplayMode"/> that specifies the display mode.</value>
40 /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
41 public CameraDisplayMode Mode
45 CameraDisplayMode val = CameraDisplayMode.LetterBox;
47 CameraErrorFactory.ThrowIfError(Native.GetMode(_camera.GetHandle(), out val),
48 "Failed to get camera display mode");
55 ValidationUtil.ValidateEnum(typeof(CameraDisplayMode), value);
56 CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value),
57 "Failed to set camera display mode.");
62 /// The display visibility.
63 /// True if camera display visible, otherwise false.
65 /// <since_tizen> 3 </since_tizen>
66 /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
73 CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out val),
74 "Failed to get visible value");
81 CameraErrorFactory.ThrowIfError(Native.SetVisible(_camera.GetHandle(), value),
82 "Failed to set display visible.");
87 /// The display rotation.
89 /// <since_tizen> 3 </since_tizen>
90 /// <value>A <see cref="CameraRotation"/> that specifies the rotation of camera device.</value>
91 /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
92 public CameraRotation Rotation
96 CameraRotation val = CameraRotation.None;
98 CameraErrorFactory.ThrowIfError(Native.GetRotation(_camera.GetHandle(), out val),
99 "Failed to get display rotation");
106 ValidationUtil.ValidateEnum(typeof(CameraRotation), value);
107 CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value),
108 "Failed to set display rotation.");
113 /// The display flip.
115 /// <since_tizen> 3 </since_tizen>
116 /// <value>A <see cref="CameraFlip"/> that specifies camera flip type.</value>
117 /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
118 public CameraFlip Flip
122 CameraFlip val = CameraFlip.None;
124 CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out val),
125 "Failed to get display flip");
132 ValidationUtil.ValidateEnum(typeof(CameraFlip), value);
133 CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
134 "Failed to set display flip.");
139 /// the ROI(Region Of Interest) area of display.
141 /// <since_tizen> 3 </since_tizen>
142 /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
143 public Rectangle RoiArea
152 CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(), out x, out y, out width, out height),
153 "Failed to get display roi area");
155 return new Rectangle(x, y, width, height);
160 CameraErrorFactory.ThrowIfError(Native.SetRoiArea(_camera.GetHandle(),
161 value.X, value.Y, value.Width, value.Height), "Failed to set display roi area.");