-
Notifications
You must be signed in to change notification settings - Fork 1
/
RGB.js
73 lines (64 loc) · 2.12 KB
/
RGB.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['kaitai-struct/KaitaiStream'], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('kaitai-struct/KaitaiStream'));
} else {
root.Rgb = factory(root.KaitaiStream);
}
}(this, function (KaitaiStream) {
var Rgb = (function() {
function Rgb(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
Rgb.prototype._read = function() {
this.hdr = new Header(this._io, this, this._root);
this.image = new ImageData(this._io, this, this._root);
}
var Header = Rgb.Header = (function() {
function Header(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
Header.prototype._read = function() {
this.magic = this._io.readU2be();
this.compression = this._io.readU1();
this.bytesPerPixel = this._io.readU1();
this.imageDimension = this._io.readU2be();
this.width = this._io.readU2be();
this.height = this._io.readU2be();
this.channelsNum = this._io.readU2be();
this.minPixel = this._io.readU4be();
this.maxPixel = this._io.readU4be();
this.reserved = this._io.readBytes(4);
this.name = this._io.readBytes(80);
this.colorMapId = this._io.readBytes(4);
this.filler = this._io.readBytes(404);
}
return Header;
})();
var ImageData = Rgb.ImageData = (function() {
function ImageData(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
ImageData.prototype._read = function() {
this.imageLines = new Array(1024);
for (var i = 0; i < 1024; i++) {
this.imageLines[i] = this._io.readBytes(1024);
}
}
return ImageData;
})();
return Rgb;
})();
return Rgb;
}));