Skip to content

Commit

Permalink
Merge pull request #13 from jshor/create-file
Browse files Browse the repository at this point in the history
Create file
  • Loading branch information
jshor authored Oct 30, 2018
2 parents a1a862f + 17e796a commit 0db8692
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"node-pre-gyp"
],
"scripts": {
"start": "node ./foo.js",
"install": "node-pre-gyp install --fallback-to-build",
"test": "./node_modules/istanbul/lib/cli.js cover _mocha -- -R spec ./src/**/*.test.js",
"prepublish": "npm ls",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getSymbol(obj) {
option1: obj.option1 || -1,
option2: obj.option2 || -1,
option3: obj.option3 || -1,
showHumanReadableText: obj.showHumanReadableText || 0
showHumanReadableText: obj.showHumanReadableText || 1
// input_mode: BINARY_MODE,
};
}
Expand Down
11 changes: 7 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var defaultSymbol = {
option1: -1,
option2: -1,
option3: -1,
showHumanReadableText: 1 // show human-readable text
showHumanReadableText: true // show human-readable text
// input_mode: BINARY_MODE,
};

Expand All @@ -43,8 +43,8 @@ var defaultSymbol = {
function validateSymbol(symbologyStruct) {
var keys = Object.keys(defaultSymbol);

for(var i=0; i<keys.length; i++) {
if(!symbologyStruct[keys[i]]) {
for (var i=0; i<keys.length; i++) {
if (!symbologyStruct.hasOwnProperty(keys[i])) {
symbologyStruct[keys[i]] = defaultSymbol[keys[i]];
}
}
Expand Down Expand Up @@ -146,7 +146,10 @@ function pngRender(bitmap, width, height) {
exp.createStream = function(symbol, barcodeData, outputType) {
outputType = outputType || exp.Output.PNG
symbol.fileName = 'out.' + outputType
symbol.outputOptions = 8; // force buffer to write to rendered_data

if (outputType !== exp.Output.PNG) {
symbol.outputOptions = 8; // force buffer to write to rendered_data
}

var res = createSymbology(symbol, barcodeData, 'createStream');

Expand Down
4 changes: 2 additions & 2 deletions src/lib/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ namespace symbology {
}

// colors
copyArgStr(*args[6], (char*)&symbol->fgcolour[0], sizeof(symbol->fgcolour));
copyArgStr(*args[7], (char*)&symbol->bgcolour[0], sizeof(symbol->bgcolour));
copyArgStr(*args[6], (char*)&symbol->bgcolour[0], sizeof(symbol->bgcolour));
copyArgStr(*args[7], (char*)&symbol->fgcolour[0], sizeof(symbol->fgcolour));

// file name to render
copyArgStr(*args[8], (char*)&symbol->outfile[0], sizeof(symbol->outfile));
Expand Down
14 changes: 6 additions & 8 deletions src/lib/zint/png.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,20 +456,18 @@ int png_to_file(struct zint_symbol *symbol, int image_height, int image_width, c
}
}

/**
* Commented out since we want to force a BMP pixel plot for Symbology.js
*/
/*
if(image_type == PNG_DATA) {
#ifndef NO_PNG
error_number = png_pixel_plot(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle);
#else
return ZERROR_INVALID_OPTION;
#endif
} else {
*/
error_number = bmp_pixel_plot(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle);
/* } */
}

/**
* force BMP pixel plot for Symbology.js
*/
error_number = bmp_pixel_plot(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle);

free(scaled_pixelbuf);

Expand Down

0 comments on commit 0db8692

Please sign in to comment.