Transfers colour values to libzint on save

This commit is contained in:
hooper114 2009-05-27 08:01:55 +00:00
parent d593111979
commit 1007d2b08e

View File

@ -224,6 +224,9 @@ bool QZint::save_to_file(QString filename)
if (m_zintSymbol) if (m_zintSymbol)
ZBarcode_Delete(m_zintSymbol); ZBarcode_Delete(m_zintSymbol);
QString fg_colour_hash = m_fgColor.name();
QString bg_colour_hash = m_bgColor.name();
m_lastError.clear(); m_lastError.clear();
m_zintSymbol = ZBarcode_Create(); m_zintSymbol = ZBarcode_Create();
m_zintSymbol->output_options=m_border; m_zintSymbol->output_options=m_border;
@ -241,6 +244,10 @@ bool QZint::save_to_file(QString filename)
QByteArray fstr=filename.left(255).toAscii(); QByteArray fstr=filename.left(255).toAscii();
strcpy(m_zintSymbol->primary,pstr.data()); strcpy(m_zintSymbol->primary,pstr.data());
strcpy(m_zintSymbol->outfile,fstr.data()); strcpy(m_zintSymbol->outfile,fstr.data());
QByteArray fgcol=fg_colour_hash.right(6).toAscii();
QByteArray bgcol=bg_colour_hash.right(6).toAscii();
strcpy(m_zintSymbol->fgcolour,fgcol.data());
strcpy(m_zintSymbol->bgcolour,bgcol.data());
int error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char*)bstr.data()); int error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char*)bstr.data());
if (error > WARN_INVALID_OPTION) if (error > WARN_INVALID_OPTION)
m_lastError=m_zintSymbol->errtxt; m_lastError=m_zintSymbol->errtxt;