Tizen 2.1 base
[platform/framework/native/image.git] / src / FMedia_GifDecoderImpl.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 #ifndef _FMEDIA_INTERNAL_GIF_DECODER_IMPL_H_
19 #define _FMEDIA_INTERNAL_GIF_DECODER_IMPL_H_
20
21 #include <unique_ptr.h>
22 namespace Tizen { namespace Media
23 {
24
25 class _GifDecoder;
26
27 class _GifDecoderImpl
28         : public Tizen::Base::Object
29 {
30 public:
31         /**
32          *      The constructor.
33          */
34         _GifDecoderImpl(void);
35
36         /**
37          *      The destructor.
38          */
39         virtual ~_GifDecoderImpl(void);
40
41         /**
42          * Initializes a new instance of this class
43          *
44          * @return      An error code
45          *
46          * @param[in]   filePath        The file path of image.
47          * @param[in]   pixelFormat     The output pixel format of the decoded image.
48          *
49          * @exception  E_SUCCESS             The method was successful.
50          * @exception  E_INVALID_STATE   Current state is invalid.
51          * @exception  E_INVALID_DATA    The input data is invalid.
52          * @exception  E_FILE_NOT_FOUND  The specified file cannot be found or accessed.
53          * @exception  E_INVALID_ARG     A specified pixel format is not supported.
54          * @exception  E_OUT_OF_MEMORY   The memory is insufficient.
55          * @exception  E_SYSTEM          A system error occurred.
56          * @remarks     Supported pixelFormats are MEDIA_PIXEL_FORMAT_RGB565LE, and MEDIA_PIXEL_FORMAT_BGRA8888.
57          */
58         result Construct(const Tizen::Base::String& filePath, MediaPixelFormat pixelFormat);
59
60         /**
61          * Initializes a new instance of this class
62          *
63          * @return      An error code
64          *
65          * @param[in]   srcBuf          The source buffer that the image data is stored.
66          * @param[in]   pixelFormat     The output pixel format of the decoded image.
67          *
68          * @exception   E_SUCCESS             The method was successful.
69          * @exception   E_INVALID_STATE   Current state is invalid.
70          * @exception   E_INVALID_DATA    The input data is invalid.
71          * @exception   E_INVALID_ARG     A specified pixel format is not supported.
72          * @exception   E_OUT_OF_MEMORY   The memory is insufficient.
73          * @exception   E_SYSTEM              A system error occurred.
74          * @remarks     Supported pixelFormats are MEDIA_PIXEL_FORMAT_RGB565LE, and MEDIA_PIXEL_FORMAT_BGRA8888.
75          */
76         result Construct(const Tizen::Base::ByteBuffer& srcBuf, MediaPixelFormat pixelFormat);
77
78         /**
79          * Gets the width of the image.
80          *
81          * @return      The width of image, @n
82          *              else @c 0 when an error occurred.
83          *
84          * @exception   E_SUCCESS       The method was successful.
85          * @exception   E_INVALID_STATE Current state is invalid.
86          * @remarks     The specific error code can be accessed using the GetLastResult() method.
87          */
88         int GetWidth(void) const;
89
90         /**
91          * Gets the height of the image.
92          *
93          * @return      The height of the image, @n
94          *                  else @c 0 when an error occurred.
95          *
96          * @exception   E_SUCCESS           The method was successful.
97          * @exception   E_INVALID_STATE Current state is invalid.
98          * @remarks     The specific error code can be accessed using the GetLastResult() method.
99          */
100         int GetHeight(void) const;
101
102         /**
103          * Decodes and gets the next frame in RAW RGB format.
104          *
105          * @return      The next decoded frame. @n
106          *              else @c null when no frame is left or an error occurred.
107          * @param[out]  duration        The duration of returned frame in miliseconds.
108          *
109          * @exception   E_SUCCESS        The method was successful.
110          * @exception   E_INVALID_STATE  Current state is invalid.
111          * @exception   E_INVALID_DATA   The data of the next frame is invalid.
112          * @exception   E_OUT_OF_MEMORY  The memory is insufficient.
113          * @exception   ImplE_SYSTEM         A system error occurred.
114          * @remarks     The specific error code can be accessed using the GetLastResult() method.
115          */
116         Tizen::Base::ByteBuffer* GetNextFrameN(long& duration);
117
118         /**
119          * Decodes and gets the next frame in Bitmap format.
120          *
121          * @return      The next decoded frame. @n
122          *          else @c null when no frame is left or an error occurred.
123          * @param[out]  duration            The duration of returned frame in miliseconds.
124          * @param[in]   bufferScaling       The buffer scaling type.
125          *
126          * @exception   E_SUCCESS          The method was successful.
127          * @exception   E_INVALID_STATE    Current state is invalid.
128          * @exception   E_INVALID_DATA     The data of the next frame is invalid.
129          * @exception   E_OUT_OF_MEMORY    The memory is insufficient.
130          * @exception   E_SYSTEM           A system error occurred.
131          * @remarks     When autoScale parameter is true auto scaled Bitmap will be returned. @n
132          *                      The specific error code can be accessed using the GetLastResult() method.
133          */
134         Tizen::Graphics::Bitmap* GetNextBitmapN(long& duration, Tizen::Graphics::BufferScaling bufferScaling = Tizen::Graphics::BUFFER_SCALING_AUTO);
135 private:
136         _GifDecoderImpl(const _GifDecoderImpl& rhs);
137         _GifDecoderImpl& operator =(const _GifDecoderImpl& rhs);
138         std::unique_ptr<_GifDecoder> __pGifDecoder;
139 };
140
141 }};
142 #endif