2016-09-14 2.5.1 HaO

-   Added Codablock F options "-rows".
-   Adopted to new image format of zint
This commit is contained in:
Harald Oehlmann 2016-09-14 09:51:54 +02:00
parent b49f3f0255
commit 6d3b167ead
2 changed files with 831 additions and 776 deletions

View File

@ -33,6 +33,9 @@
2014-06-16 2.5.0 HaO 2014-06-16 2.5.0 HaO
First implementation First implementation
2016-09-14 2.5.1 HaO
- Added Codablock F options "-rows".
- Adopted to new image format of zint
*/ */
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
@ -72,7 +75,7 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* > File option defines */ /* > File option defines */
#define VERSION "2.5.0" #define VERSION "2.5.1"
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* >>>>> Hepler defines */ /* >>>>> Hepler defines */
@ -178,6 +181,8 @@ static char *s_code_list[] = {
"Channel", "Channel",
"CodeOne", "CodeOne",
"GridMatrix", "GridMatrix",
"DotCode",
"HanXin",
NULL}; NULL};
static int s_code_number[] = { static int s_code_number[] = {
@ -265,6 +270,8 @@ static int s_code_number[] = {
BARCODE_CHANNEL, BARCODE_CHANNEL,
BARCODE_CODEONE, BARCODE_CODEONE,
BARCODE_GRIDMATRIX, BARCODE_GRIDMATRIX,
BARCODE_DOTCODE,
BARCODE_HANXIN,
0}; 0};
@ -285,7 +292,8 @@ static char help_message[] = "zint tcl(stub,obj) dll\n"
" -border integer: with of a border around the symbol. Use with -bind/-box 1\n" " -border integer: with of a border around the symbol. Use with -bind/-box 1\n"
" -fg color: set foreground color as 6 hex rrggbb\n" " -fg color: set foreground color as 6 hex rrggbb\n"
" -bg color: set background color as 6 hex rrggbb\n" " -bg color: set background color as 6 hex rrggbb\n"
" -cols integer: PDF417: number of columns\n" " -cols integer: PDF417, Codablock F: number of columns\n"
" -rows integer: Codablock F: number of rows\n"
" -vers integer: Symbology option, QR-Code, Plessy\n" " -vers integer: Symbology option, QR-Code, Plessy\n"
" -rotate angle: Image rotation by 0,90 or 270 degrees\n" " -rotate angle: Image rotation by 0,90 or 270 degrees\n"
" -secure integer: EC Level (PDF417, QR)\n" " -secure integer: EC Level (PDF417, QR)\n"
@ -449,13 +457,13 @@ static int Encode(Tcl_Interp *interp, int objc,
/* Option list and indexes */ /* Option list and indexes */
char *optionList[] = { char *optionList[] = {
"-bind", "-box", "-barcode", "-height", "-whitesp", "-border", "-bind", "-box", "-barcode", "-height", "-whitesp", "-border",
"-fg", "-bg", "-cols", "-vers", "-rotate", "-fg", "-bg", "-cols", "-rows", "-vers", "-rotate",
"-secure", "-mode", "-primary", "-scale", "-format", "-secure", "-mode", "-primary", "-scale", "-format",
"-notext", "-square", "-dmre", "-init", "-smalltext", "-to", "-notext", "-square", "-dmre", "-init", "-smalltext", "-to",
NULL}; NULL};
enum iOption { enum iOption {
iBind, iBox, iBarcode, iHeight, iWhiteSp, iBorder, iBind, iBox, iBarcode, iHeight, iWhiteSp, iBorder,
iFG, iBG, iCols, iVers, iRotate, iFG, iBG, iCols, iRows, iVers, iRotate,
iSecure, iMode, iPrimary, iScale, iFormat, iSecure, iMode, iPrimary, iScale, iFormat,
iNoText, iSquare, iDMRE, iInit, iSmallText, iTo iNoText, iSquare, iDMRE, iInit, iSmallText, iTo
}; };
@ -509,6 +517,7 @@ static int Encode(Tcl_Interp *interp, int objc,
case iBorder: case iBorder:
case iHeight: case iHeight:
case iCols: case iCols:
case iRows:
case iVers: case iVers:
case iSecure: case iSecure:
case iMode: case iMode:
@ -618,7 +627,7 @@ static int Encode(Tcl_Interp *interp, int objc,
case iVers: case iVers:
/* >> Int in Option 2 */ /* >> Int in Option 2 */
if (intValue < 1 if (intValue < 1
|| (optionIndex==iCols && intValue > 30) || (optionIndex==iCols && intValue > 66)
|| (optionIndex==iVers && intValue > 47)) || (optionIndex==iVers && intValue > 47))
{ {
Tcl_SetObjResult(interp, Tcl_SetObjResult(interp,
@ -630,12 +639,14 @@ static int Encode(Tcl_Interp *interp, int objc,
break; break;
case iSecure: case iSecure:
case iMode: case iMode:
case iRows:
/* >> Int in Option 1 */ /* >> Int in Option 1 */
if ( (optionIndex==iSecure && (intValue < 1 || intValue > 8)) if ( (optionIndex==iSecure && (intValue < 1 || intValue > 8))
|| (optionIndex==iMode && (intValue < 0 || intValue > 6))) || (optionIndex==iMode && (intValue < 0 || intValue > 6))
|| (optionIndex==iRows && (intValue < 0 || intValue > 44)))
{ {
Tcl_SetObjResult(interp, Tcl_SetObjResult(interp,
Tcl_NewStringObj("secure/mode out of range", -1)); Tcl_NewStringObj("secure/mode/rows out of range", -1));
fError = 1; fError = 1;
} else { } else {
hSymbol->option_1 = intValue; hSymbol->option_1 = intValue;
@ -713,8 +724,9 @@ static int Encode(Tcl_Interp *interp, int objc,
)) ))
{ {
fError = 1; fError = 1;
} break;
} }
}
break;
case iFormat: case iFormat:
/* >> Format of the input data */ /* >> Format of the input data */
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
@ -772,11 +784,22 @@ static int Encode(Tcl_Interp *interp, int objc,
Tcl_NewStringObj("Unknown photo image", -1)); Tcl_NewStringObj("Unknown photo image", -1));
fError = 1; fError = 1;
} else { } else {
int pitch;
Tk_PhotoImageBlock sImageBlock; Tk_PhotoImageBlock sImageBlock;
sImageBlock.pixelPtr = (unsigned char *) hSymbol->bitmap; /* The format is:
* RGBRGB..., pad to multiple of 4 bytes
* Y Axis inverted.
* So the pitch is negative and filled to 4 bytes
* The origin pointer is the last row start
*/
pitch = 3 * hSymbol->bitmap_width;
if ( pitch % 4 != 0)
pitch += 4 - (pitch % 4);
sImageBlock.pixelPtr = (unsigned char *) (hSymbol->bitmap
+ pitch * (hSymbol->bitmap_height - 1) );
sImageBlock.width = hSymbol->bitmap_width; sImageBlock.width = hSymbol->bitmap_width;
sImageBlock.height = hSymbol->bitmap_height; sImageBlock.height = hSymbol->bitmap_height;
sImageBlock.pitch = 3*hSymbol->bitmap_width; sImageBlock.pitch = pitch * -1;
sImageBlock.pixelSize = 3; sImageBlock.pixelSize = 3;
sImageBlock.offset[0] = 0; sImageBlock.offset[0] = 0;
sImageBlock.offset[1] = 1; sImageBlock.offset[1] = 1;

View File

@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /YX /FD /c # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\backend" /I "C:\Program Files\tcl8.5\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /D "NO_PNG" /YX /FD /D ZINT_VERSION="\"2.5.0\"" /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\backend" /I "C:\myprograms\tcl8.5\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /D "NO_PNG" /YX /FD /D ZINT_VERSION="\"2.5.0\"" /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD BASE RSC /l 0x407 /d "NDEBUG"
@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tclstub85.lib tkstub85.lib /nologo /dll /machine:I386 /out:"zint.dll" /libpath:"C:\Program Files\tcl8.5\lib" # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tclstub85.lib tkstub85.lib /nologo /dll /machine:I386 /out:"zint.dll" /libpath:"C:\myprograms\tcl8.5\lib"
!ELSEIF "$(CFG)" == "zint_tcl - Win32 Debug" !ELSEIF "$(CFG)" == "zint_tcl - Win32 Debug"
@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /YX /FD /GZ /c # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\backend" /I "C:\Program Files\tcl8.5\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /D "NO_PNG" /YX /FD /GZ /D ZINT_VERSION="\"2.5.0\"" /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\backend" /I "C:\myprograms\tcl8.5\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /D "NO_PNG" /FR /YX /FD /GZ /D ZINT_VERSION="\"2.5.0\"" /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD BASE RSC /l 0x407 /d "_DEBUG"
@ -79,7 +79,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tclstub85.lib tkstub85.lib /nologo /dll /debug /machine:I386 /out:"Debug/zint.dll" /pdbtype:sept /libpath:"C:\Program Files\tcl8.5\lib" # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tclstub85.lib tkstub85.lib /nologo /dll /debug /machine:I386 /out:"Debug/zint.dll" /pdbtype:sept /libpath:"C:\myprograms\tcl8.5\lib"
!ENDIF !ENDIF
@ -104,6 +104,14 @@ SOURCE=..\backend\aztec.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\backend\bmp.c
# End Source File
# Begin Source File
SOURCE=..\backend\codablock.c
# End Source File
# Begin Source File
SOURCE=..\backend\code.c SOURCE=..\backend\code.c
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -136,6 +144,18 @@ SOURCE=..\backend\dmatrix.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\backend\dotcode.c
# End Source File
# Begin Source File
SOURCE=..\backend\eci.c
# End Source File
# Begin Source File
SOURCE=..\backend\gif.c
# End Source File
# Begin Source File
SOURCE=..\backend\gridmtx.c SOURCE=..\backend\gridmtx.c
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -144,6 +164,10 @@ SOURCE=..\backend\gs1.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\backend\hanxin.c
# End Source File
# Begin Source File
SOURCE=..\backend\imail.c SOURCE=..\backend\imail.c
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -164,6 +188,10 @@ SOURCE=..\backend\medical.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\backend\pcx.c
# End Source File
# Begin Source File
SOURCE=..\backend\pdf417.c SOURCE=..\backend\pdf417.c
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -188,6 +216,10 @@ SOURCE=..\backend\qr.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\backend\raster.c
# End Source File
# Begin Source File
SOURCE=..\backend\reedsol.c SOURCE=..\backend\reedsol.c
# End Source File # End Source File
# Begin Source File # Begin Source File