- Compile-able with MS-VC6

- Compile-able with MS-VC2015+QT5.18
- transbarency in TCL backend
- correct TCL demo
- README changes
This commit is contained in:
Harald Oehlmann 2020-08-04 15:49:25 +02:00
parent 398b1aba2b
commit b78fa8cf2f
7 changed files with 164 additions and 107 deletions

8
README
View File

@ -261,6 +261,14 @@ Bugs:
- Human readable representation: Code128, Code39, Code93 special characters - Human readable representation: Code128, Code39, Code93 special characters
are shown by a blank. are shown by a blank.
- ITF14: Ticket 201: allow bind option - ITF14: Ticket 201: allow bind option
Version 2.9.1 not released jet:
Changes:
- Implement transparency support
- -nobackground option added
- -fg and -bg may contain an alpha channel
- structure zint_symbol may now contain an alpha channel as output
- Added DPD Symbology
Bugs:
CONTACT US CONTACT US
---------- ----------

View File

@ -113,19 +113,18 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
int colour_index, colour_rect_counter; int colour_index, colour_rect_counter;
char ps_color[30]; char ps_color[30];
int draw_background = 1; int draw_background = 1;
if (strlen(symbol->bgcolour) > 6) {
if ((ctoi(symbol->bgcolour[6]) == 0) && (ctoi(symbol->bgcolour[7]) == 0)) {
draw_background = 0;
}
}
struct zint_vector_rect *rect; struct zint_vector_rect *rect;
struct zint_vector_hexagon *hex; struct zint_vector_hexagon *hex;
struct zint_vector_circle *circle; struct zint_vector_circle *circle;
struct zint_vector_string *string; struct zint_vector_string *string;
const char *locale = NULL; const char *locale = NULL;
if (strlen(symbol->bgcolour) > 6) {
if ((ctoi(symbol->bgcolour[6]) == 0) && (ctoi(symbol->bgcolour[7]) == 0)) {
draw_background = 0;
}
}
if (symbol->output_options & BARCODE_STDOUT) { if (symbol->output_options & BARCODE_STDOUT) {
feps = stdout; feps = stdout;
} else { } else {

View File

@ -132,6 +132,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
struct zint_vector_string *string; struct zint_vector_string *string;
char colour_code[7]; char colour_code[7];
int html_len;
#ifdef _MSC_VER #ifdef _MSC_VER
char* html_string; char* html_string;
@ -151,7 +152,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
bg_alpha = (16 * ctoi(symbol->bgcolour[6])) + ctoi(symbol->bgcolour[7]); bg_alpha = (16 * ctoi(symbol->bgcolour[6])) + ctoi(symbol->bgcolour[7]);
} }
int html_len = strlen((char *)symbol->text) + 1; html_len = strlen((char *)symbol->text) + 1;
for (i = 0; i < (int) strlen((char *)symbol->text); i++) { for (i = 0; i < (int) strlen((char *)symbol->text); i++) {
switch(symbol->text[i]) { switch(symbol->text[i]) {

View File

@ -20,6 +20,9 @@
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <QFontMetrics> #include <QFontMetrics>
/* the following include was necessary to compile with QT 5.18 on Windows */
/* QT 8.7 did not require it. */
#include <QPainterPath>
namespace Zint { namespace Zint {
static const char* fontstyle = "Arial"; static const char* fontstyle = "Arial";
@ -84,13 +87,8 @@ namespace Zint {
} }
strcpy(m_zintSymbol->fgcolour, m_fgColor.name().toLatin1().right(6)); strcpy(m_zintSymbol->fgcolour, m_fgColor.name().toLatin1().right(6));
if (m_fgColor.alpha() != 0xff) {
strcat(m_zintSymbol->fgcolour, m_fgColor.name(QColor::HexArgb).toLatin1().mid(1,2));
}
strcpy(m_zintSymbol->bgcolour, m_bgColor.name().toLatin1().right(6)); strcpy(m_zintSymbol->bgcolour, m_bgColor.name().toLatin1().right(6));
if (m_bgColor.alpha() != 0xff) {
strcat(m_zintSymbol->bgcolour, m_bgColor.name(QColor::HexArgb).toLatin1().mid(1,2));
}
strcpy(m_zintSymbol->primary, m_primaryMessage.toLatin1().left(127)); strcpy(m_zintSymbol->primary, m_primaryMessage.toLatin1().left(127));
} }

View File

@ -52,7 +52,7 @@ proc Generate {} {
::zintimg blank ::zintimg blank
::zintimg configure -width 0 -height 0 ::zintimg configure -width 0 -height 0
catch { catch {
zint encode [.e get] ::zintimg -barcode [.c get] -scale $sx {*}[.o get]} e] zint encode [.e get] ::zintimg -barcode [.c get] -scale $sx {*}[.o get]
} }
} }
} }

View File

@ -39,39 +39,39 @@
2016-10-14 2.5.2 HaO 2016-10-14 2.5.2 HaO
- Include the upstream reverted image format - Include the upstream reverted image format
2016-12-12 2.5.3 HaO 2016-12-12 2.5.3 HaO
- No changes here, take 2.5.1 framework files - No changes here, take 2.5.1 framework files
2017-05-12 2.6.0 HaO 2017-05-12 2.6.0 HaO
- No changes here, take 2.6 framework files - No changes here, take 2.6 framework files
2017-08-29 2.6.1 HaO 2017-08-29 2.6.1 HaO
- Framework 2.6.1 extensions - Framework 2.6.1 extensions
- EAN/UPC Codes with included check digit - EAN/UPC Codes with included check digit
- UPNQR Code - UPNQR Code
- Misspelled symbology: AztecRunes - Misspelled symbology: AztecRunes
2017-10-23 2.6.2 HaO 2017-10-23 2.6.2 HaO
- Framework 2.6.2 bugfixes - Framework 2.6.2 bugfixes
- Allow dll unload - Allow dll unload
2018-02-13 2.6.3 HaO 2018-02-13 2.6.3 HaO
- Framework trunk update - Framework trunk update
- Added VIN and MailMark symbologies. - Added VIN and MailMark symbologies.
2018-11-02 2.6.4 HaO 2018-11-02 2.6.4 HaO
- Framework trunk update - Framework trunk update
- Add options -bold, -dotted, -dotsize, -dmre, -eci - Add options -bold, -dotted, -dotsize, -dmre, -eci
- Implemented ECI logic - Implemented ECI logic
2019-09-01 2.6.5 HaO 2019-09-01 2.6.5 HaO
- Framework 2.6.5 update - Framework 2.6.5 update
- Add option -gssep - Add option -gssep
2019-09-18 2.6.6 HaO 2019-09-18 2.6.6 HaO
- Framework 2.6.6 update - Framework 2.6.6 update
2019-10-07 2.6.7 HaO 2019-10-07 2.6.7 HaO
- Framework 2.6.7 update - Framework 2.6.7 update
2019-12-05 2.7.0 HaO 2019-12-05 2.7.0 HaO
- Framework 2.7.0 update - Framework 2.7.0 update
- Add symbology rmqr - Add symbology rmqr
2020-02-01 2.7.1 HaO 2020-02-01 2.7.1 HaO
- Framework 2.7.1 update - Framework 2.7.1 update
2020-04-06 HaO 2020-04-06 HaO
- Added option -fullmultibyte - Added option -fullmultibyte
2020-04-07 2.8.0 HaO 2020-04-07 2.8.0 HaO
- Added symbology "UltraCode". - Added symbology "UltraCode".
2020-05-19 HaO 2020-05-19 HaO
- Added option -separator to specify stacked symbology separator width - Added option -separator to specify stacked symbology separator width
@ -95,6 +95,11 @@
- RSS14Omni-CC -> GS1DataBarStackedOmni-CC - RSS14Omni-CC -> GS1DataBarStackedOmni-CC
- RSSExpandedStacked-CC -> GS1DataBarExpandedStacked-CC - RSSExpandedStacked-CC -> GS1DataBarExpandedStacked-CC
*** Potential incompatibility *** *** Potential incompatibility ***
2020-08-04 2.10.0 HaO
- added symbology "DPDCode"
- Alpha channel support added:
- added option -nobackground
- also allow RRGGBBAA for -fg and -bg options
*/ */
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
@ -206,7 +211,7 @@ static char *s_code_list[] = {
"ISBN", "ISBN",
"RM4SCC", "RM4SCC",
"Datamatrix", "Datamatrix",
"EAN14", "EAN14",
"VIN", "VIN",
"CodablockF", "CodablockF",
"NVE18", "NVE18",
@ -216,6 +221,7 @@ static char *s_code_list[] = {
"GS1DataBarSstackedOmni", "GS1DataBarSstackedOmni",
"GS1DataBarExpandedStacked", "GS1DataBarExpandedStacked",
"Planet", "Planet",
"DPDCode",
"MicroPDF417", "MicroPDF417",
"USPSIntelligentMail", "USPSIntelligentMail",
"Plessey", "Plessey",
@ -234,7 +240,7 @@ static char *s_code_list[] = {
"HIBC-CodablockF", "HIBC-CodablockF",
"HIBCAztec", "HIBCAztec",
"DotCode", "DotCode",
"HanXin", "HanXin",
"MailMark", "MailMark",
"AztecRunes", "AztecRunes",
"Code32", "Code32",
@ -251,8 +257,8 @@ static char *s_code_list[] = {
"Channel", "Channel",
"CodeOne", "CodeOne",
"GridMatrix", "GridMatrix",
"UPNQR", "UPNQR",
"UltraCode", "UltraCode",
"rMQR", "rMQR",
NULL}; NULL};
@ -266,7 +272,7 @@ static int s_code_number[] = {
BARCODE_CODE39, BARCODE_CODE39,
BARCODE_EXCODE39, BARCODE_EXCODE39,
BARCODE_EANX, BARCODE_EANX,
BARCODE_EANX_CHK, BARCODE_EANX_CHK,
BARCODE_GS1_128, BARCODE_GS1_128,
BARCODE_CODABAR, BARCODE_CODABAR,
BARCODE_CODE128, BARCODE_CODE128,
@ -281,7 +287,7 @@ static int s_code_number[] = {
BARCODE_DBAR_EXP, BARCODE_DBAR_EXP,
BARCODE_TELEPEN, BARCODE_TELEPEN,
BARCODE_UPCA, BARCODE_UPCA,
BARCODE_UPCA_CHK, BARCODE_UPCA_CHK,
BARCODE_UPCE, BARCODE_UPCE,
BARCODE_UPCE_CHK, BARCODE_UPCE_CHK,
BARCODE_POSTNET, BARCODE_POSTNET,
@ -303,8 +309,8 @@ static int s_code_number[] = {
BARCODE_ISBNX, BARCODE_ISBNX,
BARCODE_RM4SCC, BARCODE_RM4SCC,
BARCODE_DATAMATRIX, BARCODE_DATAMATRIX,
BARCODE_EAN14, BARCODE_EAN14,
BARCODE_VIN, BARCODE_VIN,
BARCODE_CODABLOCKF, BARCODE_CODABLOCKF,
BARCODE_NVE18, BARCODE_NVE18,
BARCODE_JAPANPOST, BARCODE_JAPANPOST,
@ -313,6 +319,7 @@ static int s_code_number[] = {
BARCODE_DBAR_OMNSTK, BARCODE_DBAR_OMNSTK,
BARCODE_DBAR_EXPSTK, BARCODE_DBAR_EXPSTK,
BARCODE_PLANET, BARCODE_PLANET,
BARCODE_DPD,
BARCODE_MICROPDF417, BARCODE_MICROPDF417,
BARCODE_USPS_IMAIL, BARCODE_USPS_IMAIL,
BARCODE_PLESSEY, BARCODE_PLESSEY,
@ -330,9 +337,9 @@ static int s_code_number[] = {
BARCODE_HIBC_MICPDF, BARCODE_HIBC_MICPDF,
BARCODE_HIBC_BLOCKF, BARCODE_HIBC_BLOCKF,
BARCODE_HIBC_AZTEC, BARCODE_HIBC_AZTEC,
BARCODE_DOTCODE, BARCODE_DOTCODE,
BARCODE_HANXIN, BARCODE_HANXIN,
BARCODE_MAILMARK, BARCODE_MAILMARK,
BARCODE_AZRUNE, BARCODE_AZRUNE,
BARCODE_CODE32, BARCODE_CODE32,
BARCODE_EANX_CC, BARCODE_EANX_CC,
@ -348,8 +355,8 @@ static int s_code_number[] = {
BARCODE_CHANNEL, BARCODE_CHANNEL,
BARCODE_CODEONE, BARCODE_CODEONE,
BARCODE_GRIDMATRIX, BARCODE_GRIDMATRIX,
BARCODE_UPNQR, BARCODE_UPNQR,
BARCODE_ULTRA, BARCODE_ULTRA,
BARCODE_RMQR, BARCODE_RMQR,
0}; 0};
@ -384,7 +391,7 @@ static char *s_eci_list[] = {
"big5", /*28: ** Big-5 (Taiwan) Chinese Character Set*/ "big5", /*28: ** Big-5 (Taiwan) Chinese Character Set*/
"euc-cn", /*29: ** GB (PRC) Chinese Character Set*/ "euc-cn", /*29: ** GB (PRC) Chinese Character Set*/
"iso2022-kr", /*30: ** Korean Character Set (KSX1001:1998)*/ "iso2022-kr", /*30: ** Korean Character Set (KSX1001:1998)*/
NULL NULL
}; };
/* The ECI numerical number to pass to ZINT */ /* The ECI numerical number to pass to ZINT */
@ -419,11 +426,12 @@ static char help_message[] = "zint tcl(stub,obj) dll\n"
" -box bool: box around bar code, size set be -border\n" " -box bool: box around bar code, size set be -border\n"
" -height integer: Symbol height in modules\n" " -height integer: Symbol height in modules\n"
" -whitesp integer: horizontal quiet zone in modules\n" " -whitesp integer: horizontal quiet zone in modules\n"
" -fg color: set foreground color as 6 hex rrggbb\n" " -fg color: set foreground color as 6 or 8 hex rrggbbaa\n"
" -bg color: set background color as 6 hex rrggbb\n" " -bg color: set background color as 6 or 8 hex rrggbbaa\n"
" -nobackground bool: set background transparent\n"
" -cols integer: PDF417, Codablock F: number of columns\n" " -cols integer: PDF417, Codablock F: number of columns\n"
" -rows integer: Codablock F: number of rows\n" " -rows integer: Codablock F: number of rows\n"
" -vers integer: Symbology option\n" " -vers integer: Symbology option\n"
" -dmre bool: Allow Data Matrix Rectangular Extended\n" " -dmre bool: Allow Data Matrix Rectangular Extended\n"
" -separator 0..4 (default: 1) : Stacked symbologies: separator width\n" " -separator 0..4 (default: 1) : Stacked symbologies: separator width\n"
" -rotate angle: Image rotation by 0,90 or 270 degrees\n" " -rotate angle: Image rotation by 0,90 or 270 degrees\n"
@ -433,9 +441,9 @@ static char help_message[] = "zint tcl(stub,obj) dll\n"
" -dotty bool: use dots instead of boxes for matrix codes\n" " -dotty bool: use dots instead of boxes for matrix codes\n"
" -dotsize number: radius ratio of dots from 0.01 to 1.0\n" " -dotsize number: radius ratio of dots from 0.01 to 1.0\n"
" -scale double: Scale the image to this factor\n" " -scale double: Scale the image to this factor\n"
" -format binary|unicode|gs1: input data format. Default:unicode\n" " -format binary|unicode|gs1: input data format. Default:unicode\n"
" -fullmultibyte: allow multibyte compaction for xQR, HanXin, Gridmatrix\n" " -fullmultibyte: allow multibyte compaction for xQR, HanXin, Gridmatrix\n"
" -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n" " -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n"
" -eci number: ECI to use\n" " -eci number: ECI to use\n"
" -notext bool: no interpretation line\n" " -notext bool: no interpretation line\n"
" -square bool: force Data Matrix symbols to be square\n" " -square bool: force Data Matrix symbols to be square\n"
@ -494,8 +502,8 @@ EXPORT int Zint_Init (Tcl_Interp *interp)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags) EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags)
{ {
// Allow unload // Allow unload
return TCL_OK; return TCL_OK;
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* >>>>> Called routine */ /* >>>>> Called routine */
@ -593,7 +601,7 @@ static int Encode(Tcl_Interp *interp, int objc,
int destY0 = 0; int destY0 = 0;
int destWidth = 0; int destWidth = 0;
int destHeight = 0; int destHeight = 0;
int ECIIndex = 0; int ECIIndex = 0;
int fFullMultiByte = 0; int fFullMultiByte = 0;
int addon_gap = 0; int addon_gap = 0;
int Separator = 1; int Separator = 1;
@ -624,13 +632,14 @@ static int Encode(Tcl_Interp *interp, int objc,
char *optionList[] = { char *optionList[] = {
"-addongap", "-barcode", "-bg", "-bind", "-bold", "-border", "-box", "-addongap", "-barcode", "-bg", "-bind", "-bold", "-border", "-box",
"-cols", "-dmre", "-dotsize", "-dotty", "-eci", "-fg", "-format", "-cols", "-dmre", "-dotsize", "-dotty", "-eci", "-fg", "-format",
"-gssep", "-height", "-init", "-mode", "-notext", "-primary", "-gssep", "-height", "-init", "-mode", "-nobackground", "-notext",
"-rotate", "-rows", "-scale", "-secure", "-smalltext", "-square", "-primary", "-rotate", "-rows", "-scale", "-secure", "-smalltext",
"-to", "-vers", "-whitesp", "-fullmultibyte", "-separator", NULL}; "-square", "-to", "-vers", "-whitesp", "-fullmultibyte",
"-separator", NULL};
enum iOption { enum iOption {
iAddonGap, iBarcode, iBG, iBind, iBold, iBorder, iBox, iCols, iAddonGap, iBarcode, iBG, iBind, iBold, iBorder, iBox, iCols,
iDMRE, iDotSize, iDotty, iECI, iFG, iFormat, iGSSep, iHeight, iDMRE, iDotSize, iDotty, iECI, iFG, iFormat, iGSSep, iHeight,
iInit, iMode, iNoText, iPrimary, iRotate, iRows, iInit, iMode, iNoBackground, iNoText, iPrimary, iRotate, iRows,
iScale, iSecure, iSmallText, iSquare, iTo, iVers, iScale, iSecure, iSmallText, iSquare, iTo, iVers,
iWhiteSp, iFullMultiByte, iSeparator iWhiteSp, iFullMultiByte, iSeparator
}; };
@ -654,12 +663,13 @@ static int Encode(Tcl_Interp *interp, int objc,
case iBox: case iBox:
case iDMRE: case iDMRE:
case iDotty: case iDotty:
case iGSSep: case iGSSep:
case iInit: case iInit:
case iNoBackground:
case iNoText: case iNoText:
case iSmallText: case iSmallText:
case iSquare: case iSquare:
case iFullMultiByte: case iFullMultiByte:
/* >> Binary options */ /* >> Binary options */
if (TCL_OK != Tcl_GetBooleanFromObj(interp, objv[optionPos+1], if (TCL_OK != Tcl_GetBooleanFromObj(interp, objv[optionPos+1],
&intValue)) &intValue))
@ -671,9 +681,9 @@ static int Encode(Tcl_Interp *interp, int objc,
case iBG: case iBG:
/* >> Colors */ /* >> Colors */
pStr = Tcl_GetStringFromObj(objv[optionPos+1],&lStr); pStr = Tcl_GetStringFromObj(objv[optionPos+1],&lStr);
if (lStr != 6) { if (lStr != 6 && lStr != 8) {
Tcl_SetObjResult(interp, Tcl_SetObjResult(interp,
Tcl_NewStringObj("Color is not 6 hex",-1)); Tcl_NewStringObj("Color is not 6 or 8 hex",-1));
fError = 1; fError = 1;
} }
break; break;
@ -774,10 +784,10 @@ static int Encode(Tcl_Interp *interp, int objc,
} else { } else {
hSymbol->output_options &= ~GS1_GS_SEPARATOR; hSymbol->output_options &= ~GS1_GS_SEPARATOR;
} }
break; break;
case iFullMultiByte: case iFullMultiByte:
fFullMultiByte = intValue; fFullMultiByte = intValue;
break; break;
case iECI: case iECI:
if(Tcl_GetIndexFromObj(interp, objv[optionPos+1], if(Tcl_GetIndexFromObj(interp, objv[optionPos+1],
(const char **) s_eci_list,"-eci", optionPos, &ECIIndex) (const char **) s_eci_list,"-eci", optionPos, &ECIIndex)
@ -803,12 +813,17 @@ static int Encode(Tcl_Interp *interp, int objc,
} }
break; break;
case iFG: case iFG:
strncpy(hSymbol->fgcolour, pStr, 6); strncpy(hSymbol->fgcolour, pStr, lStr);
hSymbol->fgcolour[6]='\0'; hSymbol->fgcolour[lStr]='\0';
break; break;
case iBG: case iBG:
strncpy(hSymbol->bgcolour, pStr, 6); strncpy(hSymbol->bgcolour, pStr, lStr);
hSymbol->bgcolour[6]='\0'; hSymbol->bgcolour[lStr]='\0';
break;
case iNoBackground:
if (intValue) {
strcpy(hSymbol->bgcolour, "ffffff00");
}
break; break;
case iNoText: case iNoText:
hSymbol->show_hrt = (intValue?0:1); hSymbol->show_hrt = (intValue?0:1);
@ -987,7 +1002,7 @@ static int Encode(Tcl_Interp *interp, int objc,
} }
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* >>> option_3 is set by two values depending on the symbology */ /* >>> option_3 is set by two values depending on the symbology */
/* On wrong symbology, the option is ignored(as does the zint program)*/ /* On wrong symbology, the option is ignored(as does the zint program)*/
if (fFullMultiByte && is_fullmultibyte(hSymbol)) { if (fFullMultiByte && is_fullmultibyte(hSymbol)) {
hSymbol->option_3 = ZINT_FULL_MULTIBYTE; hSymbol->option_3 = ZINT_FULL_MULTIBYTE;
@ -1034,10 +1049,10 @@ static int Encode(Tcl_Interp *interp, int objc,
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* >>> Build symbol graphic */ /* >>> Build symbol graphic */
if (! fError ) { if (! fError ) {
int ErrorNumber; int ErrorNumber;
Tk_PhotoHandle hPhoto; Tk_PhotoHandle hPhoto;
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
/* call zint graphic creation to buffer */ /* call zint graphic creation to buffer */
ErrorNumber = ZBarcode_Encode_and_Buffer(hSymbol, ErrorNumber = ZBarcode_Encode_and_Buffer(hSymbol,
(unsigned char *) pStr, lStr, rotate_angle); (unsigned char *) pStr, lStr, rotate_angle);
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
@ -1058,15 +1073,37 @@ static int Encode(Tcl_Interp *interp, int objc,
fError = 1; fError = 1;
} else { } else {
Tk_PhotoImageBlock sImageBlock; Tk_PhotoImageBlock sImageBlock;
sImageBlock.pixelPtr = (unsigned char *) hSymbol->bitmap; char * pImageRGBA = NULL;
sImageBlock.width = hSymbol->bitmap_width; if (hSymbol->alphamap == NULL) {
sImageBlock.height = hSymbol->bitmap_height; sImageBlock.pixelPtr = (unsigned char *) hSymbol->bitmap;
sImageBlock.pitch = 3*hSymbol->bitmap_width; sImageBlock.width = hSymbol->bitmap_width;
sImageBlock.pixelSize = 3; sImageBlock.height = hSymbol->bitmap_height;
sImageBlock.offset[0] = 0; sImageBlock.pitch = 3*hSymbol->bitmap_width;
sImageBlock.offset[1] = 1; sImageBlock.pixelSize = 3;
sImageBlock.offset[2] = 2; sImageBlock.offset[0] = 0;
sImageBlock.offset[3] = 0; sImageBlock.offset[1] = 1;
sImageBlock.offset[2] = 2;
sImageBlock.offset[3] = 0;
} else {
int index;
/* Alpha channel present - prepare the image data in rgba order */
pImageRGBA = ckalloc(hSymbol->bitmap_width*hSymbol->bitmap_height*4);
for (index = 0; index < hSymbol->bitmap_width*hSymbol->bitmap_height; index++) {
pImageRGBA[index*4] = hSymbol->bitmap[index*3];
pImageRGBA[index*4+1] = hSymbol->bitmap[index*3+1];
pImageRGBA[index*4+2] = hSymbol->bitmap[index*3+2];
pImageRGBA[index*4+3] = hSymbol->alphamap[index];
}
sImageBlock.pixelPtr = (unsigned char *) pImageRGBA;
sImageBlock.width = hSymbol->bitmap_width;
sImageBlock.height = hSymbol->bitmap_height;
sImageBlock.pitch = 4*hSymbol->bitmap_width;
sImageBlock.pixelSize = 4;
sImageBlock.offset[0] = 0;
sImageBlock.offset[1] = 1;
sImageBlock.offset[2] = 2;
sImageBlock.offset[3] = 3;
}
if (0 == destWidth) { if (0 == destWidth) {
destWidth = hSymbol->bitmap_width; destWidth = hSymbol->bitmap_width;
} }
@ -1079,6 +1116,9 @@ static int Encode(Tcl_Interp *interp, int objc,
{ {
fError = 1; fError = 1;
} }
if (pImageRGBA != NULL) {
ckfree(pImageRGBA);
}
} }
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/

View File

@ -2,28 +2,29 @@ Harald Oehlmann
2017-03-29 2017-03-29
How to build qzint.exe using: How to build qzint.exe using:
- QT 5.7 installed in C:\qt\Qt5.7.1 - QT 5.15.0 source package
32 bit (use the offline installer and the 32 bit package)
- MS Visual Studio 2015 (VC12) - MS Visual Studio 2015 (VC12)
Build static Qt: Build static Qt:
--------------- ---------------
- Download: qt-opensource-windows-x86-msvc2015-5.7.1.exe - Go to: https://www.qt.io/offline-installers
- Klick option "source" and deselect all other special modules. - Download the zip "Qt 5.15.x source packages" (nearly 1 GB):
- Install to C:\qt\5.7.1 (or another folder, then change the folders in the following) http://download.qt.io/official_releases/qt/5.15/5.15.0/single/qt-everywhere-src-5.15.0.zip
- Install Python (ActivePython-2.7.13.2713-win64-x64-401787.exe) - Unzip to C:\qt resulting in having the source in c:\qt\qt-everywhere-src-5.15.0
- Install Python (ActivePython-3.7.4.0000-win64-x64-e0b99d60.msi) and make it available within the path.
- Start the VS2015 x86 native console by the start menu entry: - Start the VS2015 x86 native console by the start menu entry:
Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts\VS2015 x86 Native Tools-Eingabeaufforderung Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts\VS2015 x86 Native Tools-Eingabeaufforderung
- cd C:\Qt\5.7.1\5.7\Src - cd C:\qt\qt-everywhere-src-5.15.0
- set QMAKESPEC=win32-msvc2015 - configure.bat -static -release -prefix c:\qt\5.15.0static -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -mp
- configure.bat -static -release -prefix c:\qt\5.7.1static -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -mp
One may set another destination folder after the -prefix option. One may set another destination folder after the -prefix option.
Attention, the upper command is one long line. Attention, the upper command is one long line.
- nmake - nmake
- nmake install - nmake install
The last 3 commands run around 3 hours The last 3 commands run around 3 hours.
Make sure, that python may be found in the path.
- the huge source folder may be deleted to save around 6GB of space.
Zint Folder structure: Zint Folder structure:
---------------------- ----------------------
@ -44,17 +45,27 @@ Build targets "Release Library" for zlib and libpng.
Build zint: Build zint:
----------- -----------
- Start in the start menu: "VS2015 x86 Native Tools-Eingabeaufforderung" - Start in the start menu: "VS2015 x86 Native Tools-Eingabeaufforderung"
- set QTDIR=C:\Qt\5.7.1static - set QTDIR=C:\Qt\5.15.0static
- set PATH=C:\Qt\5.7.1static\bin;%PATH% - set PATH=C:\Qt\5.15.0static\bin;%PATH%
- set QMAKESPEC=win32-msvc2015 - set QMAKESPEC=win32-msvc
- cd $ZH - cd $ZH
- cd backend_qt - cd backend_qt
- qmake backend_qt.pro - qmake backend_qt.pro
- nmake clean - nmake clean
- nmake release - nmake release
- cd ..\frontend_qt - cd ..\frontend_qt
- qmake frontend_qt.pro - qmake frontend_qt.pro
- nmake clean - nmake clean
- nmake release - nmake release
-> qzint.exe is in the release folder -> qzint.exe is in the release folder
Note:
For me, qt5core.lib was not found in the last step.
I only found the solution to add:
QMAKE_LIBDIR += C:/qt/5.15.0static/lib
into frontend_qt.pro
There is for sure a better solution.