Tizen 2.1 base
[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 %Tizen::Media::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  *
43  * The %Image class is used for handling images, including image decoding, encoding, conversion, and JPEG compression. @n
44  * @remarks The minimum dimension is 16x16 for JPEG encoding and 8x8 for PNG encoding.
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.
194         *
195         * @if OSPCOMPAT
196         * @brief <i> [Compatibility] </i>
197         * @endif
198         * @since                2.0
199         * @if OSPCOMPAT
200         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
201         *                                       For more information, see @ref CompIoPathPage "here".
202         * @endif
203         *
204         * @return               A decoded bitmap that is not resized
205         * @param[in]    srcImagePath                    The local file path of the image file to open
206         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
207         * @exception    E_SUCCESS                               The method is successful.
208         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
209         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
210         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
211         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
212         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
213         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
214         * @remarks              This method retains the aspect ratio of the original image. @n
215         *                               @c E_OUT_OF_MEMORY can be returned if there is no available memory when decoding a large image. @n
216         *                               The specific error code can be accessed using the GetLastResult() method. @n
217         *                               This method returns auto-scaled bitmap, @n
218         *                               so the dimension can be different from the dimension of source image when the returned bitmap is locked.
219         */
220         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::String& srcImagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat) const;
221
222         /**
223         * Decodes an image file into the decoded bitmap container after resizing it as per the specified width and height. @n
224         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP.
225         *
226         * @if OSPCOMPAT
227         * @brief <i> [Compatibility] </i>
228         * @endif
229         * @since                2.0
230         * @if OSPCOMPAT
231         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
232         *                                       For more information, see @ref CompIoPathPage "here".
233         * @endif
234         *
235         * @return               A decoded bitmap data with the specified destination width and height
236         * @param[in]    srcImagePath                    The local file path of the image file to open
237         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
238         * @param[in]    destWidth                               The intended width of the image @n
239         *                                                                               An exception is returned if the value is less than @c 0.
240         * @param[in]    destHeight                              The intended height of the image @n
241         *                                                                               An exception is returned if the value is less than @c 0.
242         * @exception    E_SUCCESS                               The method is successful.
243         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
244         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
245         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
246         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
247         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
248         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
249         * @exception    E_OUT_OF_RANGE                  The specified size is out of range.
250         * @remarks              This method retains the aspect ratio of the original image. @n
251         *                               It supports only the downscaling of an image. @n
252         *                               The specific error code can be accessed using the GetLastResult() method. @n
253         *                               This method returns auto-scaled bitmap, @n
254         *                               so the dimension can be different from the requested dimension when the returned bitmap is locked.
255         */
256         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::String& srcImagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat, int destWidth, int destHeight) const;
257
258         /**
259         * Decodes an image data into the decoded bitmap as per the specified width and height. @n
260         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP.
261         *
262         * @since                2.0
263         *
264         * @return               An error code
265         * @param[in]    srcImageUrl                     The URL of the remote image to decode
266         * @param[in]    pixelFormat                     The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
267         * @param[in]    destWidth                       The intended width of the image @n
268         *                                                                       An exception is returned if the value is less than @c 0.
269         * @param[in]    destHeight                      The intended height of the image @n
270         *                                                                       An exception is returned if the value is less than @c 0.
271         * @param[out]   reqId               The request ID
272         * @param[in]    listener                        An instance of IImageDecodeUrlEventListener
273         * @param[in]    timeout                         The timeout period in milliseconds @n
274         *                                                                       Set to @c TIMEOUT_INFINITE to make the @c timeout period infinite.
275         * @exception    E_SUCCESS                       The method is successful.
276         * @exception    E_INVALID_DATA          The specified input instance has invalid data.
277         * @exception    E_INVALID_ARG           The specified pixel format is not supported.
278         * @exception    E_OUT_OF_RANGE          The specified size is out of range.
279         * @exception    E_OUT_OF_MEMORY         The memory is insufficient.
280         * @exception    E_NETWORK_FAILED        The network is unavailable.
281         * @exception    E_MAX_EXCEEDED          The number of concurrent accesses to the URLs has reached the maximum limit.
282         * @remarks              This method retains the aspect ratio of the original image. @n
283         *                               It supports only the downscaling of an image. @n
284         *                               The maximum limit for downscaling is 3. @n
285         *                               The supported protocol is HTTP.
286         */
287         result DecodeUrl(const Tizen::Base::Utility::Uri& srcImageUrl, Tizen::Graphics::BitmapPixelFormat pixelFormat, int destWidth, int destHeight, RequestId& reqId, const IImageDecodeUrlEventListener& listener, long timeout) const;
288
289         /**
290         * Decodes an image data into the decoded bitmap container without resizing. @n
291         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP. The %DecodeN() method retains the
292         * aspect ratio of the original image.
293         *
294         * @since                2.0
295         *
296         * @return               A decoded bitmap data that has not been resized
297         * @param[in]    srcImageBuf                             The data to decode
298         * @param[in]    srcImageFormat                  The image format of the input file
299         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
300         * @exception    E_SUCCESS                               The method is successful.
301         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
302         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
303         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
304         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
305         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
306         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
307         * @remarks              This method retains the aspect ratio of the original image. @n
308         *                               @c E_OUT_OF_MEMORY is returned if the memory is not available when decoding a large image. @n
309         *                               The specific error code can be accessed using the GetLastResult() method. @n
310         *                               This method returns auto-scaled bitmap, @n
311         *                               so the dimension can be different from the dimension of source image when the returned bitmap is locked.
312         */
313         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::ByteBuffer& srcImageBuf, ImageFormat srcImageFormat, Tizen::Graphics::BitmapPixelFormat pixelFormat) const;
314
315         /**
316         * Decodes an image data into the decoded bitmap container after resizing it as per the specified width and height. @n
317         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP.
318         *
319         * @since                2.0
320         *
321         * @return               A decoded bitmap data with the specified destination width and height
322         * @param[in]    srcImageBuf                             The data to decode
323         * @param[in]    srcImageFormat                  The image format of the input file
324         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
325         * @param[in]    destWidth                               The intended width of the image @n
326         *                                                                               An exception is returned if the value is less than @c 0.
327         * @param[in]    destHeight                              The intended height of the image @n
328         *                                                                               An exception is returned if the value is less than @c 0.
329         * @exception    E_SUCCESS                               The method is successful.
330         * @exception    E_INVALID_ARG                   The specified pixel format is not supported.
331         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
332         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
333         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
334         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
335         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
336         * @exception    E_OUT_OF_RANGE                  The specified size is out of range.
337         * @remarks              This method retains the aspect ratio of the original image. @n
338         *                               It supports only the downscaling of an image. @n
339         *                               The specific error code can be accessed using the GetLastResult() method. @n
340         *                               This method returns auto-scaled bitmap, @n
341         *                               so the dimension can be different from the requested dimension when the returned bitmap is locked.
342         */
343         Tizen::Graphics::Bitmap* DecodeN(const Tizen::Base::ByteBuffer& srcImageBuf, ImageFormat srcImageFormat, Tizen::Graphics::BitmapPixelFormat pixelFormat, int destWidth, int destHeight) const;
344
345         /**
346         * Encodes the specified bitmap data into a byte buffer. @n
347         * The currently supported encoding formats are JPEG, BMP, and PNG.
348         *
349         * @since                2.0
350         *
351         * @return               A byte buffer containing encoded image data
352         * @param[in]    srcBitmap                               The bitmap data to encode
353         * @param[in]    destImageFormat                 The intended image format
354         * @exception    E_SUCCESS                               The method is successful.
355         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
356         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
357         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
358         * @exception    E_OBJ_NOT_FOUND                 The specified bitmap data cannot be found.
359         * @remarks              The specific error code can be accessed using the GetLastResult() method. @n
360         *                               This method uses raw RGB data from locked bitmap, @n
361         *                               so the dimension of encoded data can be different from the dimension of source bitmap if the bitmap is auto-scaled.
362         */
363         Tizen::Base::ByteBuffer* EncodeToBufferN(const Tizen::Graphics::Bitmap& srcBitmap, ImageFormat destImageFormat) const;
364
365         /**
366         * Encodes the specified bitmap data into a file. @n
367         * The currently supported encoding formats are JPEG, BMP, and PNG.
368         *
369         * @if OSPCOMPAT
370         * @brief <i> [Compatibility] </i>
371         * @endif
372         * @since                2.0
373         * @if OSPCOMPAT
374         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
375         *                                       For more information, see @ref CompIoPathPage "here".
376         * @endif
377         *
378         * @return               An error code
379         * @param[in]    srcBitmap                               The bitmap data to encode
380         * @param[in]    destImageFormat                 The intended image format
381         * @param[in]    destImagePath                   The intended name of encoded image file @n
382         *                                                                       The available paths start with prefixes retrieved from the functions such as: @n
383         *                                                                       Tizen::App::App::GetInstance()->GetAppRootPath() @n
384         *                                                                       Tizen::System::Environment::GetMediaPath() @n
385         *                                                                       Tizen::System::Environment::GetExternalStoragePath()
386         * @param[in]    overwrite                               Set to @c true to overwrite the file, @n
387         *                                                                               else @c false
388         * @exception    E_SUCCESS                               The method is successful.
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_FILE_NOT_FOUND                The specified file cannot be found or accessed.
393         * @exception    E_OBJ_NOT_FOUND                 The specified bitmap data cannot be found.
394         * @exception    E_FILE_ALREADY_EXIST    The specified file already exists.
395         * @exception    E_SYSTEM                                A system error has occurred.
396         * @exception    E_STORAGE_FULL          The storage is full.
397         * @remarks              The specific error code can be accessed using the GetLastResult() method. @n
398         *                               The application should use Tizen::Content::ContentManager::CreateContent() to register the created file into the Contents database. @n
399         *                               This method uses raw RGB data from locked bitmap, @n
400         *                               so the dimension of encoded data can be different from the dimension of source bitmap if the bitmap is auto-scaled.
401         */
402         result EncodeToFile(const Tizen::Graphics::Bitmap& srcBitmap, ImageFormat destImageFormat, const Tizen::Base::String& destImagePath, bool overwrite) const;
403
404         /**
405         * Converts the image file to the specified image format. @n
406         * This is a synchronous method. The converting formats currently supported are JPEG, BMP, and PNG.
407         *
408         * @if OSPCOMPAT
409         * @brief <i> [Compatibility] </i>
410         * @endif
411         * @since                2.0
412         * @if OSPCOMPAT
413         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
414         *                                       For more information, see @ref CompIoPathPage "here".
415         * @endif
416         *
417         * @return               The byte buffer containing image data
418         * @param[in]    srcImagePath                    The local file path of the image file to open
419         * @param[in]    destImageFormat                 The intended image format
420         * @exception    E_SUCCESS                               The method is successful.
421         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
422         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
423         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
424         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
425         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
426         * @remarks      The specific error code can be accessed using the GetLastResult() method.
427         */
428         Tizen::Base::ByteBuffer* ConvertN(const Tizen::Base::String& srcImagePath, ImageFormat destImageFormat) const;
429
430         /**
431         * @if OSPDEPREC
432         * @{
433         * Compresses an encoded image file to reduce its size as per the specified limit. @n
434         * The only supported compression format is JPEG.
435         *
436         * @if OSPCOMPAT
437         * @brief <i> [Deprecated] [Compatibility] </i>
438         * @endif
439         * @deprecated  This method is deprecated.
440         * @since                2.0
441         * @if OSPCOMPAT
442         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
443         *                                       For more information, see @ref CompIoPathPage "here".
444         * @endif
445         *
446         * @return               An error code
447         * @param[in]    srcImagePath                    The local file path of the image file to open
448         * @param[in]    destImagePath                   The destination file path @n
449         *                                                                               If the file already exists, it is overwritten. @n
450         *                                                                               The available paths start with prefix such as: @n
451         *                                                                               Tizen::App::App::GetInstance()->GetAppRootPath() @n
452         *                                                                               Tizen::System::Environment::GetMediaPath() @n
453         *                                                                               Tizen::System::Environment::GetExternalStoragePath()
454         * @param[in]    limitSize                               The maximum compressed data size in bytes @n
455         *                                                                               If the data size is too small, the width and height of the original
456         *                                                                               image can be reduced. @n The size must be less than the original size
457         *                                                                               and greater than @c 1024 byte.
458         * @exception    E_SUCCESS                               The method is successful.
459         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
460         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
461         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
462         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
463         * @exception    E_SYSTEM                                A system error has occurred.
464         * @exception    E_STORAGE_FULL          The file cannot be created because the file has reached its size limit.
465         * @exception    E_OUT_OF_RANGE                  The specified size is out of range.
466         * @}
467         * @endif
468         */
469         result CompressJpeg(const Tizen::Base::String& srcImagePath, const Tizen::Base::String& destImagePath, int limitSize) const;
470
471         /**
472         * @if OSPDEPREC
473         * Compresses an encoded image data to the byte buffer to reduce its data size as per the specified limit. @n
474         * The only supported compression format is JPEG.
475         *
476         * @brief <i> [Deprecated]  </i>
477         * @deprecated  This method is deprecated.
478         * @since                2.0
479         *
480         * @return               A byte buffer containing the compressed image data as per the specified size
481         * @param[in]    srcImageBuf                             The encoded image source in the byte buffer
482         * @param[in]    limitSize                               The limit size to compress in bytes @n
483         *                                                                               The size must be less than the original size and greater than @c 1024 bytes.
484         * @exception    E_SUCCESS                               The method is successful.
485         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
486         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
487         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
488         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
489         * @exception    E_SYSTEM                                A system error has occurred.
490         * @exception    E_OUT_OF_RANGE                  The specified size is out of range.
491         * @remarks              The specific error code can be accessed using the GetLastResult() method.
492         * @endif
493         */
494         Tizen::Base::ByteBuffer* CompressJpegN(const Tizen::Base::ByteBuffer& srcImageBuf, int limitSize) const;
495
496         /**
497         * Decodes an image data into the decoded byte buffer container without resizing. @n
498         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP.
499         *
500         * @since                2.0
501         *
502         * @return               A decoded byte data that is not resized, @n
503         *                               else @c null if an exception occurs
504         * @param[in]    srcImageBuf                             The data to decode
505         * @param[in]    srcImageFormat                  The image format of the input data
506         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
507         * @param[out]   imageWidth                      The original width of the image @n
508         *                                                                               An exception is returned if the value is less than @c 0.
509         * @param[out]   imageHeight                     The original height of the image @n
510         *                                                                               An exception is returned if the value is less than @c 0.
511         * @exception    E_SUCCESS                               The method is successful.
512         * @exception    E_INVALID_ARG                   The specified color format is not supported.
513         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
514         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
515         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
516         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
517         * @exception    E_OBJ_NOT_FOUND                 The specified media buffer cannot be found.
518         * @remarks              The specific error code can be accessed using the GetLastResult() method.
519         */
520         Tizen::Base::ByteBuffer* DecodeToBufferN(const Tizen::Base::ByteBuffer& srcImageBuf, ImageFormat srcImageFormat, Tizen::Graphics::BitmapPixelFormat pixelFormat, int& imageWidth, int& imageHeight) const;
521
522         /**
523         * Decodes an image file into the decoded byte buffer container without resizing. @n
524         * The currently supported decoding formats are JPEG, GIF, PNG, BMP, TIFF, and WBMP.
525         *
526         * @if OSPCOMPAT
527         * @brief <i> [Compatibility] </i>
528         * @endif
529         * @since                2.0
530         * @if OSPCOMPAT
531         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
532         *                                       For more information, see @ref CompIoPathPage "here".
533         * @endif
534         *
535         * @return               A decoded byte data that is not resized, @n
536         *                               else @c null if an exception occurs
537         * @param[in]    srcImagePath                    The local file path of the image file to decode
538         * @param[in]    pixelFormat                             The output pixel format defined by Tizen::Graphics::BitmapPixelFormat
539         * @param[out]   imageWidth                      The original width of the image @n
540         *                                                                               An exception is returned if the value is less than @c 0.
541         * @param[out]   imageHeight                     The original height of the image @n
542         *                                                                               An exception is returned if the value is less than @c 0.
543         * @exception    E_SUCCESS                               The method is successful.
544         * @exception    E_INVALID_ARG                   The specified color format is not supported.
545         * @exception    E_INVALID_DATA                  The specified input instance has invalid data.
546         * @exception    E_OVERFLOW                              The specified input instance has overflowed.
547         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
548         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
549         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
550         * @remarks              The specific error code can be accessed using the GetLastResult() method.
551         */
552         Tizen::Base::ByteBuffer* DecodeToBufferN(const Tizen::Base::String& srcImagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat, int& imageWidth, int& imageHeight) const;
553
554         /**
555          * Sets the timeout interval to infinity.
556          *
557          * @since       2.0
558          */
559         static const int TIMEOUT_INFINITE = 0;
560
561
562         /**
563         * Gets the format of the image in the specified file.
564         *
565         * @if OSPCOMPAT
566         * @brief <i> [Compatibility] </i>
567         * @endif
568         * @since                2.0
569         * @if OSPCOMPAT
570         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
571         *                                       For more information, see @ref CompIoPathPage "here".
572         * @endif
573         *
574         * @return               The format of the image
575         * @param[in]    srcImagePath                    The local path of the image file
576         * @exception    E_SUCCESS                               The method is successful.
577         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
578         * @exception    E_SYSTEM                                A system error has occurred.
579         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
580         * @remarks              The specific error code can be accessed using the GetLastResult() method.
581         */
582         Tizen::Media::ImageFormat GetImageFormat(const Tizen::Base::String& srcImagePath) const;
583
584         /**
585         * Gets the image format from an image buffer.
586         *
587         * @since                2.0
588         *
589         * @return               The format of the image
590         * @param[in]    srcImageBuf                             The Tizen::Base::ByteBuffer containing the image data
591         * @exception    E_SUCCESS                               The method is successful.
592         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
593         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
594         * @exception    E_SYSTEM                                A system error has occurred.
595         * @remarks              The specific error code can be accessed using the GetLastResult() method.
596         */
597         Tizen::Media::ImageFormat GetImageFormat(const Tizen::Base::ByteBuffer& srcImageBuf) const;
598
599         /**
600         * Checks whether the specified image file has alpha channels. @n
601         * Currently, only 32-bit PNG images are supported.
602         *
603         * @if OSPCOMPAT
604         * @brief <i> [Compatibility] </i>
605         * @endif
606         * @since                2.0
607         * @if OSPCOMPAT
608         * @compatibility        This method has compatibility issues with OSP compatible applications. @n
609         *                                       For more information, see @ref CompIoPathPage "here".
610         * @endif
611         *
612         * @return               @c true if the image has alpha channels, @n
613         *                               else @c false
614         * @param[in]    srcImagePath                    The local file path of the image file
615         * @exception    E_SUCCESS                               The method is successful.
616         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
617         * @exception    E_FILE_NOT_FOUND                The specified image file cannot be found.
618         * @exception    E_SYSTEM                                A system error has occurred.
619         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
620         * @remarks              The specific error code can be accessed using the GetLastResult() method.
621         */
622         bool HasAlphaChannels(const Tizen::Base::String& srcImagePath) const;
623
624         /**
625         * Checks whether the specified image buffer has alpha channels. @n
626         * Currently only 32-bit PNG images are supported.
627         *
628         * @since                2.0
629         *
630         * @return               @c true if the image has alpha channels, @n
631         *                               else @c false
632         * @param[in]    srcImageBuf                             The Tizen::Base::ByteBuffer containing the image data
633         * @exception    E_SUCCESS                               The method is successful.
634         * @exception    E_UNSUPPORTED_FORMAT    The specified format is not supported.
635         * @exception    E_OBJ_NOT_FOUND                 The specified image buffer cannot be found.
636         * @exception    E_SYSTEM                                A system error has occurred.
637         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
638         * @remarks              The specific error code can be accessed using the GetLastResult() method.
639         */
640         bool HasAlphaChannels(const Tizen::Base::ByteBuffer& srcImageBuf) const;
641
642 private:
643
644         /**
645         * The implementation of this copy constructor is intentionally blank
646         * and declared as private to prohibit copying of objects.
647         */
648         Image(const Image& image);
649
650         /**
651         * The implementation of this copy assignment operator is intentionally blank
652         * and declared as private to prohibit copying of objects.
653         */
654         Image& operator =(const Image& image);
655
656 private:
657         class _ImageImpl* __pImageImpl;
658         friend class _ImageImpl;
659
660 }; // class Image
661
662 };
663 };  // Tizen::Media
664
665 #endif