mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
tcl backend 2.5.2: Include the upstream reverted image format
This commit is contained in:
parent
d3b6c9ec07
commit
674687feba
@ -32,10 +32,12 @@
|
|||||||
History
|
History
|
||||||
|
|
||||||
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
|
2016-09-14 2.5.1 HaO
|
||||||
- Added Codablock F options "-rows".
|
- Added Codablock F options "-rows".
|
||||||
- Adopted to new image format of zint
|
- Adopted to new image format of zint
|
||||||
|
2016-10-14 2.5.2 HaO
|
||||||
|
- Include the upstream reverted image format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
||||||
@ -75,7 +77,7 @@
|
|||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* > File option defines */
|
/* > File option defines */
|
||||||
|
|
||||||
#define VERSION "2.5.1"
|
#define VERSION "2.5.2"
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* >>>>> Hepler defines */
|
/* >>>>> Hepler defines */
|
||||||
@ -180,8 +182,8 @@ static char *s_code_list[] = {
|
|||||||
"RSSExpandedStacked-CC",
|
"RSSExpandedStacked-CC",
|
||||||
"Channel",
|
"Channel",
|
||||||
"CodeOne",
|
"CodeOne",
|
||||||
"GridMatrix",
|
"GridMatrix",
|
||||||
"DotCode",
|
"DotCode",
|
||||||
"HanXin",
|
"HanXin",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
@ -269,8 +271,8 @@ static int s_code_number[] = {
|
|||||||
BARCODE_RSS_EXPSTACK_CC,
|
BARCODE_RSS_EXPSTACK_CC,
|
||||||
BARCODE_CHANNEL,
|
BARCODE_CHANNEL,
|
||||||
BARCODE_CODEONE,
|
BARCODE_CODEONE,
|
||||||
BARCODE_GRIDMATRIX,
|
BARCODE_GRIDMATRIX,
|
||||||
BARCODE_DOTCODE,
|
BARCODE_DOTCODE,
|
||||||
BARCODE_HANXIN,
|
BARCODE_HANXIN,
|
||||||
0};
|
0};
|
||||||
|
|
||||||
@ -293,7 +295,7 @@ static char help_message[] = "zint tcl(stub,obj) dll\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, 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, 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"
|
||||||
@ -516,7 +518,7 @@ static int Encode(Tcl_Interp *interp, int objc,
|
|||||||
break;
|
break;
|
||||||
case iBorder:
|
case iBorder:
|
||||||
case iHeight:
|
case iHeight:
|
||||||
case iCols:
|
case iCols:
|
||||||
case iRows:
|
case iRows:
|
||||||
case iVers:
|
case iVers:
|
||||||
case iSecure:
|
case iSecure:
|
||||||
@ -638,12 +640,12 @@ static int Encode(Tcl_Interp *interp, int objc,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case iSecure:
|
case iSecure:
|
||||||
case iMode:
|
case iMode:
|
||||||
case iRows:
|
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)))
|
|| (optionIndex==iRows && (intValue < 0 || intValue > 44)))
|
||||||
{
|
{
|
||||||
Tcl_SetObjResult(interp,
|
Tcl_SetObjResult(interp,
|
||||||
Tcl_NewStringObj("secure/mode/rows out of range", -1));
|
Tcl_NewStringObj("secure/mode/rows out of range", -1));
|
||||||
@ -783,23 +785,12 @@ static int Encode(Tcl_Interp *interp, int objc,
|
|||||||
Tcl_SetObjResult(interp,
|
Tcl_SetObjResult(interp,
|
||||||
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 = pitch * -1;
|
sImageBlock.pitch = 3*hSymbol->bitmap_width;
|
||||||
sImageBlock.pixelSize = 3;
|
sImageBlock.pixelSize = 3;
|
||||||
sImageBlock.offset[0] = 0;
|
sImageBlock.offset[0] = 0;
|
||||||
sImageBlock.offset[1] = 1;
|
sImageBlock.offset[1] = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user