mirror of
https://github.com/danbulant/pngjs
synced 2026-07-06 19:50:36 +00:00
parent
08534acc84
commit
bdc384e9c3
1 changed files with 2 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ module.exports = function(dataIn, width, height, options) {
|
||||||
|
|
||||||
var maxValue = 255;
|
var maxValue = 255;
|
||||||
var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType];
|
var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType];
|
||||||
|
if (inBpp == 4 && !options.inputHasAlpha) inBpp = 3;
|
||||||
var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType];
|
var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType];
|
||||||
if (options.bitDepth === 16) {
|
if (options.bitDepth === 16) {
|
||||||
maxValue = 65535;
|
maxValue = 65535;
|
||||||
|
|
@ -80,7 +81,7 @@ module.exports = function(dataIn, width, height, options) {
|
||||||
blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue);
|
blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {red, green, blue, alpha};
|
return {red: red, green: green, blue: blue, alpha: alpha};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var y = 0; y < height; y++) {
|
for (var y = 0; y < height; y++) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue