e6c19740034b1619be6976f4ab7680389df3259f
[platform/framework/native/content.git] / inc / FCntImageMetadata.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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  * @file                        FCntImageMetadata.h
18  * @brief               This is the header file for the %ImageMetadata class.
19  *
20  * This header file contains the declarations of the %ImageMetadata class.
21  */
22
23 #ifndef _FCNT_IMAGE_METADATA_H_
24 #define _FCNT_IMAGE_METADATA_H_
25
26 #include <FBaseObject.h>
27 #include <FCntTypes.h>
28
29 namespace Tizen { namespace Graphics
30 {
31 class Bitmap;
32 }}
33
34 namespace Tizen { namespace Content
35 {
36
37 class _ImageMetadataImpl;
38
39 /**
40  * @class       ImageMetadata
41  * @brief       This class provides methods to access the image metadata.
42  *
43  * @since       2.0
44  *
45  * The %ImageMetadata class provides methods to access the image metadata that contains the image content-specific attributes.
46  *
47  * The following example demonstrates how to use the %ImageMetadata class.
48  *
49  * @code
50  * result
51  * MyClass::TestImageMetadata(void)
52  * {
53  *              result r = E_SUCCESS;
54  *
55  *              Tizen::Base::String contentPath = Tizen::System::Environment::GetMediaPath() + L"Images/full_meta.jpg";
56  *              ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(contentPath);
57  *              TryReturn(pImgMeta != null, GetLastResult(), "ContentManagerUtil::GetImageMetaN failed.");
58  *
59  *              // Width
60  *              pImgMeta->GetWidth();
61  *
62  *              // Height
63  *              pImgMeta->GetHeight();
64  *
65  *              // Camera
66  *              pImgMeta->GetCameraManufacturer();
67  *
68  *              // Model
69  *              pImgMeta->GetCameraModel();
70  *
71  *              // Software
72  *              pImgMeta->GetSoftware();
73  *
74  *              // Date time
75  *              pImgMeta->GetDateTime();
76  *
77  *              // Thumbnail
78  *              Tizen::Media::Image image;
79  *              r = image.Construct();
80  *              if (IsFailed(r))
81  *              {
82  *                      delete pImgMeta;
83  *                      return r;
84  *              }
85  *
86  *              Tizen::Graphics::Bitmap* pBitmap = pImgMeta->GetThumbnailN();
87  *              if (pBitmap == null)
88  *              {
89  *                      delete pImgMeta;
90  *                      return GetLastResult();
91  *              }
92  *
93  *              Tizen::Base::String thumbnailPath = Tizen::System::Environment::GetMediaPath() + L"Images/image.bmp";
94  *              r = image.EncodeToFile(*pBitmap, Tizen::Media::IMG_FORMAT_BMP, thumbnailPath, false);
95  *              if (IsFailed(r))
96  *              {
97  *                      delete pImgMeta;
98  *                      delete pBitmap;
99  *                      return r;
100  *              }
101  *
102  *              delete pImgMeta;
103  *              delete pBitmap;
104  *
105  *              return r;
106  * }
107  * @endcode
108  */
109 class _OSP_EXPORT_ ImageMetadata
110         : virtual public Tizen::Base::Object
111 {
112 public:
113         /**
114          * This is the default constructor for this class.
115          *
116          * @since               2.0
117          */
118         ImageMetadata(void);
119
120         /**
121          * Copying of objects using this copy constructor is allowed.
122          *
123          * @since               2.0
124          *
125          * @param[in]   rhs     An instance of %ImageMetadata to copy
126          */
127         ImageMetadata(const ImageMetadata& rhs);
128
129         /**
130          * This destructor overrides Tizen::Base::Object::~Object().
131          *
132          * @since               2.0
133          */
134         virtual ~ImageMetadata(void);
135
136         /**
137          * Gets the width of the image.
138          *
139          * @since               2.0
140          *
141          * @return              The width of the image
142          */
143         int GetWidth(void) const;
144
145         /**
146          * Gets the height of the image.
147          *
148          * @since               2.0
149          *
150          * @return              The height of the image
151          */
152         int GetHeight(void) const;
153
154         /**
155          * Gets the name of the camera's manufacturer.
156          *
157          * @since               2.0
158          *
159          * @return              The name of the camera's manufacturer
160          */
161         Tizen::Base::String GetCameraManufacturer(void) const;
162
163         /**
164          * Gets the model of the camera.
165          *
166          * @since               2.0
167          *
168          * @return              The model of the camera
169          */
170         Tizen::Base::String GetCameraModel(void) const;
171
172         /**
173          * Gets the version of either the software or the firmware of the camera or the image input device
174          * used to generate the image.
175          *
176          * @since               2.0
177          *
178          * @return              The version of either the software or the firmware of the camera or the image input device
179          *                              used to generate the image
180          */
181         Tizen::Base::String GetSoftware(void) const;
182
183         /**
184          * Gets the date and time of the created content.
185          *
186          * @since               2.0
187          *
188          * @return              The date and time of the created content
189          */
190         Tizen::Base::String GetDateTime(void) const;
191
192         /**
193          * Gets the latitude of the image.
194          *
195          * @since               2.0
196          *
197          * @return              The latitude of the image
198          * @remarks         If there is no latitude in the image, @c -200.0 is returned.
199          */
200         double GetLatitude(void) const;
201
202         /**
203          * Gets the longitude of the image.
204          *
205          * @since               2.0
206          *
207          * @return              The longitude of the image
208          * @remarks         If there is no longitude in the image, @c -200.0 is returned.
209          */
210         double GetLongitude(void) const;
211
212         /**
213          * Gets the orientation of the image.
214          *
215          * @since               2.0
216          *
217          * @return              The orientation of the image
218          */
219         ImageOrientationType GetOrientation(void) const;
220
221         /**
222          * Gets the white balance of the image.
223          *
224          * @since               2.0
225          *
226          * @return              The white balance of the image
227          */
228         Tizen::Base::String GetWhiteBalance(void) const;
229
230         /**
231          * Gets the thumbnail image.
232          *
233          * @since                       2.0
234          *
235          * @return              A pointer to the thumbnail image
236          * @exception   E_SUCCESS                       The method is successful.
237          * @exception   E_DATA_NOT_FOUND        The thumbnail image does not exist.
238          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
239          * @remarks     The specific error code can be accessed using the GetLastResult() method.
240          */
241         Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
242
243         /**
244          * Compares the equality of the values between the two %ImageMetadata objects by overriding the Tizen::Base::Object::Equals() method.
245          *
246          * @since          2.0
247          *
248          * @return         @c true if all the fields in the objects are equal, @n
249          *                 else @c false
250          * @param[in]      rhs     The Tizen::Base::Object with which the comparison is done @n
251          *                                                      An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons.
252          */
253         virtual bool Equals(const Tizen::Base::Object& rhs) const;
254
255         /**
256          * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method.
257          *
258          * @since         2.0
259          *
260          * @return        The hash value of the current instance
261          */
262         virtual int GetHashCode(void) const;
263
264         /**
265          * Copying of objects using this copy assignment operator is allowed.
266          *
267          * @since          2.0
268          *
269          * @return         A reference to this instance
270          * @param[in]    rhs An instance of %ImageMetadata to copy
271          */
272         ImageMetadata& operator =(const ImageMetadata& rhs);
273
274 private:
275         friend class _ImageMetadataImpl;
276         _ImageMetadataImpl* __pImpl;
277
278 };  // class ImageMetadata
279
280 }}  // Tizen::Content
281
282 #endif  // _FCNT_IMAGE_METADATA_H_