Added transparency support in RGB565 bitmap outputs, for gif decoder.
[framework/osp/image-core.git] / src / FMedia_JpegTurboEncoder.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   FMedia_JpegTurboEncoder.h
20  * @brief  This is header file for _JpegTurboEnecoder.
21  */
22
23 #ifndef _FMEDIA_INTERNAL_JPEG_TURBO_ENCODER_H_
24 #define _FMEDIA_INTERNAL_JPEG_TURBO_ENCODER_H_
25
26 #include <turbojpeg.h>
27 #include "FMedia_IImageEncoder.h"
28 namespace Tizen { namespace Media
29 {
30
31 class _JpegTurboEncoder
32         : public _IImageEncoder
33         , public Tizen::Base::Object
34 {
35 public:
36         static const int MIN_WIDTH = 16;
37         static const int MIN_HEIGHT = 16;
38         static const int MAX_WIDTH = 5000;
39         static const int MAX_HEIGHT = 5000;
40
41         /**
42          * This is the default constructor for this class.
43          *
44          * @see   Construct()
45          */
46         _JpegTurboEncoder(void);
47
48         /**
49          * This is the destructor for this class.
50          *
51          * @see   Construct()
52          */
53         virtual ~_JpegTurboEncoder(void);
54
55         /**
56          *  Initialize this instance.
57          * @param[in]     dim                     Encode dimension
58          * @param[in]     pixelFormat     Encode pixel format
59          * @param[in]     quality                 Encoding quality
60          */
61         virtual result Construct(int width, int height,
62                                                          MediaPixelFormat srcPixelFormat,
63                                                          MediaPixelFormat& reqPixelFormat,
64                                                          int quality);
65
66         /**
67          * Encodes the image data
68          *
69          * @return               An error code
70          * @param[in]     srcBuf                Source raw data
71          * @param[in]     srcLength     Source data length
72          * @param[out]   dstBuf            Encoded destination buffer
73          * @param[out]   dstLength      Destination buffer length
74          *
75          * @exception     E_SUCCESS             The method is successful.
76          * @exception     E_OUT_OF_MEMORY  Memory is insufficient.
77          * @exception     E_INVALID_ARG The input parameter is invalid.
78          */
79         virtual Tizen::Base::ByteBuffer* EncodeN(const byte* srcBuf, int srcLength);
80
81         /**
82          * Set specific key value to the encoder
83          * @return       An error code
84          * @param[in]  key                       The key to be set
85          * @param[in]  value               The value to be set.
86          */
87         virtual result SetValue(const Tizen::Base::String& key, Tizen::Base::Object &value);
88
89         TJPF ToTurboJpegPixelFormat(MediaPixelFormat mediaPixelFmt);
90 protected:
91
92
93 private:
94         int __width;
95         int __height;
96         int __quality;
97         MediaPixelFormat __pixelFormat;
98         tjhandle __tjEncodingHandle;
99         TJPF __tjPixelFormat;
100 }; // class _JpegTurboEncoder
101
102
103 };
104 };
105
106 #endif