{
internal static partial class Face
{
- [DllImport(Libraries.MediaContent, EntryPoint = "media_face_clone")]
- internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_face_create")]
+ internal static extern MediaContentError Create(string mediaId, out IntPtr face);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_destroy")]
internal static extern MediaContentError Destroy(IntPtr face);
+ [DllImport(Libraries.MediaContent, EntryPoint = "media_face_clone")]
+ internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
+
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_face_id")]
internal static extern MediaContentError GetId(IntPtr face, out IntPtr faceId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_tag")]
internal static extern MediaContentError GetTag(IntPtr face, out IntPtr tag);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_face_create")]
- internal static extern MediaContentError Create(string mediaId, out IntPtr face);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_set_face_rect")]
internal static extern MediaContentError SetFaceRect(IntPtr face, int x, int y, int w, int h);
internal static extern MediaContentError SetTag(IntPtr face, string tag);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_insert_to_db")]
- internal static extern MediaContentError InsertToDb(IntPtr handle);
+ internal static extern MediaContentError Insert(IntPtr handle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_face_update_to_db")]
internal static extern MediaContentError Update(IntPtr face);
Interop.Face.Destroy(handle);
}
}
+
+ /// <summary>
+ /// Inserts a new face information to the database with the specified media ID, area, orientation.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="mediaId">The media ID to be associated with.</param>
+ /// <param name="area">The region of face in the media.</param>
+ /// <param name="orientation">The orientation of specified media.</param>
+ /// <returns>The <see cref="FaceInfo"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null. </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaId"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="orientation"/> is not valid enumeration.
+ /// </exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public FaceInfo Insert(string mediaId, Rectangle area, Orientation orientation)
+ {
+ return Insert(mediaId, area, orientation, null);
+ }
+
+ /// <summary>
+ /// Inserts a new face information to the database with the specified media ID, area, orientation, and tag.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/content.write</privilege>
+ /// <param name="mediaId">The media ID to be associated with.</param>
+ /// <param name="area">The region of face in the media.</param>
+ /// <param name="orientation">The orientation of specified media.</param>
+ /// <param name="tag">The tag value.</param>
+ /// <returns>The <see cref="FaceInfo"/> containing the results.</returns>
+ /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
+ /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null. </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="mediaId"/> is a zero-length string, contains only white space.<br/>
+ /// -or-<br/>
+ /// <paramref name="orientation"/> is not valid enumeration.
+ /// </exception>
+ /// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public FaceInfo Insert(string mediaId, Rectangle area, Orientation orientation, string tag)
+ {
+ ValidateDatabase();
+
+ ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
+ ValidationUtil.ValidateEnum(typeof(Orientation), orientation, nameof(orientation));
+
+ Interop.Face.Create(mediaId, out IntPtr handle).ThrowIfError("Failed to create face handle");
+
+ try
+ {
+ Interop.Face.SetFaceRect(handle, area.X, area.Y, area.Width, area.Height).
+ ThrowIfError("Failed to set face area");
+
+ Interop.Face.SetOrientation(handle, orientation).ThrowIfError("Failed to set face orientation");
+
+ if (tag != null)
+ {
+ Interop.Face.SetTag(handle, tag).ThrowIfError("Failed to set face tag");
+ }
+
+ Interop.Face.Insert(handle).ThrowIfError("Failed to insert face information");
+
+ return new FaceInfo(handle);
+ }
+ finally
+ {
+ Interop.Face.Destroy(handle).ThrowIfError("Failed to destroy face handle");
+ }
+ }
}
}