summaryrefslogtreecommitdiff
path: root/js/png.js
diff options
context:
space:
mode:
authortimb <opuscule@gmail.com>2015-07-30 02:59:28 -0700
committertimb <opuscule@gmail.com>2015-07-30 02:59:28 -0700
commit2b1ba37c195761b32f7126a874067e7549925ddd (patch)
treeef08f0fb0dab29c7b8c575518ff8bf9b4f99388d /js/png.js
parentf1d7257029468ff093bfec89e783bfa37b421cc0 (diff)
make a note of data structure for sanity purposes if code is read years later
Diffstat (limited to 'js/png.js')
-rw-r--r--js/png.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/png.js b/js/png.js
index df9960c..e9b326e 100644
--- a/js/png.js
+++ b/js/png.js
@@ -60,6 +60,14 @@ var crc32 = function(u8){
var signature = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10])
var te, td
+// decodes chunks in png
+// see http://www.w3.org/TR/PNG/#5Chunk-layout
+// returns something like
+// [{length: Number,
+// type: String[4],
+// crc: Number,
+// data: Uint8Array[] // optional
+// }, ...]
var decode = function(buf, err){
var u8a = new Uint8Array(buf)
var dv = new DataView(buf)