#define MV_BARCODE_GENERATE_ATTR_COLOR_BACK "MV_BARCODE_GENERATE_ATTR_COLOR_BACK"
/**
+ * @brief Defines MV_BARCODE_GENERATE_ATTR_DATA_SHAPE to set
+ Barcode's data shape attribute of the engine configuration.
+ *
+ * @since_tizen 7.5
+ * @see mv_barcode_generate_attr_shape_e
+ */
+#define MV_BARCODE_GENERATE_ATTR_DATA_SHAPE "MV_BARCODE_GENERATE_ATTR_DATA_SHAPE"
+
+/**
+ * @brief Defines MV_BARCODE_GENERATE_ATTR_FINDER_SHAPE to set
+ Barcode's finder shape attribute of the engine configuration.
+ *
+ * @since_tizen 7.5
+ * @see mv_barcode_generate_attr_shape_e
+ */
+#define MV_BARCODE_GENERATE_ATTR_FINDER_SHAPE "MV_BARCODE_GENERATE_ATTR_FINDER_SHAPE"
+
+/**
+ * @brief Enumeration to shape attribute.
+ * @details Using this enumeration, various data or finder patterns can be set in
+ * mv_engine_config_set_int_attribute. If the pattern is not supported, it will
+ * be simply ignored.
+ *
+ * @see mv_engine_config_set_int_attribute
+ * @since_tizen 7.5
+ */
+typedef enum {
+ MV_BARCODE_GENERATE_ATTR_SHAPE_RECT, /**< Rectangular */
+ MV_BARCODE_GENERATE_ATTR_SHAPE_ROUND_RECT, /**< Round rectangular */
+ MV_BARCODE_GENERATE_ATTR_SHAPE_CIRCLE, /**< Circle */
+} mv_barcode_generate_attr_shape_e;
+
+/**
* @brief Enumeration to text attribute.
*
* @since_tizen @if MOBILE 2.4 @else 3.0 @endif
"name" : "MV_3D_POINTCLOUD_OUTPUT_FILE_PATH",
"type" : "string",
"value" : "/opt/usr/home/owner/media/Images"
+ },
+ {
+ "name" : "MV_BARCODE_GENERATE_ATTR_DATA_SHAPE",
+ "type" : "integer",
+ "value" : 0
}
]
}
#include "BarcodeOptions.h"
#include <string>
-
+#include <EngineConfig.h>
/**
* @file BarcodeGenerator.h
* @brief This file contains the BarcodeGenerator class.
*/
static int generateBarcodeToImage(const std::string &imageFileName, BarcodeImageFormat imageFormat,
const int imageWidth, const int imageHeight, const std::string &message,
- BarcodeType type,
+ BarcodeType type, Common::EngineConfig *engineCfg,
BarcodeQREncodingMode encodingMode = BARCODE_QR_MODE_UNAVAILABLE,
BarcodeQRErrorCorrectionLevel correctionLevel = BARCODE_QR_ECC_UNAVAILABLE,
int qrVersion = 0, int showText = 0, char *fgcolour = NULL, char *bgcolur = NULL);
*/
static int generateBarcodeToBuffer(unsigned char **imageBuffer, unsigned int *imageWidth, unsigned int *imageHeight,
unsigned int *imageChannels, const std::string &message, BarcodeType type,
+ Common::EngineConfig *engineCfg,
BarcodeQREncodingMode encodingMode = BARCODE_QR_MODE_UNAVAILABLE,
BarcodeQRErrorCorrectionLevel correctionLevel = BARCODE_QR_ECC_UNAVAILABLE,
int qrVersion = 0, int showText = 0, char *fgcolour = NULL,
#include <cstring>
#include <vector>
#include <unistd.h>
+#include <mv_barcode_generate.h>
#define ZINT_COLOUR_SIZE 10
int createBarcode(const std::string &message, BarcodeType type, BarcodeQREncodingMode encodingMode,
BarcodeQRErrorCorrectionLevel correctionLevel, int qrVersion, int showText, char *fgcolour,
- char *bgcolour, zint_symbol *symbol)
+ char *bgcolour, zint_symbol *symbol, Common::EngineConfig *engineCfg)
{
/* set input values */
symbol->symbology = type;
symbol->border_width = 1;
symbol->height = 50;
+ if (engineCfg) {
+ int value;
+ int ret = engineCfg->getIntegerAttribute(MV_BARCODE_GENERATE_ATTR_DATA_SHAPE, &value);
+
+ if (ret == MEDIA_VISION_ERROR_NONE) {
+ switch (value) {
+ case MV_BARCODE_GENERATE_ATTR_SHAPE_CIRCLE:
+ symbol->output_options |= BARCODE_DATA_CIRCLE;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
if (type == BARCODE_QR) {
symbol->whitespace_width = 0;
} else {
int BarcodeGenerator::generateBarcodeToImage(const std::string &imageFileName, BarcodeImageFormat imageFormat,
const int imageWidth, const int imageHeight, const std::string &message,
- BarcodeType type, BarcodeQREncodingMode encodingMode,
+ BarcodeType type, Common::EngineConfig *engineCfg,
+ BarcodeQREncodingMode encodingMode,
BarcodeQRErrorCorrectionLevel correctionLevel, int qrVersion, int showText,
char *fgcolour, char *bgcolour)
{
}
int error = createBarcode(message, type, encodingMode, correctionLevel, qrVersion, showText, fgcolour, bgcolour,
- symbol);
+ symbol, engineCfg);
if (error != BARCODE_ERROR_NONE) {
LOGE("Barcode creation failed, clean memory");
int BarcodeGenerator::generateBarcodeToBuffer(unsigned char **imageBuffer, unsigned int *imageWidth,
unsigned int *imageHeight, unsigned int *imageChannels,
const std::string &message, BarcodeType type,
- BarcodeQREncodingMode encodingMode,
+ Common::EngineConfig *engineCfg, BarcodeQREncodingMode encodingMode,
BarcodeQRErrorCorrectionLevel correctionLevel, int qrVersion,
int showText, char *fgcolour, char *bgcolour)
{
}
int error = createBarcode(message, type, encodingMode, correctionLevel, qrVersion, showText, fgcolour, bgcolour,
- symbol);
+ symbol, engineCfg);
if (error != BARCODE_ERROR_NONE) {
LOGE("Barcode creation failed, clean memory");
char *fgcolour = NULL;
char *bgcolour = NULL;
+ auto engineCfg = static_cast<MediaVision::Common::EngineConfig *>(engine_cfg);
+
error = getColorFromEngine(engine_cfg, type, showText, &fgcolour, &bgcolour);
if (error != MEDIA_VISION_ERROR_NONE) {
LOGE("getColorFromEngine failed");
unsigned int imageChannels = 0u;
error = BarcodeGenerator::generateBarcodeToBuffer(&imageBuffer, &imageWidth, &imageHeight, &imageChannels,
- messageStr, convertBarcodeType(type),
+ messageStr, convertBarcodeType(type), engineCfg,
convertEncodingMode(qr_enc_mode), convertECC(qr_ecc), qr_version,
showText, fgcolour, bgcolour);
char *fgcolour = NULL;
char *bgcolour = NULL;
+ auto engineCfg = static_cast<MediaVision::Common::EngineConfig *>(engine_cfg);
+
error = getColorFromEngine(engine_cfg, type, showText, &fgcolour, &bgcolour);
if (error != MEDIA_VISION_ERROR_NONE) {
LOGE("getColorFromEngine failed");
error = BarcodeGenerator::generateBarcodeToImage(std::string(image_path), convertImageFormat(image_format),
image_width, image_height, messageStr, convertBarcodeType(type),
- convertEncodingMode(qr_enc_mode), convertECC(qr_ecc), qr_version,
- showText, fgcolour, bgcolour);
+ engineCfg, convertEncodingMode(qr_enc_mode), convertECC(qr_ecc),
+ qr_version, showText, fgcolour, bgcolour);
free(fgcolour);
free(bgcolour);
MEDIA_VISION_ERROR_NONE);
ASSERT_EQ(mv_destroy_engine_config(engine_cfg), MEDIA_VISION_ERROR_NONE);
}
+
+TEST_F(TestBarcodeGen, DataCirclePositiveQR)
+{
+ ASSERT_EQ(mv_create_engine_config(&engine_cfg), MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_engine_config_set_string_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_COLOR_FRONT, "3366ff"),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_engine_config_set_int_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_DATA_SHAPE,
+ MV_BARCODE_GENERATE_ATTR_SHAPE_CIRCLE),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_barcode_generate_image(engine_cfg, "https://samsung.com/", 512, 512, type, qr_enc_mode, qr_ecc,
+ qr_version, test_file.c_str(), image_format),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_destroy_engine_config(engine_cfg), MEDIA_VISION_ERROR_NONE);
+}
\ No newline at end of file