Doxygen update(Image Class)
[platform/framework/native/image.git] / inc / FMediaImage.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19 * @file                 FMediaImage.h
20 * @brief                This is the header file for the %Image class.
21 *
22 * This header file contains the declarations of the %Image class.
23 */
24
25 #ifndef _FMEDIA_IMAGE_H_
26 #define _FMEDIA_IMAGE_H_
27
28 // include
29 #include <FBase.h>
30 #include <FGraphics.h>
31 #include <FMediaImageTypes.h>
32 #include <FMediaIImageEventListener.h>
33
34 namespace Tizen { namespace Media
35 {
36
37 /**
38  * @class       Image
39  * @brief       This class is used for handling images.
40  *
41  * @since       2.0
42  * @remarks The minimum dimension is 16x16 for JPEG encoding and 8x8 for PNG encoding.
43  *
44  * The %Image class is used for handling images, including image decoding, encoding, and conversion. @n
45  *
46  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/media/viewing_processing_still_images.htm">Viewing and Processing Still Images</a>. @n
47  * The following example demonstrates how to use the %Image class for image decoding and encoding.
48  *
49  * @code
50 #include <FBase.h>
51 #include <FIo.h>
52 #include <FApp.h>
53 #include <FGraphics.h>
54 #include <FUi.h>
55 #include <FMedia.h>
56
57 using namespace Tizen::Base;
58 using namespace Tizen::Io;
59 using namespace Tizen::Graphics;
60 using namespace Tizen::Ui::Controls;
61 using namespace Tizen::Media;
62
63 class ImageSample
64         : public Tizen::Ui::Controls::Form
65 {
66 public:
67         result TestDecoding(void);
68         result TestEncoding(void);
69 };
70
71 result
72 ImageSample::TestDecoding(void)
73 {
74         result r = E_SUCCESS;
75         Image img;
76         Bitmap* pBitmap = null;
77         Canvas *pCanvas = null;
78         String filePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.jpg";
79
80         img.Construct();
81
82         // Decodes the image
83         pBitmap = img.DecodeN(filePath, BITMAP_PIXEL_FORMAT_RGB565);
84         if (pBitmap == null)
85         {
86                 goto CATCH;
87         }
88
89         // Gets a Canvas instance
90         pCanvas = GetCanvasN();
91         if (pCanvas == null)
92         {
93                 goto CATCH;
94         }
95
96         pCanvas->DrawBitmap(Point(0,0), *pBitmap);
97         pCanvas->Show();
98
99         return r;
100
101 CATCH:
102         if (pCanvas)
103         {
104                 delete pCanvas;
105         }
106         if (pBitmap)
107         {
108                 delete pBitmap;
109         }
110
111         return r;
112 }
113
114 result
115 ImageSample::TestEncoding(void)
116 {
117         result r = E_SUCCESS;
118         Image img;
119         Bitmap* pBitmap = null;
120         String filePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.jpg";
121         String dstPath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test_out.jpg";
122
123         img.Construct();
124
125         pBitmap = img.DecodeN(filePath, BITMAP_PIXEL_FORMAT_RGB565);
126         if (pBitmap == null)
127         {
128                 goto CATCH;
129         }
130
131         r = img.EncodeToFile(*pBitmap, IMG_FORMAT_JPG, dstPath, true);
132         if (IsFailed(r))
133         {
134                 goto CATCH;
135         }
136
137         return r;
138
139 CATCH:
140         if (pBitmap)
141         {
142                 delete pBitmap;
143         }
144
145         return r;
146 }
147
148  * @endcode
149  */
150
151 class _OSP_EXPORT_ Image
152         : public Tizen::Base::Object
153 {
154 public:
155
156         /**
157         * This is the default constructor for this class. @n
158         * The object is not fully constructed after this constructor is called.
159         * For full construction, the Construct() method must be called right after
160         * calling this constructor.
161         *
162         * @since        2.0
163         *
164         * @see      Construct()
165         */
166         Image(void);
167
168         /**
169         * This is the destructor for this class. @n
170         * This destructor overrides Tizen::Base::Object::~Object().
171         *
172         * @since        2.0
173         *
174         * @see      Construct()
175         */
176         virtual ~Image(void);
177
178 public:
179         /**
180         * Initializes this instance of %Image.
181         *
182         * @since                2.0
183         *
184         * @return               An error code
185         * @exception    E_SUCCESS               The method is successful.
186         * @exception    E_OUT_OF_MEMORY The memory is insufficient.
187         * @exception    E_SYSTEM                A system error has occurred.
188         */
189         result Construct(void);
190
191         /**
192         * Decodes an image file into the decoded bitmap container. @n
193         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP. @n
194         * The %DecodeN() method retains the aspect ratio of the original image.
195         *
196         * @if OSPCOMPAT
197         * @brief <i> [Compatibility] </i>
198         * @endif
199         * @since                2.0
200         * @if OSPCOMPAT
201         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
202         *                                       For more information, see @ref CompIoPathPage "here".
203         * @endif
204         *
205         * @return               A decoded bitmap that is not resized
206         * @param[in]    srcImagePath                    The local file path of the image file to open
207         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
208         * @exception    E_SUCCESS                               The method is successful.
209         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
210         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
211         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
212         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
213         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
214         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
215         * @remarks
216         *                         - @c E_OUT_OF_MEMORY can be returned if there is no available memory when decoding a large image.
217         *                         - The specific error code can be accessed using the GetLastResult() method.
218         *                         - This method returns an auto-scaled bitmap, @n
219         *                           so the dimension can be different from the dimension of source image if the returned bitmap is locked.
220         */
221         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::String& srcImagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat) const;
222
223         /**
224         * Decodes an image file into the decoded bitmap container after resizing it as per the specified width and height. @n
225         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP. @n
226         * The %DecodeN() method retains the aspect ratio of the original image. @n
227         * It supports only the downscaling of an image.
228         *
229         * @if OSPCOMPAT
230         * @brief <i> [Compatibility] </i>
231         * @endif
232         * @since                2.0
233         * @if OSPCOMPAT
234         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
235         *                                       For more information, see @ref CompIoPathPage "here".
236         * @endif
237         *
238         * @return               A decoded bitmap data with the specified destination width and height
239         * @param[in]    srcImagePath                    The local file path of the image file to open
240         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
241         * @param[in]    destWidth                               The intended width of the image @n
242         *                                                                               An exception is returned if the value is less than @c 0.
243         * @param[in]    destHeight                              The intended height of the image @n
244         *                                                                               An exception is returned if the value is less than @c 0.
245         * @exception    E_SUCCESS                               The method is successful.
246         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
247         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
248         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
249         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
250         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
251         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
252         * @exception    E_OUT_OF_RANGE                  The specified size is out of range.
253         * @remarks
254         *                         - The specific error code can be accessed using the GetLastResult() method.
255         *                         - This method returns an auto-scaled bitmap, @n
256         *                           so the dimension can be different from the requested dimension if the returned bitmap is locked.
257         */
258         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::String& srcImagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat, int destWidth, int destHeight) const;
259
260         /**
261         * Decodes an image data into the decoded bitmap container after resizing it as per a specified width and height. @n
262         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP. @n
263         * The %DecodeN() method retains the aspect ratio of the original image.
264         *
265         * @since                2.1
266         *
267         * @return               A decoded bitmap data with the specified destination width and height
268         * @param[in]    srcImageBuf                             The data to decode
269         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
270         * @param[in]    destWidth                               The intended width of the image
271         * @param[in]    destHeight                              The intended height of the image
272         * @exception    E_SUCCESS                               The method is successful.
273         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
274         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
275         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
276         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
277         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
278         * @remarks
279         *                         - The specific error code can be accessed using the GetLastResult() method.
280         *                         - There is a high probability for an occurrence of an out-of-memory exception. If possible, check whether the exception is @c E_OUT_OF_MEMORY or not.
281         *                           For more information on how to handle the out-of-memory exception, refer <a href="../org.tizen.native.appprogramming/html/basics_tizen_programming/exception_check.htm">here</a>.
282         *                         - This method returns an auto-scaled bitmap to support logical coordinate system, so the actual dimension of the returned bitmap can vary depending on the physical dimension of the target device.
283         */
284         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::ByteBuffer& srcImageBuf, Tizen::Graphics::BitmapPixelFormat pixelFormat, float destWidth, float destHeight) const;
285
286         /**
287         * Decodes an image file into the decoded bitmap container after resizing it as per a specified width and height. @n
288         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP. @n
289         * The %DecodeN() method retains the aspect ratio of the original image.
290         *
291         * @since                2.1
292         *
293         * @return               A decoded bitmap data with the specified destination width and height
294         * @param[in]    srcImagePath                    The local file path of the image file to open
295         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
296         * @param[in]    destWidth                               The intended width of the image
297         * @param[in]    destHeight                              The intended height of the image
298         * @exception    E_SUCCESS                               The method is successful.
299         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
300         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
301         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
302         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
303         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
304         * @remarks
305         *                         - The specific error code can be accessed using the GetLastResult() method.
306         *                         - There is a high probability for an occurrence of an out-of-memory exception. If possible, check whether the exception is @c E_OUT_OF_MEMORY or not.
307         *                           For more information on how to handle the out-of-memory exception, refer <a href="../org.tizen.native.appprogramming/html/basics_tizen_programming/exception_check.htm">here</a>.
308         *                         - This method returns an auto-scaled bitmap to support logical coordinate system, so the actual dimension of the returned bitmap can vary depending on the physical dimension of the target device.
309         */
310         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::String& srcImagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat, float destWidth, float destHeight) const;
311
312         /**
313         * Decodes an image data into the decoded bitmap as per the specified width and height. @n
314         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP. @n
315         * The %DecodeUrl() method retains the aspect ratio of the original image. @n
316         * It supports only the downscaling of an image.
317         *
318         * @since                2.0
319         *
320         * @return               An error code
321         * @param[in]    srcImageUrl                     The URL of the remote image to decode
322         * @param[in]    pixelFormat                     The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
323         * @param[in]    destWidth                       The intended width of the image @n
324         *                                                                       An exception is returned if the value is less than @c 0.
325         * @param[in]    destHeight                      The intended height of the image @n
326         *                                                                       An exception is returned if the value is less than @c 0.
327         * @param[out]   reqId               The request ID
328         * @param[in]    listener                        An instance of IImageDecodeUrlEventListener
329         * @param[in]    timeout                         The timeout period in milliseconds @n
330         *                                                                       Set to @c TIMEOUT_INFINITE to make the @c timeout period infinite.
331         * @exception    E_SUCCESS                       The method is successful.
332         * @exception    E_INVALID_DATA          The specified input instance has invalid data.
333         * @exception    E_INVALID_ARG           The specified pixel format is not supported.
334         * @exception    E_OUT_OF_RANGE          The specified size is out of range.
335         * @exception    E_OUT_OF_MEMORY         The memory is insufficient.
336         * @exception    E_NETWORK_FAILED        The network is unavailable.
337         * @exception    E_MAX_EXCEEDED          The number of concurrent accesses to the URLs has reached the maximum limit.
338         * @remarks
339         *                         - The maximum limit for downloading is @c 3.
340         *                         - The supported protocol is HTTP.
341         */
342         result DecodeUrl(const Tizen::Base::Utility::Uri& srcImageUrl, Tizen::Graphics::BitmapPixelFormat pixelFormat, int destWidth, int destHeight, RequestId& reqId, const IImageDecodeUrlEventListener& listener, long timeout) const;
343
344         /**
345         * Decodes an image data into the decoded bitmap container without resizing. @n
346         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP. @n
347         * The %DecodeN() method retains the aspect ratio of the original image.
348         *
349         * @since                2.0
350         *
351         * @return               A decoded bitmap data that has not been resized
352         * @param[in]    srcImageBuf                             The data to decode
353         * @param[in]    srcImageFormat                  The image format of the input file
354         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
355         * @exception    E_SUCCESS                               The method is successful.
356         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
357         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
358         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
359         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
360         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
361         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
362         * @remarks
363         *                         - @c E_OUT_OF_MEMORY is returned if the memory is not available when decoding a large image.
364         *                         - The specific error code can be accessed using the GetLastResult() method.
365         *                         - This method returns an auto-scaled bitmap, @n
366         *                           so the dimension can be different from the dimension of source image if the returned bitmap is locked.
367         */
368         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::ByteBuffer& srcImageBuf, ImageFormat srcImageFormat, Tizen::Graphics::BitmapPixelFormat pixelFormat) const;
369
370         /**
371         * Decodes an image data into the decoded bitmap container after resizing it as per the specified width and height. @n
372         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP. @n
373         * The %DecodeN() method retains the aspect ratio of the original image. @n
374         * It supports only the downscaling of an image.
375         *
376         * @since                2.0
377         *
378         * @return               A decoded bitmap data with the specified destination width and height
379         * @param[in]    srcImageBuf                             The data to decode
380         * @param[in]    srcImageFormat                  The image format of the input file
381         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
382         * @param[in]    destWidth                               The intended width of the image @n
383         *                                                                               An exception is returned if the value is less than @c 0.
384         * @param[in]    destHeight                              The intended height of the image @n
385         *                                                                               An exception is returned if the value is less than @c 0.
386         * @exception    E_SUCCESS                               The method is successful.
387         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
388         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
389         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
390         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
391         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
392         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
393         * @exception    E_OUT_OF_RANGE                  The specified size is out of range.
394         * @remarks
395         *                         - The specific error code can be accessed using the GetLastResult() method.
396         *                         - This method returns an auto-scaled bitmap, @n
397         *                           so the dimension can be different from the requested dimension if the returned bitmap is locked.
398         */
399         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::ByteBuffer& srcImageBuf, ImageFormat srcImageFormat, Tizen::Graphics::BitmapPixelFormat pixelFormat, int destWidth, int destHeight) const;
400
401         /**
402         * Encodes the specified bitmap data into a byte buffer. @n
403         * The currently supported encoding formats are JPEG, BMP, and PNG.
404         *
405         * @since                2.0
406         *
407         * @return               A byte buffer containing encoded image data
408         * @param[in]    srcBitmap                               The bitmap data to encode
409         * @param[in]    destImageFormat                 The intended image format
410         * @exception    E_SUCCESS                               The method is successful.
411         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
412         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
413         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
414         * @exception    E_OBJ_NOT_FOUND                 The specified bitmap data cannot be found.
415         * @remarks
416         *                         - The specific error code can be accessed using the GetLastResult() method.
417         *                         - This method uses raw RGB data from locked bitmap, @n
418         *                           so the dimension of encoded data can be different from the dimension of source bitmap if the bitmap is auto-scaled.
419         */
420         Tizen::Base::ByteBuffer* EncodeToBufferN(const Tizen::Graphics::Bitmap& srcBitmap, ImageFormat destImageFormat) const;
421
422         /**
423         * Encodes the specified bitmap data into a file. @n
424         * The currently supported encoding formats are JPEG, BMP, and PNG.
425         *
426         * @if OSPCOMPAT
427         * @brief <i> [Compatibility] </i>
428         * @endif
429         * @since                2.0
430         * @if OSPCOMPAT
431         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
432         *                                       For more information, see @ref CompIoPathPage "here".
433         * @endif
434         *
435         * @return               An error code
436         * @param[in]    srcBitmap                               The bitmap data to encode
437         * @param[in]    destImageFormat                 The intended image format
438         * @param[in]    destImagePath                   The intended name of encoded image file @n
439         *                                                                       The available paths start with prefixes retrieved from the functions such as: @n
440         *                                                                       Tizen::App::App::GetInstance()->GetAppRootPath() @n
441         *                                                                       Tizen::System::Environment::GetMediaPath() @n
442         *                                                                       Tizen::System::Environment::GetExternalStoragePath()
443         * @param[in]    overwrite                               Set to @c true to overwrite the file, @n
444         *                                                                               else @c false
445         * @exception    E_SUCCESS                               The method is successful.
446         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
447         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
448         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
449         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
450         * @exception    E_OBJ_NOT_FOUND                 The specified bitmap data cannot be found.
451         * @exception    E_FILE_ALREADY_EXIST    The specified file already exists.
452         * @exception    E_SYSTEM                                A system error has occurred.
453         * @exception    E_STORAGE_FULL          The storage is full.
454         * @remarks
455         *                         - The specific error code can be accessed using the GetLastResult() method.
456         *                         - The application should use Tizen::Content::ContentManager::CreateContent() to register the created file into the Contents database.
457         *                         - This method uses raw RGB data from locked bitmap, @n
458         *                           so the dimension of encoded data can be different from the dimension of source bitmap if the bitmap is auto-scaled.
459         */
460         result EncodeToFile(const Tizen::Graphics::Bitmap& srcBitmap, ImageFormat destImageFormat, const Tizen::Base::String& destImagePath, bool overwrite) const;
461
462         /**
463         * Converts the image file to the specified image format. @n
464         * This is a synchronous method. The converting formats currently supported are JPEG, BMP, and PNG.
465         *
466         * @if OSPCOMPAT
467         * @brief <i> [Compatibility] </i>
468         * @endif
469         * @since                2.0
470         * @if OSPCOMPAT
471         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
472         *                                       For more information, see @ref CompIoPathPage "here".
473         * @endif
474         *
475         * @return               The byte buffer containing image data
476         * @param[in]    srcImagePath                    The local file path of the image file to open
477         * @param[in]    destImageFormat                 The intended image format
478         * @exception    E_SUCCESS                               The method is successful.
479         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
480         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
481         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
482         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
483         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
484         * @remarks      The specific error code can be accessed using the GetLastResult() method.
485         */
486         Tizen::Base::ByteBuffer* ConvertN(const Tizen::Base::String& srcImagePath, ImageFormat destImageFormat) const;
487
488         /**
489         * @{
490         * @if OSPDEPREC
491         * Compresses an encoded image file to reduce its size as per the specified limit. @n
492         * The only supported compression format is JPEG.
493         *
494         * @if OSPCOMPAT
495         * @brief <i> [Deprecated] [Compatibility] </i>
496         * @deprecated  This method is deprecated.
497         * @endif
498         * @since                2.0
499         * @if OSPCOMPAT
500         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
501         *                                       For more information, see @ref CompIoPathPage "here".
502         * @endif
503         *
504         * @return               An error code
505         * @param[in]    srcImagePath                    The local file path of the image file to open
506         * @param[in]    destImagePath                   The destination file path @n
507         *                                                                               If the file already exists, it is overwritten. @n
508         *                                                                               The available paths start with prefix such as: @n
509         *                                                                               Tizen::App::App::GetInstance()->GetAppRootPath() @n
510         *                                                                               Tizen::System::Environment::GetMediaPath() @n
511         *                                                                               Tizen::System::Environment::GetExternalStoragePath()
512         * @param[in]    limitSize                               The maximum compressed data size in bytes @n
513         *                                                                               If the data size is too small, the width and height of the original
514         *                                                                               image can be reduced. @n The size must be less than the original size
515         *                                                                               and greater than @c 1024 byte.
516         * @exception    E_SUCCESS                               The method is successful.
517         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
518         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
519         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
520         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
521         * @exception    E_SYSTEM                                A system error has occurred.
522         * @exception    E_STORAGE_FULL          The file cannot be created because the file has reached its size limit.
523         * @exception    E_OUT_OF_RANGE                  The specified size is out of range.
524         * @endif
525         * @}
526         */
527         result CompressJpeg(const Tizen::Base::String& srcImagePath, const Tizen::Base::String& destImagePath, int limitSize) const;
528
529         /**
530         * @if OSPDEPREC
531         * Compresses an encoded image data to the byte buffer to reduce its data size as per the specified limit. @n
532         * The only supported compression format is JPEG.
533         *
534         * @brief <i> [Deprecated] </i>
535         * @deprecated  This method is deprecated.
536         * @since                2.0
537         *
538         * @return               A byte buffer containing the compressed image data as per the specified size
539         * @param[in]    srcImageBuf                             The encoded image source in the byte buffer
540         * @param[in]    limitSize                               The limit size to compress in bytes @n
541         *                                                                               The size must be less than the original size and greater than @c 1024 bytes.
542         * @exception    E_SUCCESS                               The method is successful.
543         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
544         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
545         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
546         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
547         * @exception    E_SYSTEM                                A system error has occurred.
548         * @exception    E_OUT_OF_RANGE                  The specified size is out of range.
549         * @remarks              The specific error code can be accessed using the GetLastResult() method.
550         * @endif
551         */
552         Tizen::Base::ByteBuffer* CompressJpegN(const Tizen::Base::ByteBuffer& srcImageBuf, int limitSize) const;
553
554         /**
555         * Decodes an image data into the decoded byte buffer container without resizing. @n
556         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP.
557         *
558         * @since                2.0
559         *
560         * @return               A decoded byte data that is not resized, @n
561         *                               else @c null if an exception occurs
562         * @param[in]    srcImageBuf                             The data to decode
563         * @param[in]    srcImageFormat                  The image format of the input data
564         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
565         * @param[out]   imageWidth                      The original width of the image @n
566         *                                                                               An exception is returned if the value is less than @c 0.
567         * @param[out]   imageHeight                     The original height of the image @n
568         *                                                                               An exception is returned if the value is less than @c 0.
569         * @exception    E_SUCCESS                               The method is successful.
570         * @exception    E_INVALID_ARG                   The specified color format is not supported.
571         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
572         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
573         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
574         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
575         * @exception    E_OBJ_NOT_FOUND                 The specified media buffer cannot be found.
576         * @remarks              The specific error code can be accessed using the GetLastResult() method.
577         */
578         Tizen::Base::ByteBuffer* DecodeToBufferN(const Tizen::Base::ByteBuffer& srcImageBuf, ImageFormat srcImageFormat, Tizen::Graphics::BitmapPixelFormat pixelFormat, int& imageWidth, int& imageHeight) const;
579
580         /**
581         * Decodes an image file into the decoded byte buffer container without resizing. @n
582         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP.
583         *
584         * @if OSPCOMPAT
585         * @brief <i> [Compatibility] </i>
586         * @endif
587         * @since                2.0
588         * @if OSPCOMPAT
589         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
590         *                                       For more information, see @ref CompIoPathPage "here".
591         * @endif
592         *
593         * @return               A decoded byte data that is not resized, @n
594         *                               else @c null if an exception occurs
595         * @param[in]    srcImagePath                    The local file path of the image file to decode
596         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
597         * @param[out]   imageWidth                      The original width of the image @n
598         *                                                                               An exception is returned if the value is less than @c 0.
599         * @param[out]   imageHeight                     The original height of the image @n
600         *                                                                               An exception is returned if the value is less than @c 0.
601         * @exception    E_SUCCESS                               The method is successful.
602         * @exception    E_INVALID_ARG                   The specified color format is not supported.
603         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
604         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
605         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
606         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
607         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
608         * @remarks              The specific error code can be accessed using the GetLastResult() method.
609         */
610         Tizen::Base::ByteBuffer* DecodeToBufferN(const Tizen::Base::String& srcImagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat, int& imageWidth, int& imageHeight) const;
611
612         /**
613          * Sets the timeout interval to infinity.
614          *
615          * @since       2.0
616          */
617         static const int TIMEOUT_INFINITE = 0;
618
619
620         /**
621         * Gets the format of the image in the specified file.
622         *
623         * @if OSPCOMPAT
624         * @brief <i> [Compatibility] </i>
625         * @endif
626         * @since                2.0
627         * @if OSPCOMPAT
628         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
629         *                                       For more information, see @ref CompIoPathPage "here".
630         * @endif
631         *
632         * @return               The format of the image
633         * @param[in]    srcImagePath                    The local path of the image file
634         * @exception    E_SUCCESS                               The method is successful.
635         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
636         * @exception    E_SYSTEM                                A system error has occurred.
637         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
638         * @remarks              The specific error code can be accessed using the GetLastResult() method.
639         */
640         Tizen::Media::ImageFormat GetImageFormat(const Tizen::Base::String& srcImagePath) const;
641
642         /**
643         * Gets the image format from an image buffer.
644         *
645         * @since                2.0
646         *
647         * @return               The format of the image
648         * @param[in]    srcImageBuf                             The Tizen::Base::ByteBuffer containing the image data
649         * @exception    E_SUCCESS                               The method is successful.
650         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
651         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
652         * @exception    E_SYSTEM                                A system error has occurred.
653         * @remarks              The specific error code can be accessed using the GetLastResult() method.
654         */
655         Tizen::Media::ImageFormat GetImageFormat(const Tizen::Base::ByteBuffer& srcImageBuf) const;
656
657         /**
658         * Checks whether the specified image file has alpha channels. @n
659         * Currently only 32-bit PNG images are supported.
660         *
661         * @if OSPCOMPAT
662         * @brief <i> [Compatibility] </i>
663         * @endif
664         * @since                2.0
665         * @if OSPCOMPAT
666         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
667         *                                       For more information, see @ref CompIoPathPage "here".
668         * @endif
669         *
670         * @return               @c true if the image has alpha channels, @n
671         *                               else @c false
672         * @param[in]    srcImagePath                    The local file path of the image file
673         * @exception    E_SUCCESS                               The method is successful.
674         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
675         * @exception    E_FILE_NOT_FOUND                The specified image file cannot be found.
676         * @exception    E_SYSTEM                                A system error has occurred.
677         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
678         * @remarks              The specific error code can be accessed using the GetLastResult() method.
679         */
680         bool HasAlphaChannels(const Tizen::Base::String& srcImagePath) const;
681
682         /**
683         * Checks whether the specified image buffer has alpha channels. @n
684         * Currently only 32-bit PNG images are supported.
685         *
686         * @since                2.0
687         *
688         * @return               @c true if the image has alpha channels, @n
689         *                               else @c false
690         * @param[in]    srcImageBuf                             The Tizen::Base::ByteBuffer containing the image data
691         * @exception    E_SUCCESS                               The method is successful.
692         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
693         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
694         * @exception    E_SYSTEM                                A system error has occurred.
695         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
696         * @remarks              The specific error code can be accessed using the GetLastResult() method.
697         */
698         bool HasAlphaChannels(const Tizen::Base::ByteBuffer& srcImageBuf) const;
699
700 private:
701
702         /**
703         * The implementation of this copy constructor is intentionally blank
704         * and declared as private to prohibit copying of objects.
705         */
706         Image(const Image& image);
707
708         /**
709         * The implementation of this copy assignment operator is intentionally blank
710         * and declared as private to prohibit copying of objects.
711         */
712         Image& operator =(const Image& image);
713
714 private:
715         class _ImageImpl* __pImageImpl;
716         friend class _ImageImpl;
717
718 }; // class Image
719
720 };
721 };  // Tizen::Media
722
723 #endif