Gamma division constant

This commit is contained in:
Luke Page 2015-08-06 18:50:36 +01:00
parent b24153494e
commit 79465895af
3 changed files with 5 additions and 3 deletions

View file

@ -14,5 +14,7 @@ module.exports = {
COLOR_PALETTE: 1,
COLOR_COLOR: 2,
COLOR_ALPHA: 4
COLOR_ALPHA: 4,
GAMMA_DIVISION: 100000
};

View file

@ -76,7 +76,7 @@ Packer.prototype._packChunk = function(type, data) {
Packer.prototype._packGAMA = function(gamma) {
var buf = new Buffer(4);
buf.writeUInt32BE(Math.floor(gamma * 100000), 0); // TODO constant
buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0);
return this._packChunk(constants.TYPE_gAMA, buf);
};

View file

@ -249,7 +249,7 @@ Parser.prototype._handleGAMA = function(length) {
Parser.prototype._parseGAMA = function(data) {
this._crc.write(data);
this.gamma(data.readUInt32BE(0) / 100000); //TODO constant
this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION);
this._handleChunkEnd();
};