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
|
||||
|
||||
2014-06-16 2.5.0 HaO
|
||||
First implementation
|
||||
2016-09-14 2.5.1 HaO
|
||||
- Added Codablock F options "-rows".
|
||||
First implementation
|
||||
2016-09-14 2.5.1 HaO
|
||||
- Added Codablock F options "-rows".
|
||||
- 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)
|
||||
@ -75,7 +77,7 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* > File option defines */
|
||||
|
||||
#define VERSION "2.5.1"
|
||||
#define VERSION "2.5.2"
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* >>>>> Hepler defines */
|
||||
@ -180,8 +182,8 @@ static char *s_code_list[] = {
|
||||
"RSSExpandedStacked-CC",
|
||||
"Channel",
|
||||
"CodeOne",
|
||||
"GridMatrix",
|
||||
"DotCode",
|
||||
"GridMatrix",
|
||||
"DotCode",
|
||||
"HanXin",
|
||||
NULL};
|
||||
|
||||
@ -269,8 +271,8 @@ static int s_code_number[] = {
|
||||
BARCODE_RSS_EXPSTACK_CC,
|
||||
BARCODE_CHANNEL,
|
||||
BARCODE_CODEONE,
|
||||
BARCODE_GRIDMATRIX,
|
||||
BARCODE_DOTCODE,
|
||||
BARCODE_GRIDMATRIX,
|
||||
BARCODE_DOTCODE,
|
||||
BARCODE_HANXIN,
|
||||
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"
|
||||
" -bg color: set background color as 6 hex rrggbb\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"
|
||||
" -rotate angle: Image rotation by 0,90 or 270 degrees\n"
|
||||
" -secure integer: EC Level (PDF417, QR)\n"
|
||||
@ -516,7 +518,7 @@ static int Encode(Tcl_Interp *interp, int objc,
|
||||
break;
|
||||
case iBorder:
|
||||
case iHeight:
|
||||
case iCols:
|
||||
case iCols:
|
||||
case iRows:
|
||||
case iVers:
|
||||
case iSecure:
|
||||
@ -638,12 +640,12 @@ static int Encode(Tcl_Interp *interp, int objc,
|
||||
}
|
||||
break;
|
||||
case iSecure:
|
||||
case iMode:
|
||||
case iMode:
|
||||
case iRows:
|
||||
/* >> Int in Option 1 */
|
||||
if ( (optionIndex==iSecure && (intValue < 1 || intValue > 8))
|
||||
|| (optionIndex==iMode && (intValue < 0 || intValue > 6))
|
||||
|| (optionIndex==iRows && (intValue < 0 || intValue > 44)))
|
||||
|| (optionIndex==iRows && (intValue < 0 || intValue > 44)))
|
||||
{
|
||||
Tcl_SetObjResult(interp,
|
||||
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_NewStringObj("Unknown photo image", -1));
|
||||
fError = 1;
|
||||
} else {
|
||||
int pitch;
|
||||
Tk_PhotoImageBlock sImageBlock;
|
||||
/* 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) );
|
||||
} else {
|
||||
Tk_PhotoImageBlock sImageBlock;
|
||||
sImageBlock.pixelPtr = (unsigned char *) hSymbol->bitmap;
|
||||
sImageBlock.width = hSymbol->bitmap_width;
|
||||
sImageBlock.height = hSymbol->bitmap_height;
|
||||
sImageBlock.pitch = pitch * -1;
|
||||
sImageBlock.height = hSymbol->bitmap_height;
|
||||
sImageBlock.pitch = 3*hSymbol->bitmap_width;
|
||||
sImageBlock.pixelSize = 3;
|
||||
sImageBlock.offset[0] = 0;
|
||||
sImageBlock.offset[1] = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user