update header for Doxygen
[platform/framework/native/vision.git] / inc / FUixVisionQrCodeGenerator.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2013 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 /**
20  * @file     FUixVisionQrCodeGenerator.h
21  * @brief    This is the header file for the %QrCodeGenerator class.
22  *
23  * This header file contains the declarations of the %QrCodeGenerator class.
24  */
25
26 #ifndef _FUIX_VISION_QR_CODE_GENERATOR_H_
27 #define _FUIX_VISION_QR_CODE_GENERATOR_H_
28 #include <FBaseObject.h>
29 #include <FGrpBitmap.h>
30 #include <FBase.h>
31 #include <FMedia.h>
32 #include "FUixVisionQrCodeTypes.h"
33
34
35 namespace Tizen { namespace Uix { namespace Vision
36 {
37
38 /**
39  * @class    QrCodeGenerator
40  * @brief    This class provides methods to generate a QR code image.
41  *
42  * @since    2.1
43  *
44  * The %QrCodeGenerator class provides methods to generate a QR code image.
45  *
46  * The following example demonstrates how to use the %QrCodeGenerator class.
47  *
48  * @code
49  * #include <FBase.h>
50  * #include <FUix.h>
51  * #include <FGraphics.h>
52  * #include <FIo.h>
53  * #include <FMedia.h>
54  * 
55  * using namespace Tizen::Base;
56  * using namespace Tizen::Media;
57  * using namespace Tizen::Graphics;
58  * using namespace Tizen::Io;
59  * using namespace Tizen::Uix::Vision;
60  * 
61  * class MyClass
62  * {
63  * public:
64  *      MyClass();
65  *      ~MyClass();
66  *      result TestQrCodeGenerator(void);
67  * };
68  * 
69  * result
70  * MyClass::TestQrCodeGenerator(void)
71  * {
72  *      result r;
73  *      QrCodeGenerator qrGen;
74  *      qrGen.Construct();
75  * 
76  *      int width(0), height(0);
77  *      r = qrGen.EncodeToFile("Hello Tizen!",
78  *                      QR_CODE_MODE_UTF8,
79  *                      QR_CODE_ERROR_CORRECTION_LEVEL_Q,
80  *                      true,
81  *                      "/opt/usr/media/Images/temp.png",
82  *                      Tizen::Media::IMG_FORMAT_PNG,
83  *                      width,
84  *                      height);
85  *      return r;
86  * }
87  * @endcode
88  */
89 class _OSP_EXPORT_ QrCodeGenerator
90     : public Tizen::Base::Object
91 {
92 public:
93
94     /**
95      * This is the default constructor for this class. @n
96      * The object is not fully constructed after this constructor is called. @n
97      * For full construction, the Construct() method must be called right after calling this constructor.
98      *
99      * @since    2.1
100      */
101     QrCodeGenerator(void);
102
103     /**
104      * This is the destructor for this class. @n
105      * The resources are deallocated by this method.
106      * This destructor overrides Tizen::Base::Object::~Object().
107      *
108      * @since    2.1
109      */
110     ~QrCodeGenerator(void);
111
112     /**
113      * Initializes this instance of %QRCodeGenerator. @n
114      * Every application must call %Construct() before calling any other methods of %QRCodeGenerator.
115      *
116      * @since        2.1
117      *
118      * @feature      %http://tizen.org/feature/vision.qrcode_generation
119      *
120      * @exception    E_SUCCESS          The method is successful.
121      * @exception    E_UNSUPPORTED_OPERATION   The Emulator or target device does not support the required feature. 
122      * For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
123      * @remarks      Before calling this method, check whether the feature is supported by 
124          *                      Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&).
125      */
126     result Construct(void);
127
128     /**
129      * Gets a list of supported image file formats.
130      *
131      * @since        2.1
132          *
133      * @return       A list of supported image file formats
134      */
135     static Tizen::Base::Collection::IListT<Tizen::Media::ImageFormat>* GetSupportedImageFileFormatsListN(void);
136
137     /**
138      * Encodes a QR code into a file.
139      *
140      * @since        2.1
141      *
142      * @return       An error code
143      * @param[in]    message                The text to encode to QR code image
144      * @param[in]    mode                   The input text encoding format (QR_CODE_MODE_ALPHANUMERIC, QR_CODE_MODE_BYTE, QR_CODE_MODE_UTF8)
145      * @param[in]    errorCorrectionLevel   The QR code error correction level
146      * @param[in]    compatibility          The compatibility mode with zxing library for UTF-8 codes mode when mode is selected with QR_MODE_UTF8
147      * @param[in]    imageFilePath          The file path of the generated QR code image
148      * @param[in]    imageFormat            The image file format of the generated QR code image
149      * @param[out]   width                  The width of the generated QR code image
150      * @param[out]   height                 The height of the generated QR code image
151      * @exception    E_SUCCESS              The method is successful.
152      * @exception    E_INVALID_ARG          A specified input parameter is invalid.
153      * @exception    E_FILE_NOT_FOUND       The specified file cannot be found or accessed.
154      *
155      * @remarks      QR code encoding for UTF-8 is not standardized as yet.
156      *               So we support UTF-8 encoding/decoding compatibility to zxing(http://code.google.com/p/zxing/) library.
157      */
158     result EncodeToFile(const Tizen::Base::String& message, QrCodeMode mode, QrCodeErrorCorrectionLevel errorCorrectionLevel, bool compatibility, const Tizen::Base::String& imageFilePath, Tizen::Media::ImageFormat imageFormat, int& width, int& height);
159
160     /**
161      * Encodes a QR code into a byte buffer.
162      *
163      * @since        2.1
164      *
165      * @return       A pointer to the Tizen::Base::ByteBuffer instance containing the generated QR code image
166      * @param[in]    message                  The text to encode to QR code image
167      * @param[in]    mode                     The input text encoding format (QR_CODE_MODE_ALPHANUMERIC, QR_CODE_MODE_BYTE, QR_CODE_MODE_UTF8)
168      * @param[in]    error_level              The QR code error correction level
169      * @param[in]    compatibility            The compatibility mode with zxing library for UTF-8 codes mode when mode is selected with QR_CODE_MODE_UTF8
170      * @param[out]   width                    The width of the generated QR code image
171      * @param[out]   height                   The height of the generated QR code image
172      * @exception    E_SUCCESS                The method is successful.
173      * @exception    E_INVALID_ARG            A specified input parameter is invalid.
174      *
175      * @remarks      QR code encoding for UTF-8 is not standardized as yet.
176      *               So we support UTF-8 encoding/decoding compatibility to zxing(http://code.google.com/p/zxing/) library.
177      */
178     Tizen::Base::ByteBuffer* EncodeToBufferN(const Tizen::Base::String& message, QrCodeMode mode, QrCodeErrorCorrectionLevel error_level, bool compatibility, int& width, int& height);
179
180
181 private:
182     /**
183      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
184      */
185     QrCodeGenerator(const QrCodeGenerator& in);
186
187     /**
188      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
189      */
190     QrCodeGenerator& operator=(const QrCodeGenerator& in);
191
192 private:
193     class _QrCodeGeneratorImpl* __pQrCodeGeneratorImpl;
194     friend class _QrCodeGeneratorImpl;
195 };
196
197 } } } //Tizen::Uix::Vision
198
199 #endif // _FUIX_VISION_QR_CODE_GENERATOR_H_