zint-barcode-generator/backend_qt4/qzint.h

122 lines
3 KiB
C
Raw Normal View History

2008-07-18 10:48:31 -04: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>
#include <QPainter>
2008-07-18 10:48:31 -04:00
#include "zint.h"
namespace Zint
{
class QZint
2008-07-18 10:48:31 -04:00
{
2008-10-09 05:55:18 -04:00
private:
2008-07-18 10:48:31 -04:00
public:
enum BorderType{NO_BORDER=0, BIND=2, BOX=4};
2008-10-09 05:55:18 -04:00
enum AspectRatioMode{IgnoreAspectRatio=0, KeepAspectRatio=1, CenterBarCode=2};
2008-07-18 10:48:31 -04:00
public:
QZint();
~QZint();
2008-07-18 10:48:31 -04:00
int symbol();
2008-07-18 10:48:31 -04:00
void setSymbol(int symbol);
QString text();
2008-07-18 10:48:31 -04:00
void setText(const QString & text);
QString primaryMessage();
2008-07-18 10:48:31 -04:00
void setPrimaryMessage(const QString & primaryMessage);
2008-07-18 10:48:31 -04:00
void setHeight(int height);
int height();
2008-07-18 10:48:31 -04:00
void setWidth(int width);
int width();
2009-11-03 05:53:18 -05:00
void setOption3(int option);
QColor fgColor();
2008-07-18 10:48:31 -04:00
void setFgColor(const QColor & fgColor);
QColor bgColor();
2008-07-18 10:48:31 -04:00
void setBgColor(const QColor & bgColor);
BorderType borderType();
void setBorderType(BorderType border);
int borderWidth();
void setBorderWidth(int boderWidth);
int pdf417CodeWords();
void setPdf417CodeWords(int pdf417CodeWords);
int securityLevel();
void setSecurityLevel(int securityLevel);
2009-05-19 10:04:49 -04:00
float scale();
void setScale(float scale);
int mode();
void setMode(int securityLevel);
2009-04-26 18:04:51 -04:00
void setInputMode(int input_mode);
void setWhitespace(int whitespace);
2009-05-19 10:04:49 -04:00
QString error_message();
2008-10-09 05:55:18 -04:00
void render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode=IgnoreAspectRatio);
2008-07-18 10:48:31 -04:00
const QString & lastError();
bool hasErrors();
2009-05-19 10:04:49 -04:00
bool save_to_file(QString filename);
2009-11-03 05:53:18 -05:00
void setHideText(bool hide);
2009-07-07 15:10:22 -04:00
2008-07-18 10:48:31 -04:00
private:
void encode();
2009-07-07 04:41:14 -04:00
int module_set(int y_coord, int x_coord);
2008-07-18 10:48:31 -04:00
private:
int m_symbol;
QString m_text;
QString m_primaryMessage;
int m_height;
BorderType m_border;
int m_borderWidth;
2008-07-18 10:48:31 -04:00
int m_width;
int m_securityLevel;
int m_pdf417CodeWords;
2009-04-26 18:04:51 -04:00
int m_input_mode;
2008-07-18 10:48:31 -04:00
QColor m_fgColor;
QColor m_bgColor;
QString m_lastError;
int m_error;
int m_whitespace;
2008-07-18 10:48:31 -04:00
zint_symbol * m_zintSymbol;
2009-05-19 10:04:49 -04:00
float m_scale;
2009-11-03 05:53:18 -05:00
int m_option_3;
bool m_hidetext;
2008-07-18 10:48:31 -04:00
};
}
#endif