Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Content.MediaContent / Interop / Interop.ImageInformation.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
18 using System;
19 using System.Runtime.InteropServices;
20 using Tizen.Content.MediaContent;
21
22 internal static partial class Interop
23 {
24     internal static partial class ImageInformation
25     {
26         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
27         internal static extern MediaContentError Destroy(IntPtr media);
28
29         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_clone", CallingConvention = CallingConvention.Cdecl)]
30         internal static extern MediaContentError Clone(out SafeImageInformationHandle dst, SafeImageInformationHandle src);
31
32         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_orientation", CallingConvention = CallingConvention.Cdecl)]
33         internal static extern MediaContentError GetOrientation(SafeImageInformationHandle imageInformationHandle, out MediaContentOrientation orientation);
34
35         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_date_taken", CallingConvention = CallingConvention.Cdecl)]
36         internal static extern MediaContentError GetDateTaken(SafeImageInformationHandle imageInformationHandle, out IntPtr dateTaken);
37
38         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_burst_id", CallingConvention = CallingConvention.Cdecl)]
39         internal static extern MediaContentError GetBurstId(SafeImageInformationHandle imageInformationHandle, out IntPtr burstId);
40
41         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_exposure_time", CallingConvention = CallingConvention.Cdecl)]
42         internal static extern MediaContentError GetExposureTime(SafeImageInformationHandle imageInformationHandle, out IntPtr exposureTime);
43
44         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_fnumber", CallingConvention = CallingConvention.Cdecl)]
45         internal static extern MediaContentError GetFNumber(SafeImageInformationHandle imageInformationHandle, out double fNumber);
46
47         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_iso", CallingConvention = CallingConvention.Cdecl)]
48         internal static extern MediaContentError GetISO(SafeImageInformationHandle imageInformationHandle, out int iso);
49
50         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_model", CallingConvention = CallingConvention.Cdecl)]
51         internal static extern MediaContentError GetModel(SafeImageInformationHandle imageInformationHandle, out IntPtr model);
52
53         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_is_burst_shot", CallingConvention = CallingConvention.Cdecl)]
54         internal static extern MediaContentError IsBurstShot(SafeImageInformationHandle imageInformationHandle, out bool isBurstShot);
55
56         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_set_orientation", CallingConvention = CallingConvention.Cdecl)]
57         internal static extern MediaContentError SetOrientation(SafeImageInformationHandle imageInformationHandle, MediaContentOrientation orientation);
58
59         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)]
60         internal static extern MediaContentError GetMediaId(SafeImageInformationHandle imageInformationHandle, out IntPtr mediaId);
61
62         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_width", CallingConvention = CallingConvention.Cdecl)]
63         internal static extern MediaContentError GetWidth(SafeImageInformationHandle imageInformationHandle, out int width);
64
65         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_height", CallingConvention = CallingConvention.Cdecl)]
66         internal static extern MediaContentError GetHeight(SafeImageInformationHandle imageInformationHandle, out int width);
67
68         [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)]
69         internal static extern MediaContentError UpdateToDB(IntPtr imageInformationHandle);
70
71         internal sealed class SafeImageInformationHandle : SafeHandle
72         {
73             public SafeImageInformationHandle()
74                 : base(IntPtr.Zero, true)
75             {
76             }
77
78             public override bool IsInvalid
79             {
80                 get { return this.handle == IntPtr.Zero; }
81             }
82
83             protected override bool ReleaseHandle()
84             {
85                 ImageInformation.Destroy(this.handle);
86                 this.SetHandle(IntPtr.Zero);
87                 return true;
88             }
89         }
90     }
91 }