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 System.Runtime.InteropServices;
19 using Native = Interop.CameraSettings;
20 using static Interop.Camera;
22 namespace Tizen.Multimedia
25 /// The camera setting class provides methods/properties to get and
26 /// set basic camera attributes.
28 public class CameraSettings
30 internal readonly Camera _camera;
32 private readonly Range? _brightnessRange;
33 private readonly Range? _contrastRange;
34 private readonly Range? _panRange;
35 private readonly Range? _tiltRange;
36 private readonly Range? _exposureRange;
37 private readonly Range? _zoomRange;
39 internal CameraSettings(Camera camera)
43 _contrastRange = GetRange(Native.GetContrastRange);
44 _brightnessRange = GetRange(Native.GetBrightnessRange);
45 _exposureRange = GetRange(Native.GetExposureRange);
46 _zoomRange = GetRange(Native.GetZoomRange);
47 _panRange = GetRange(Native.GetPanRange);
48 _tiltRange = GetRange(Native.GetTiltRange);
51 private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
52 private Range? GetRange(GetRangeDelegate func)
57 CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out min, out max),
58 "Failed to initialize the camera settings");
65 return new Range(min, max);
70 /// Sets auto focus area.
73 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
75 /// <param name="x">X position</param>
76 /// <param name="y">Y position</param>
77 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
78 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
79 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
80 public void SetAutoFocusArea(int x, int y)
82 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), x, y),
83 "Failed to set the autofocus area.");
87 /// Sets auto focus area.
90 /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
92 /// <param name="pos"><see cref="Point"/> structure including X, Y position</param>
93 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
94 /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
95 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
96 public void SetAutoFocusArea(Point pos)
98 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y),
99 "Failed to set the autofocus area.");
103 /// Clears the auto focus area.
105 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
106 public void ClearFocusArea()
108 CameraErrorFactory.ThrowIfError(Native.ClearAutoFocusArea(_camera.GetHandle()),
109 "Failed to clear the autofocus area.");
113 /// The auto focus mode.
115 /// <value>A <see cref="CameraAutoFocusMode"/> that specifies the auto focus mode.</value>
116 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
117 public CameraAutoFocusMode AutoFocusMode
121 CameraAutoFocusMode val = CameraAutoFocusMode.None;
123 CameraErrorFactory.ThrowIfError(Native.GetAutoFocusMode(_camera.GetHandle(), out val),
124 "Failed to get camera autofocus mode");
131 CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value),
132 "Failed to set camera autofocus mode.");
135 #endregion Auto Focus
139 /// The contrast level of the camera.
141 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
148 CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out val),
149 "Failed to get camera contrast value");
156 CameraErrorFactory.ThrowIfError(Native.SetContrast(_camera.GetHandle(), value),
157 "Failed to set camera contrast value.");
162 /// The auto contrast.
163 /// If true auto contrast is enabled, otherwise false.
165 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
166 public bool AutoContrast
172 CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out val),
173 "Failed to get camera auto contrast");
180 CameraErrorFactory.ThrowIfError(Native.EnableAutoContrast(_camera.GetHandle(), value),
181 "Failed to set camera enable auto contrast.");
185 /// Gets the available contrast level.
188 /// If min value is greater than the max value, it means this feature is not supported.
190 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
191 public Range ContrastRange
195 if (!_contrastRange.HasValue)
197 throw new NotSupportedException("Contrast is not supported.");
200 return _contrastRange.Value;
207 /// The brightness level of the camera.
209 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
210 public int Brightness
216 CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out val),
217 "Failed to get camera brightness value");
224 CameraErrorFactory.ThrowIfError(Native.SetBrightness(_camera.GetHandle(), value),
225 "Failed to set camera brightness value.");
230 /// Gets the available brightness level.
233 /// If min value is greater than the max value, it means this feature is not supported.
235 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
236 public Range BrightnessRange
240 if (!_brightnessRange.HasValue)
242 throw new NotSupportedException("Brightness is not supported.");
245 return _brightnessRange.Value;
248 #endregion Brightness
252 /// The exposure value.
254 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
261 CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out val),
262 "Failed to get camera exposure value");
269 CameraErrorFactory.ThrowIfError(Native.SetExposure(_camera.GetHandle(), value),
270 "Failed to set camera exposure value.");
275 /// The exposure mode.
277 /// <value>A <see cref="CameraExposureMode"/> that specifies the exposure mode.</value>
278 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
279 public CameraExposureMode ExposureMode
283 CameraExposureMode val = CameraExposureMode.Off;
285 CameraErrorFactory.ThrowIfError(Native.GetExposureMode(_camera.GetHandle(), out val),
286 "Failed to get camera exposure mode");
293 CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value),
294 "Failed to set camera exposure mode.");
299 /// Gets the available exposure value.
302 /// If min value is greater than the max value, it means this feature is not supported.
304 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
305 public Range ExposureRange
309 if (!_exposureRange.HasValue)
311 throw new NotSupportedException("Exposure is not supported.");
314 return _exposureRange.Value;
322 /// The range for zoom level is received from ZoomRange property.
324 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
331 CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out val),
332 "Failed to get zoom level");
339 CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), (int)value),
340 "Failed to set zoom level.");
345 /// Gets the available zoom level.
348 /// If min value is greater than the max value, it means this feature is not supported.
350 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
351 public Range ZoomRange
355 if (!_zoomRange.HasValue)
357 throw new NotSupportedException("Zoom is not supported.");
360 return _zoomRange.Value;
366 /// The whitebalance mode.
368 /// <value>A <see cref="CameraWhiteBalance"/> that specifies the white balance mode.</value>
369 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
370 public CameraWhiteBalance WhiteBalance
374 CameraWhiteBalance val = CameraWhiteBalance.None;
376 CameraErrorFactory.ThrowIfError(Native.GetWhiteBalance(_camera.GetHandle(), out val),
377 "Failed to get camera whitebalance");
384 CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value),
385 "Failed to set camera whitebalance.");
392 /// <value>A <see cref="CameraIsoLevel"/> that specifies ISO level.</value>
393 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
394 public CameraIsoLevel IsoLevel
398 CameraIsoLevel val = CameraIsoLevel.Auto;
400 CameraErrorFactory.ThrowIfError(Native.GetIso(_camera.GetHandle(), out val),
401 "Failed to get camera Iso level");
408 CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value),
409 "Failed to set camera Iso level.");
414 /// The quality of the image.
415 /// The range for image quality is 1 to 100.
417 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
418 public int ImageQuality
424 CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out val),
425 "Failed to get image quality");
432 CameraErrorFactory.ThrowIfError(Native.SetImageQuality(_camera.GetHandle(), value),
433 "Failed to set image quality.");
437 #region Resolution, Format, Fps of preview, capture
439 /// The preview frame rate.
441 /// <value>A <see cref="CameraFps"/> that specifies preview frame rate.</value>
442 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
443 public CameraFps PreviewFps
447 CameraFps val = CameraFps.Auto;
449 CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out val),
450 "Failed to get camera preview fps");
457 CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value),
458 "Failed to set preview fps.");
463 /// Gets or sets the resolution of preview
465 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
466 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
467 public Size PreviewResolution
474 CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out width, out height),
475 "Failed to get camera preview resolution");
477 return new Size(width, height);
482 CameraErrorFactory.ThrowIfError(SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height),
483 "Failed to set preview resolution.");
488 /// Gets the recommended preview resolution.
491 /// Depending on the capture resolution aspect ratio and display resolution,
492 /// the recommended preview resolution is determined.
494 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
495 public Size RecommendedPreviewResolution
502 CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out width, out height),
503 "Failed to get recommended preview resolution");
505 return new Size(width, height);
510 /// The preview data format.
512 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of preview data.</value>
513 /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
514 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
515 public CameraPixelFormat PreviewPixelFormat
519 CameraPixelFormat val = 0;
521 CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out val),
522 "Failed to get preview format");
529 CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value),
530 "Failed to set preview format.");
535 /// Resolution of the captured image.
537 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
538 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
539 public Size CaptureResolution
546 CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out width, out height),
547 "Failed to get camera capture resolution");
549 return new Size(width, height);
556 CameraErrorFactory.ThrowIfError(SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height),
557 "Failed to set capture resolution.");
562 /// Format of an image to be captured.
564 /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of captured image.</value>
565 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
566 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
567 public CameraPixelFormat CapturePixelFormat
571 CameraPixelFormat val = CameraPixelFormat.Invalid;
573 CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out val),
574 "Failed to get camera capture formats");
581 CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value),
582 "Failed to set capture format.");
585 #endregion Resolution, Format, Fps of preview, capture
587 #region Encoded preview
589 /// The bit rate of encoded preview.
591 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
592 public int EncodedPreviewBitrate
598 CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out val),
599 "Failed to get preview bitrate");
606 CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), (int)value),
607 "Failed to set encoded preview bitrate.");
612 /// GOP(Group Of Pictures) interval of encoded preview.
614 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
615 public int EncodedPreviewGopInterval
621 CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out val),
622 "Failed to get preview gop interval");
629 CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), (int)value),
630 "Failed to set encoded preview gop intervals.");
633 #endregion Encoded preview
636 /// The theater mode.
638 /// <value>A <see cref="CameraTheaterMode"/> that specifies theater mode.</value>
640 /// If you want to display the preview image on the external display with the full screen mode,
641 /// use this property.
643 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
644 public CameraTheaterMode TheaterMode
648 CameraTheaterMode val = CameraTheaterMode.Disable;
650 CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out val),
651 "Failed to get camera theater mode");
658 CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value),
659 "Failed to set camera theater mode.");
664 /// The camera effect mode.
666 /// <value>A <see cref="CameraEffectMode"/> that specifies effect mode.</value>
667 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
668 public CameraEffectMode Effect
672 CameraEffectMode val = CameraEffectMode.None;
674 CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out val),
675 "Failed to get camera effect");
682 CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value),
683 "Failed to set camera effect.");
690 /// <value>A <see cref="CameraSceneMode"/> that specifies scene mode.</value>
691 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
692 public CameraSceneMode SceneMode
696 CameraSceneMode val = CameraSceneMode.Normal;
698 CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out val),
699 "Failed to get camera scene mode");
706 CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value),
707 "Failed to set camera scene mode.");
712 /// The camera's flash mode.
714 /// <value>A <see cref="CameraFlashMode"/> that specifies flash mode.</value>
715 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
716 public CameraFlashMode FlashMode
720 CameraFlashMode val = CameraFlashMode.Off;
722 CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out val),
723 "Failed to get camera flash mode");
730 CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value),
731 "Failed to set camera flash mode.");
736 /// Gets the camera lens orientation angle.
738 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
739 public int LensOrientation
745 CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out val),
746 "Failed to get camera lens orientation");
753 /// The stream rotation.
755 /// <value>A <see cref="CameraRotation"/> that specifies the rotation of camera device.</value>
756 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
757 public CameraRotation StreamRotation
761 CameraRotation val = CameraRotation.None;
763 CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out val),
764 "Failed to get camera stream rotation");
771 CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value),
772 "Failed to set camera stream rotation.");
779 /// <value>A <see cref="CameraFlip"/> that specifies camera flip type.</value>
780 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
781 public CameraFlip StreamFlip
785 CameraFlip val = CameraFlip.None;
787 CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out val),
788 "Failed to get camera stream flip");
795 CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
796 "Failed to set camera flip.");
801 /// The mode of HDR(High dynamic range) capture.
803 /// <value>A <see cref="CameraHdrMode"/> that specifies the HDR mode.</value>
805 /// Taking multiple pictures at different exposure levels and intelligently stitching them together
806 /// so that we eventually arrive at a picture that is representative in both dark and bright areas.
807 /// If this attribute is set, then eventhandler set for HdrCaptureProgress event is invoked.
809 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
810 public CameraHdrMode HdrMode
814 CameraHdrMode val = 0;
816 CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out val),
817 "Failed to get camera hdr mode");
824 CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value),
825 "Failed to set camera hdr mode.");
830 /// The anti shake feature.
831 /// If true the antishake feature is enabled, otherwise false.
833 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
834 public bool AntiShake
840 CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out val),
841 "Failed to get camera anti shake value");
848 CameraErrorFactory.ThrowIfError(Native.EnableAntiShake(_camera.GetHandle(), value),
849 "Failed to set camera anti shake value.");
854 /// Enables/Disables the video stabilization feature.
855 /// If true video stabilization is enabled, otherwise false.
858 /// If video stabilization is enabled, zero shutter lag is disabled.
859 /// This feature is used to record a video.
861 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
862 public bool VideoStabilization
868 CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out val),
869 "Failed to get camera video stabilization");
876 CameraErrorFactory.ThrowIfError(Native.EnableVideoStabilization(_camera.GetHandle(), value),
877 "Failed to set camera video stabilization.");
882 /// Disables shutter sound.
883 /// If true shutter sound is disabled, otherwise false.
886 /// In some countries, this operation is not permitted.
888 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
889 public bool DisableShutterSound
893 CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), value),
894 "Failed to set disable shutter sound.");
898 #region PTZ(Pan Tilt Zoom), Pan, Tilt
900 /// Sets the type of PTZ(Pan Tilt Zoom). Mechanical or Electronic.
902 /// <value>A <see cref="CameraPtzType"/> that specifies the type of PTZ.</value>
903 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
904 public CameraPtzType PtzType
908 CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), (int)value),
909 "Failed to set camera ptz type.");
914 /// Sets the position to move horizontally.
916 /// <param name="type">ptz move type. <seealso cref="CameraPtzMoveType"/></param>
917 /// <param name="panStep">pan step</param>
918 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
919 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
920 public void SetPan(CameraPtzMoveType type, int panStep)
922 CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep),
923 "Failed to set the camera pan type.");
927 /// Gets the current position of the camera.
929 /// <returns>Returns the camera's horizontal position</returns>
930 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
935 CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out val),
936 "Failed to get the camera pan step.");
942 /// Sets the position to move vertically.
944 /// <param name="type">ptz move type</param>
945 /// <param name="tiltStep">tilt step</param>
946 /// <exception cref="ArgumentException">In case of invalid parameters</exception>
947 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
948 public void SetTilt(CameraPtzMoveType type, int tiltStep)
950 CameraErrorFactory.ThrowIfError(Native.SetTilt(_camera.GetHandle(), type, tiltStep),
951 "Failed to set the camera tilt type\t.");
955 /// Gets the current position of the camera.
957 /// <returns>Returns the current vertical position</returns>
958 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
963 CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out val),
964 "Failed to set the camera current position.");
970 /// Gets lower limit and upper limit for pan position.
973 /// If min value is greater than the max value, it means this feature is not supported.
975 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
976 public Range PanRange
980 if (!_panRange.HasValue)
982 throw new NotSupportedException("Pan is not supported.");
984 return _panRange.Value;
989 /// Gets lower limit and upper limit for tilt position.
992 /// If min value is greater than the max value, it means this feature is not supported.
994 /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
995 public Range TiltRange
999 if (!_tiltRange.HasValue)
1001 throw new NotSupportedException("Tilt is not supported.");
1003 return _tiltRange.Value;
1006 #endregion PTZ(Pan Tilt Zoom), Pan, Tilt
1011 /// true if EXIF tags are enabled in JPEG file, otherwise false.
1013 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1014 public bool EnableTag
1020 CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out val),
1021 "Failed to get camera enable tag");
1028 CameraErrorFactory.ThrowIfError(Native.EnableTag(_camera.GetHandle(), value),
1029 "Failed to set camera enable tag.");
1034 /// The camera image description in the EXIF tag.
1036 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1037 public string ImageDescriptionTag
1041 IntPtr val = IntPtr.Zero;
1044 CameraErrorFactory.ThrowIfError(Native.GetImageDescription(_camera.GetHandle(), out val),
1045 "Failed to get image description");
1047 return Marshal.PtrToStringAnsi(val);
1051 LibcSupport.Free(val);
1057 CameraErrorFactory.ThrowIfError(Native.SetImageDescription(_camera.GetHandle(), value),
1058 "Failed to set image description.");
1063 /// The software information in the EXIF tag.
1065 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1066 public string SoftwareTag
1070 IntPtr val = IntPtr.Zero;
1074 CameraErrorFactory.ThrowIfError(Native.GetTagSoftware(_camera.GetHandle(), out val),
1075 "Failed to get tag software");
1077 return Marshal.PtrToStringAnsi(val);
1081 LibcSupport.Free(val);
1087 CameraErrorFactory.ThrowIfError(Native.SetTagSoftware(_camera.GetHandle(), value),
1088 "Failed to set tag software.");
1093 /// The geotag(GPS data) in the EXIF tag.
1095 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1096 public Location GeoTag
1100 double latitude = 0.0;
1101 double longitude = 0.0;
1102 double altitude = 0.0;
1104 CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(), out latitude, out longitude, out altitude),
1105 "Failed to get tag");
1107 return new Location(latitude, longitude, altitude);
1112 CameraErrorFactory.ThrowIfError(Native.SetGeotag(_camera.GetHandle(),
1113 value.Latitude, value.Longitude, value.Altitude), "Failed to set geo tag.");
1118 /// Removes the geotag(GPS data) in the EXIF(Exchangeable image file format) tag.
1120 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1121 public void RemoveGeoTag()
1123 CameraErrorFactory.ThrowIfError(Native.RemoveGeotag(_camera.GetHandle()),
1124 "Failed to remove the geotag\t.");
1128 /// The camera orientation in the tag.
1130 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
1131 public CameraTagOrientation OrientationTag
1135 CameraTagOrientation val = 0;
1137 CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out val),
1138 "Failed to get camera tag orientation");
1145 CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value),
1146 "Failed to set camera tag orientation.");