2008-07-19 02:48:31 +12:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2008 by BogDan Vatra *
|
|
|
|
* bogdan@licentia.eu *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef BARCODERENDER_H
|
|
|
|
#define BARCODERENDER_H
|
|
|
|
#include <QColor>
|
2008-09-18 05:36:08 +12:00
|
|
|
#include <QPainter>
|
2008-07-19 02:48:31 +12:00
|
|
|
|
|
|
|
#include "zint.h"
|
|
|
|
|
|
|
|
namespace Zint
|
|
|
|
{
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
class QZint
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-10-09 22:55:18 +13:00
|
|
|
private:
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
public:
|
2008-11-04 02:31:23 +13:00
|
|
|
enum BorderType{NO_BORDER=0, BIND=2, BOX=4};
|
2008-10-09 22:55:18 +13:00
|
|
|
enum AspectRatioMode{IgnoreAspectRatio=0, KeepAspectRatio=1, CenterBarCode=2};
|
2008-07-19 02:48:31 +12:00
|
|
|
|
|
|
|
public:
|
2008-09-19 02:43:54 +12:00
|
|
|
QZint();
|
|
|
|
~QZint();
|
2008-07-19 02:48:31 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
int symbol() const;
|
2008-07-19 02:48:31 +12:00
|
|
|
void setSymbol(int symbol);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QString text() const;
|
2008-07-19 02:48:31 +12:00
|
|
|
void setText(const QString & text);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QString primaryMessage() const;
|
2008-07-19 02:48:31 +12:00
|
|
|
void setPrimaryMessage(const QString & primaryMessage);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
void setHeight(int height);
|
|
|
|
int height();
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
void setWidth(int width);
|
|
|
|
int width();
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2009-11-03 23:53:18 +13:00
|
|
|
void setOption3(int option);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QColor fgColor() const;
|
2008-07-19 02:48:31 +12:00
|
|
|
void setFgColor(const QColor & fgColor);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QColor bgColor() const;
|
2008-07-19 02:48:31 +12:00
|
|
|
void setBgColor(const QColor & bgColor);
|
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
BorderType borderType() const;
|
2008-09-18 05:36:08 +12:00
|
|
|
void setBorderType(BorderType border);
|
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
int borderWidth() const;
|
2008-09-18 05:36:08 +12:00
|
|
|
void setBorderWidth(int boderWidth);
|
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
int pdf417CodeWords() const;
|
2008-09-18 05:36:08 +12:00
|
|
|
void setPdf417CodeWords(int pdf417CodeWords);
|
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
int securityLevel() const;
|
2008-09-18 05:36:08 +12:00
|
|
|
void setSecurityLevel(int securityLevel);
|
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
float scale() const;
|
2009-05-20 02:04:49 +12:00
|
|
|
void setScale(float scale);
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2016-09-19 01:09:58 +12:00
|
|
|
void setDotSize(float dot_size);
|
2009-05-20 02:04:49 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
int mode() const;
|
2008-11-04 02:31:23 +13:00
|
|
|
void setMode(int securityLevel);
|
|
|
|
|
2009-04-27 10:04:51 +12:00
|
|
|
void setInputMode(int input_mode);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2009-05-03 18:35:18 +12:00
|
|
|
void setWhitespace(int whitespace);
|
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QString error_message() const;
|
2009-05-20 02:04:49 +12:00
|
|
|
|
2008-10-09 22:55:18 +13:00
|
|
|
void render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode=IgnoreAspectRatio);
|
2008-07-19 02:48:31 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
const QString & lastError() const;
|
2008-07-19 02:48:31 +12:00
|
|
|
bool hasErrors();
|
2009-05-20 02:04:49 +12:00
|
|
|
|
|
|
|
bool save_to_file(QString filename);
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2009-11-03 23:53:18 +13:00
|
|
|
void setHideText(bool hide);
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2016-12-15 12:33:17 +13:00
|
|
|
void setTargetSize(int width, int height);
|
2009-07-08 07:10:22 +12:00
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
private:
|
|
|
|
void encode();
|
2017-09-11 03:03:09 +12:00
|
|
|
int module_set(int y_coord, int x_coord) const;
|
2008-07-19 02:48:31 +12:00
|
|
|
|
|
|
|
private:
|
|
|
|
int m_symbol;
|
|
|
|
QString m_text;
|
|
|
|
QString m_primaryMessage;
|
|
|
|
int m_height;
|
|
|
|
BorderType m_border;
|
2009-05-03 18:35:18 +12:00
|
|
|
int m_borderWidth;
|
2008-07-19 02:48:31 +12:00
|
|
|
int m_width;
|
|
|
|
int m_securityLevel;
|
|
|
|
int m_pdf417CodeWords;
|
2009-04-27 10:04:51 +12:00
|
|
|
int m_input_mode;
|
2008-07-19 02:48:31 +12:00
|
|
|
QColor m_fgColor;
|
|
|
|
QColor m_bgColor;
|
|
|
|
QString m_lastError;
|
2008-09-18 05:36:08 +12:00
|
|
|
int m_error;
|
2009-05-03 18:35:18 +12:00
|
|
|
int m_whitespace;
|
2008-07-19 02:48:31 +12:00
|
|
|
zint_symbol * m_zintSymbol;
|
2009-05-20 02:04:49 +12:00
|
|
|
float m_scale;
|
2009-11-03 23:53:18 +13:00
|
|
|
int m_option_3;
|
|
|
|
bool m_hidetext;
|
2017-09-11 03:03:09 +12:00
|
|
|
float m_dot_size;
|
|
|
|
int target_size_horiz;
|
|
|
|
int target_size_vert;
|
2008-07-19 02:48:31 +12:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
2017-10-24 08:37:52 +13:00
|
|
|
|