summaryrefslogtreecommitdiff
path: root/mv_barcode/barcode_generator/include
diff options
context:
space:
mode:
Diffstat (limited to 'mv_barcode/barcode_generator/include')
-rw-r--r--mv_barcode/barcode_generator/include/BarcodeGenerator.h103
-rw-r--r--mv_barcode/barcode_generator/include/BarcodeOptions.h114
-rw-r--r--mv_barcode/barcode_generator/include/mv_barcode_generate_open.h109
3 files changed, 326 insertions, 0 deletions
diff --git a/mv_barcode/barcode_generator/include/BarcodeGenerator.h b/mv_barcode/barcode_generator/include/BarcodeGenerator.h
new file mode 100644
index 00000000..8640683c
--- /dev/null
+++ b/mv_barcode/barcode_generator/include/BarcodeGenerator.h
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __BARCODEGENERATOR_H__
+#define __BARCODEGENERATOR_H__
+
+#include "BarcodeOptions.h"
+
+#include <string>
+
+/**
+ * @file BarcodeGenerator.h
+ * @brief This file contains the BarcodeGenerator class.
+ */
+
+namespace MediaVision
+{
+namespace Barcode
+{
+
+/**
+ * @brief This class implements barcode generation.
+ * @details 1D Barcodes and 2D QR codes are supported.
+ *
+ * @since_tizen 2.4
+ */
+class BarcodeGenerator
+{
+public:
+
+ /**
+ * @brief This method generates Barcodes image according to options.
+ *
+ * @since_tizen 2.4
+ * @param [in] imageFileName Image file name which will be generated
+ * @param [in] imageFormat Image file format which will be generated
+ * @param [in] imageWidth Image file width which will be generated
+ * @param [in] imageHeight Image file height which will be generated
+ * @param [in] message Input message to be encoded
+ * @param [in] type Barcode type (1D barcode or 2D QR code)
+ * @param [in] encodingMode Encoding mode (for QR codes only)
+ * @param [in] correctionLevel Error correction level (for QR codes only)
+ * @param [in] qrVersion QR code version (1 ~ 40, 0 for 1D barcodes)
+ * @return BARCODE_ERROR_NONE from BarcodeError which is 0 if success,
+ * BarcodeError value otherwise
+ */
+ static int generateBarcodeToImage(
+ const std::string& imageFileName,
+ BarcodeImageFormat imageFormat,
+ const int imageWidth,
+ const int imageHeight,
+ const std::string& message,
+ BarcodeType type,
+ BarcodeQREncodingMode encodingMode = BARCODE_QR_MODE_UNAVAILABLE,
+ BarcodeQRErrorCorrectionLevel correctionLevel = BARCODE_QR_ECC_UNAVAILABLE,
+ int qrVersion = 0);
+
+ /**
+ * @brief This method generates Barcodes image buffer according to options.
+ *
+ * @since_tizen 2.4
+ * @param [out] imageBuffer Image buffer with image to be generated
+ * @param [out] imageWidth Image buffer width which will be generated
+ * @param [out] imageHeight Image buffer height which will be generated
+ * @param [out] imageChannels Image buffer channels number which will be generated
+ * @param [in] message Input message to be encoded
+ * @param [in] type Barcode type (1D barcode or 2D QR code)
+ * @param [in] encodingMode Encoding mode (for QR codes only)
+ * @param [in] correctionLevel Error correction level (for QR codes only)
+ * @param [in] qrVersion QR code version (1 ~ 40, 0 for 1D barcodes)
+ * @return BARCODE_ERROR_NONE from BarcodeError which is 0 if success,
+ * BarcodeError value otherwise
+ */
+ static int generateBarcodeToBuffer(
+ unsigned char **imageBuffer,
+ unsigned int *imageWidth,
+ unsigned int *imageHeight,
+ unsigned int *imageChannels,
+ const std::string& message,
+ BarcodeType type,
+ BarcodeQREncodingMode encodingMode = BARCODE_QR_MODE_UNAVAILABLE,
+ BarcodeQRErrorCorrectionLevel correctionLevel = BARCODE_QR_ECC_UNAVAILABLE,
+ int qrVersion = 0);
+};
+
+} /* Barcode */
+} /* MediaVision */
+
+#endif /* __BARCODEGENERATOR_H__ */
+
diff --git a/mv_barcode/barcode_generator/include/BarcodeOptions.h b/mv_barcode/barcode_generator/include/BarcodeOptions.h
new file mode 100644
index 00000000..4da3b90d
--- /dev/null
+++ b/mv_barcode/barcode_generator/include/BarcodeOptions.h
@@ -0,0 +1,114 @@
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __BARCODEOPTIONS_H__
+#define __BARCODEOPTIONS_H__
+
+/**
+ * @file BarcodeOptions.h
+ * @brief This file contains the Barcode options.
+ */
+
+namespace MediaVision
+{
+namespace Barcode
+{
+
+/**
+ * @brief The Barcode type enumeration.
+ *
+ * @since_tizen 2.4
+ */
+enum BarcodeType
+{
+ BARCODE_QR = 58,
+ BARCODE_UPCA = 34,
+ BARCODE_UPCE = 37,
+ BARCODE_EAN8 = 13,
+ BARCODE_EAN13 = BARCODE_EAN8,
+ BARCODE_CODE39 = 8,
+ BARCODE_CODE128 = 20,
+ BARCODE_INTERLEAVE_2_5 = 3
+};
+
+/**
+ * @brief The Barcode error correction level enumeration.
+ *
+ * @since_tizen 2.4
+ * @remarks This is unavailable for 1D barcodes.
+ */
+enum BarcodeQRErrorCorrectionLevel
+{
+ BARCODE_QR_ECC_UNAVAILABLE = 0,
+ BARCODE_QR_ECC_LOW = 1,
+ BARCODE_QR_ECC_MEDIUM = 2,
+ BARCODE_QR_ECC_QUARTILE = 3,
+ BARCODE_QR_ECC_HIGH = 4
+};
+
+
+/**
+ * @brief The Barcode encoding mode enumeration.
+ *
+ * @since_tizen 2.4
+ * @remarks This is unavailable for 1D barcodes.
+ */
+enum BarcodeQREncodingMode
+{
+ BARCODE_QR_MODE_NUMERIC = 1,
+ BARCODE_QR_MODE_ALPHANUMERIC = 1,
+ BARCODE_QR_MODE_BYTE = 0,
+ BARCODE_QR_MODE_UTF8 = 1,
+ BARCODE_QR_MODE_KANJI = 3,
+ BARCODE_QR_MODE_UNAVAILABLE
+};
+
+/**
+ * @brief The Barcode image format enumeration.
+ *
+ * @since_tizen 2.4
+ */
+enum BarcodeImageFormat
+{
+ BARCODE_IMAGE_JPG,
+ BARCODE_IMAGE_PNG,
+ BARCODE_IMAGE_BMP
+};
+
+/**
+ * @brief The Barcode error enumeration.
+ *
+ * @since_tizen 2.4
+ */
+enum BarcodeError
+{
+ BARCODE_ERROR_NONE = 0,
+ BARCODE_WARNING_INVALID_OPTION = 2,
+ BARCODE_ERROR_TOO_LONG = 5,
+ BARCODE_ERROR_INVALID_DATA = 6,
+ BARCODE_ERROR_INVALID_CHECK = 7,
+ BARCODE_ERROR_INVALID_OPTION = 8,
+ BARCODE_ERROR_ENCODING_PROBLEM = 9,
+ BARCODE_ERROR_FILE_ACCESS = 10,
+ BARCODE_ERROR_MEMORY = 11,
+ BARCODE_ERROR_INVALID_PATH =12,
+};
+
+} /* Barcode */
+} /* MediaVision */
+
+#endif /* __BARCODEOPTIONS_H__ */
+
diff --git a/mv_barcode/barcode_generator/include/mv_barcode_generate_open.h b/mv_barcode/barcode_generator/include/mv_barcode_generate_open.h
new file mode 100644
index 00000000..d3134ace
--- /dev/null
+++ b/mv_barcode/barcode_generator/include/mv_barcode_generate_open.h
@@ -0,0 +1,109 @@
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_MEDIAVISION_BARCODE_GENERATE_OPEN_H__
+#define __TIZEN_MEDIAVISION_BARCODE_GENERATE_OPEN_H__
+
+#include "mv_barcode_generate.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file mv_barcode_generate_open.h
+ * @brief This file contains the Media Vision barcode generate module API for
+ * the open module.
+ */
+
+/**
+ * @brief Generates @ref mv_source_h with barcode image.
+ *
+ * @since_tizen 2.4
+ * @param [in] engine_cfg The handle to the configuration of the engine
+ * @param [in] message The message to be encoded in the barcode
+ * @param [in] type Type of the barcode to be generated
+ * @param [in] qr_enc_mode Encoding mode for the message (only for QR codes;
+ * for 1D barcodes set this parameter to
+ * @ref MV_BARCODE_QR_MODE_UNAVAILABLE)
+ * @param [in] qr_ecc Error correction level (only for QR codes; for
+ * 1D barcodes set this parameter to
+ * @ref MV_BARCODE_QR_ECC_UNAVAILABLE)
+ * @param [in] qr_version QR code version (for 1D barcodes set this
+ * parameter to 0)
+ * @param [in, out] image The media source handle which will be used to
+ * fill by the buffer with generated image
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_MSG_TOO_LONG Too long or short message
+ * @retval #MEDIA_VISION_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see mv_barcode_generate_image_open()
+ */
+int mv_barcode_generate_source_open(mv_engine_config_h engine_cfg,
+ const char *message,
+ mv_barcode_type_e type,
+ mv_barcode_qr_mode_e qr_enc_mode,
+ mv_barcode_qr_ecc_e qr_ecc,
+ int qr_version,
+ mv_source_h image);
+
+/**
+ * @brief Generates image file with barcode.
+ *
+ * @since_tizen 2.4
+ * @param [in] engine_cfg The handle to the configuration of the engine
+ * @param [in] message The message to be encoded in the barcode
+ * @param [in] image_width The width of the generated image
+ * @param [in] image_height The height of the generated image
+ * @param [in] type Type of the barcode to be generated
+ * @param [in] qr_enc_mode Encoding mode for the message (only for QR codes;
+ * for 1D barcodes set this parameter to
+ * @ref MV_BARCODE_QR_MODE_UNAVAILABLE)
+ * @param [in] qr_ecc Error correction level (only for QR codes; for
+ * 1D barcodes set this parameter to
+ * @ref MV_BARCODE_QR_ECC_UNAVAILABLE)
+ * @param [in] qr_version QR code version (for 1D barcodes set this
+ * parameter to 0)
+ * @param [in] image_path The path to the file that has to be generated
+ * @param [in] image_format The format of the output image
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_MSG_TOO_LONG Too long or short message
+ * @retval #MEDIA_VISION_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #MEDIA_VISION_ERROR_INVALID_PATH Invalid path
+ *
+ * @see mv_barcode_generate_source_open()
+ */
+int mv_barcode_generate_image_open(
+ mv_engine_config_h engine_cfg,
+ const char *message,
+ int image_width,
+ int image_height,
+ mv_barcode_type_e type,
+ mv_barcode_qr_mode_e qr_enc_mode,
+ mv_barcode_qr_ecc_e qr_ecc,
+ int qr_version,
+ const char *image_path,
+ mv_barcode_image_format_e image_format);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIAVISION_BARCODE_GENERATE_OPEN_H__ */