[MediaContent] Deprecate unused APIs (#5473)
[platform/core/csapi/tizenfx.git] / src / Tizen.Content.MediaContent / Tizen.Content.MediaContent / FaceInfo.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18
19 namespace Tizen.Content.MediaContent
20 {
21     /// <summary>
22     /// Represents the face information for the media.
23     /// </summary>
24     /// <since_tizen> 4 </since_tizen>
25     [Obsolete("Deprecated since API11; Will be removed in API13.")]
26     public class FaceInfo
27     {
28         internal FaceInfo(IntPtr handle)
29         {
30             Id = InteropHelper.GetString(handle, Interop.Face.GetId);
31             MediaInfoId = InteropHelper.GetString(handle, Interop.Face.GetMediaId);
32
33             Tag = InteropHelper.GetString(handle, Interop.Face.GetTag);
34             Orientation = InteropHelper.GetValue<IntPtr, Orientation>(handle, Interop.Face.GetOrientation);
35
36             Rect = GetRect(handle);
37         }
38
39         private static Rectangle GetRect(IntPtr faceHandle)
40         {
41             Interop.Face.GetFaceRect(faceHandle, out var x, out var y, out var width, out var height).
42                 ThrowIfError("Failed to get rect for the face info");
43
44             return new Rectangle(x, y, width, height);
45         }
46
47         /// <summary>
48         /// Gets the region.
49         /// </summary>
50         /// <value>The region of face in the media.</value>
51         /// <remarks>
52         /// The coordinates of the rectangle are orientation-applied values.
53         /// </remarks>
54         /// <since_tizen> 4 </since_tizen>
55         [Obsolete("Deprecated since API11; Will be removed in API13.")]
56         public Rectangle Rect { get; }
57
58         /// <summary>
59         /// Gets the ID of face information.
60         /// </summary>
61         /// <value>The unique ID of face information.</value>
62         /// <since_tizen> 4 </since_tizen>
63         [Obsolete("Deprecated since API11; Will be removed in API13.")]
64         public string Id { get; }
65
66         /// <summary>
67         /// Gets the media ID that the face information is added.
68         /// </summary>
69         /// <value>The media ID that the face information is added.</value>
70         /// <since_tizen> 4 </since_tizen>
71         [Obsolete("Deprecated since API11; Will be removed in API13.")]
72         public string MediaInfoId { get; }
73
74         /// <summary>
75         /// Gets the tag.
76         /// </summary>
77         /// <value>The tag of face information.</value>
78         /// <since_tizen> 4 </since_tizen>
79         [Obsolete("Deprecated since API11; Will be removed in API13.")]
80         public string Tag { get; }
81
82         /// <summary>
83         /// Gets the orientation of face information.
84         /// </summary>
85         /// <value>The orientation of face information.</value>
86         /// <since_tizen> 4 </since_tizen>
87         [Obsolete("Deprecated since API11; Will be removed in API13.")]
88         public Orientation Orientation { get; }
89
90         internal static FaceInfo FromHandle(IntPtr handle)
91         {
92             return new FaceInfo(handle);
93         }
94
95         /// <summary>
96         /// Returns a string representation of the face information.
97         /// </summary>
98         /// <returns>A string representation of the current face info.</returns>
99         /// <since_tizen> 4 </since_tizen>
100         [Obsolete("Deprecated since API11; Will be removed in API13.")]
101         public override string ToString() =>
102             $"Id={Id}, MediaInfoId={MediaInfoId}, Rect=({Rect}), Tag={Tag}";
103     }
104 }