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
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)
@ -72,7 +75,7 @@
/*----------------------------------------------------------------------------*/
/* > File option defines */
#define VERSION "2.5.0"
#define VERSION "2.5.1"
/*----------------------------------------------------------------------------*/
/* >>>>> Hepler defines */
@ -178,6 +181,8 @@ static char *s_code_list[] = {
"Channel",
"CodeOne",
"GridMatrix",
"DotCode",
"HanXin",
NULL};
static int s_code_number[] = {
@ -265,6 +270,8 @@ static int s_code_number[] = {
BARCODE_CHANNEL,
BARCODE_CODEONE,
BARCODE_GRIDMATRIX,
BARCODE_DOTCODE,
BARCODE_HANXIN,
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"
" -fg color: set foreground 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"
" -rotate angle: Image rotation by 0,90 or 270 degrees\n"
" -secure integer: EC Level (PDF417, QR)\n"
@ -449,13 +457,13 @@ static int Encode(Tcl_Interp *interp, int objc,
/* Option list and indexes */
char *optionList[] = {
"-bind", "-box", "-barcode", "-height", "-whitesp", "-border",
"-fg", "-bg", "-cols", "-vers", "-rotate",
"-fg", "-bg", "-cols", "-rows", "-vers", "-rotate",
"-secure", "-mode", "-primary", "-scale", "-format",
"-notext", "-square", "-dmre", "-init", "-smalltext", "-to",
NULL};
enum iOption {
iBind, iBox, iBarcode, iHeight, iWhiteSp, iBorder,
iFG, iBG, iCols, iVers, iRotate,
iFG, iBG, iCols, iRows, iVers, iRotate,
iSecure, iMode, iPrimary, iScale, iFormat,
iNoText, iSquare, iDMRE, iInit, iSmallText, iTo
};
@ -509,6 +517,7 @@ static int Encode(Tcl_Interp *interp, int objc,
case iBorder:
case iHeight:
case iCols:
case iRows:
case iVers:
case iSecure:
case iMode:
@ -618,7 +627,7 @@ static int Encode(Tcl_Interp *interp, int objc,
case iVers:
/* >> Int in Option 2 */
if (intValue < 1
|| (optionIndex==iCols && intValue > 30)
|| (optionIndex==iCols && intValue > 66)
|| (optionIndex==iVers && intValue > 47))
{
Tcl_SetObjResult(interp,
@ -630,12 +639,14 @@ static int Encode(Tcl_Interp *interp, int objc,
break;
case iSecure:
case iMode:
case iRows:
/* >> Int in Option 1 */
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_NewStringObj("secure/mode out of range", -1));
Tcl_NewStringObj("secure/mode/rows out of range", -1));
fError = 1;
} else {
hSymbol->option_1 = intValue;
@ -713,8 +724,9 @@ static int Encode(Tcl_Interp *interp, int objc,
))
{
fError = 1;
} break;
}
}
break;
case iFormat:
/* >> Format of the input data */
/*----------------------------------------------------------------*/
@ -772,11 +784,22 @@ static int Encode(Tcl_Interp *interp, int objc,
Tcl_NewStringObj("Unknown photo image", -1));
fError = 1;
} else {
int pitch;
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.height = hSymbol->bitmap_height;
sImageBlock.pitch = 3*hSymbol->bitmap_width;
sImageBlock.pitch = pitch * -1;
sImageBlock.pixelSize = 3;
sImageBlock.offset[0] = 0;
sImageBlock.offset[1] = 1;

View File

@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# 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 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 MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
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 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"
@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# 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 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 MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
@ -79,7 +79,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
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 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
@ -104,6 +104,14 @@ SOURCE=..\backend\aztec.c
# End 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
# End Source File
# Begin Source File
@ -136,6 +144,18 @@ SOURCE=..\backend\dmatrix.c
# End 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
# End Source File
# Begin Source File
@ -144,6 +164,10 @@ SOURCE=..\backend\gs1.c
# End Source File
# Begin Source File
SOURCE=..\backend\hanxin.c
# End Source File
# Begin Source File
SOURCE=..\backend\imail.c
# End Source File
# Begin Source File
@ -164,6 +188,10 @@ SOURCE=..\backend\medical.c
# End Source File
# Begin Source File
SOURCE=..\backend\pcx.c
# End Source File
# Begin Source File
SOURCE=..\backend\pdf417.c
# End Source File
# Begin Source File
@ -188,6 +216,10 @@ SOURCE=..\backend\qr.c
# End Source File
# Begin Source File
SOURCE=..\backend\raster.c
# End Source File
# Begin Source File
SOURCE=..\backend\reedsol.c
# End Source File
# Begin Source File