diff --git a/pitfall/pdfkit/lib/image/png.coffee b/pitfall/pdfkit/lib/image/png.coffee index 07ca725a..98237ded 100644 --- a/pitfall/pdfkit/lib/image/png.coffee +++ b/pitfall/pdfkit/lib/image/png.coffee @@ -72,7 +72,7 @@ class PNGImage @loadIndexedAlphaChannel() else if @image.hasAlphaChannel - console.log("got alphachannel " + @image.colorType + " in png.coffee") + #console.log("got alphachannel " + @image.colorType + " in png.coffee") # For PNG color types 4 and 6, the transparency data is stored as a alpha # channel mixed in with the main image data. Separate this data out into an # SMask object and store it separately in the PDF. @@ -107,13 +107,13 @@ class PNGImage hitme = 0 splitAlphaChannel: -> - console.log("start splitAlphaChannel in png.coffee") + #console.log("start splitAlphaChannel in png.coffee") @image.decodePixels (pixels) => - console.log("hitme=" + hitme++) - console.log("in png.coffee") - console.log("decoded pixels length=" + pixels.length); - console.log("decoded pixels="); - console.log(pixels); + #console.log("hitme=" + hitme++) + #console.log("in png.coffee") + #console.log("decoded pixels length=" + pixels.length); + #console.log("decoded pixels="); + #console.log(pixels); colorByteSize = @image.colors * @image.bits / 8 pixelCount = @width * @height @@ -128,13 +128,13 @@ class PNGImage imgData[p++] = pixels[i++] alphaChannel[a++] = pixels[i++] - console.log("uncompressed imgData length=" + imgData.length) - console.log("uncompressed imgData=") - console.log(imgData) + #console.log("uncompressed imgData length=" + imgData.length) + #console.log("uncompressed imgData=") + #console.log(imgData) - console.log("uncompressed alphaChannel length=" + alphaChannel.length) - console.log("uncompressed alphaChannel=") - console.log(alphaChannel) + #console.log("uncompressed alphaChannel length=" + alphaChannel.length) + #console.log("uncompressed alphaChannel=") + #console.log(alphaChannel) # boomstick temp #@imgData = imgData @@ -145,22 +145,22 @@ class PNGImage done = 0 zlib.deflate imgData, (err, @imgData) => throw err if err - console.log("compressed @imgData length=" + @imgData.length) - console.log("compressed @imgData=") - console.log(@imgData) + #console.log("compressed @imgData length=" + @imgData.length) + #console.log("compressed @imgData=") + #console.log(@imgData) @finalize() if ++done is 2 zlib.deflate alphaChannel, (err, @alphaChannel) => throw err if err - console.log("compressed @alphaChannel length=" + @alphaChannel.length) - console.log("compressed @alphaChannel=") - console.log(@alphaChannel) + #console.log("compressed @alphaChannel length=" + @alphaChannel.length) + ##console.log("compressed @alphaChannel=") + #console.log(@alphaChannel) @finalize() if ++done is 2 loadIndexedAlphaChannel: (fn) -> transparency = @image.transparency.indexed - console.log("oh hello") + #console.log("oh hello") @image.decodePixels (pixels) => alphaChannel = new Buffer(@width * @height) diff --git a/pitfall/pdfkit/node_modules/png-js/png-node.coffee b/pitfall/pdfkit/node_modules/png-js/png-node.coffee index 50b19820..364ccb74 100644 --- a/pitfall/pdfkit/node_modules/png-js/png-node.coffee +++ b/pitfall/pdfkit/node_modules/png-js/png-node.coffee @@ -140,8 +140,8 @@ module.exports = class PNG pixelBytes = @pixelBitlength / 8 scanlineLength = pixelBytes * @width - console.log("pixelBytes="+ pixelBytes) - console.log("scanlineLength="+ scanlineLength) + #console.log("pixelBytes="+ pixelBytes) + #console.log("scanlineLength="+ scanlineLength) pixels = new Buffer(scanlineLength * @height) length = data.length diff --git a/pitfall/pdfkit/node_modules/png-js/png-node.js b/pitfall/pdfkit/node_modules/png-js/png-node.js index 2fca0ce7..576f5d80 100644 --- a/pitfall/pdfkit/node_modules/png-js/png-node.js +++ b/pitfall/pdfkit/node_modules/png-js/png-node.js @@ -173,7 +173,7 @@ }; PNG.prototype.decodePixels = function(fn) { - console.log("start decodePixels in png-node.js") + //console.log("start decodePixels in png-node.js") var _this = this; return zlib.inflate(this.imgData, function(err, data) { var byte, c, col, i, left, length, p, pa, paeth, pb, pc, pixelBytes, pixels, pos, row, scanlineLength, upper, upperLeft, _i, _j, _k, _l, _m; @@ -182,8 +182,8 @@ } pixelBytes = _this.pixelBitlength / 8; scanlineLength = pixelBytes * _this.width; - console.log("pixelBytes="+ pixelBytes); - console.log("scanlineLength="+ scanlineLength); + //console.log("pixelBytes="+ pixelBytes); + //console.log("scanlineLength="+ scanlineLength); pixels = new Buffer(scanlineLength * _this.height); length = data.length; @@ -251,10 +251,10 @@ } row++; } - console.log("in png-node.js") - console.log("decoded pixels length=" + pixels.length); - console.log("decoded pixels="); - console.log(pixels); + //console.log("in png-node") + //console.log("decoded pixels length=" + pixels.length); + //console.log("decoded pixels="); + //console.log(pixels); return fn(pixels); }); }; @@ -313,7 +313,7 @@ }; PNG.prototype.decode = function(fn) { - console.log("another call to decodePixels") + //console.log("another call to decodePixels") var ret, _this = this; ret = new Buffer(this.width * this.height * 4); diff --git a/pitfall/pitfall/pdftest.rkt b/pitfall/pitfall/pdftest.rkt index db75d984..54c4974e 100644 --- a/pitfall/pitfall/pdftest.rkt +++ b/pitfall/pitfall/pdftest.rkt @@ -24,14 +24,15 @@ (check-equal? (bytes-length (file->bytes this)) (bytes-length (file->bytes (this->pdfkit-control this))))) -(define (make-doc ps compress? [proc (λ (doc) doc)] #:test [test? #t]) +(define (make-doc ps compress? [proc (λ (doc) doc)] #:test [test? #t] #:pdfkit [pdfkit? #t]) (define doc (make-object PDFDocument (hash 'compress compress?))) (send doc pipe (open-output-file ps #:exists 'replace)) (proc doc) (send doc end) (when test? (check-copy-equal? ps) - (check-pdfkit? ps))) + (when pdfkit? + (check-pdfkit? ps)))) (module reader syntax/module-reader diff --git a/pitfall/pitfall/png-reader.rkt b/pitfall/pitfall/png-reader.rkt index 9fc9a792..43f39acc 100644 --- a/pitfall/pitfall/png-reader.rkt +++ b/pitfall/pitfall/png-reader.rkt @@ -171,8 +171,8 @@ Grab key chunks from PNG. Doesn't require heavy lifting from libpng. )] [else (error 'invalid-filter-algorithm (format "~a" b))]))) - (report (bytes-length pixels) 'decoded-pixels-length) - (report (bytes->hex (subbytes pixels 0 20))) + #;(report (bytes-length pixels) 'decoded-pixels-length) + #;(report (bytes->hex (subbytes pixels 0 20))) (fn pixels)) diff --git a/pitfall/pitfall/png.rkt b/pitfall/pitfall/png.rkt index 4d7b8b8b..b1fb1cea 100644 --- a/pitfall/pitfall/png.rkt +++ b/pitfall/pitfall/png.rkt @@ -112,11 +112,11 @@ (define alphaChannel (apply bytes (reverse alphaBytes))) - (report (bytes-length imgData) 'uncompressed-imgdata-length) - (report (bytes->hex (subbytes imgData 0 20)) 'uncompressed-imgdata) + #;(report (bytes-length imgData) 'uncompressed-imgdata-length) + #;(report (bytes->hex (subbytes imgData 0 20)) 'uncompressed-imgdata) - (report (bytes-length alphaChannel) 'uncompressed-alphaChannel-length) - (report (bytes->hex (subbytes alphaChannel 0 20)) 'uncompressed-alphaChannel) + #;(report (bytes-length alphaChannel) 'uncompressed-alphaChannel-length) + #;(report (bytes->hex (subbytes alphaChannel 0 20)) 'uncompressed-alphaChannel) #;(report* (bytes-length imgData) (bytes-length alphaChannel)) @@ -126,11 +126,11 @@ (define alphaChannelCompressed (deflate alphaChannel)) - (report (bytes-length alphaChannelCompressed) 'alphaChannelCompressed-length) - (report (bytes->hex (subbytes alphaChannelCompressed 0 20)) 'alphaChannelCompressed) + #;(report (bytes-length alphaChannelCompressed) 'alphaChannelCompressed-length) + #;(report (bytes->hex (subbytes alphaChannelCompressed 0 20)) 'alphaChannelCompressed) - (report (bytes-length imgDataCompressed) 'imgDataCompressed-length) - (report (bytes->hex (subbytes imgDataCompressed 0 20)) 'imgDataCompressed) + #;(report (bytes-length imgDataCompressed) 'imgDataCompressed-length) + #;(report (bytes->hex (subbytes imgDataCompressed 0 20)) 'imgDataCompressed) (set-field! imgData this imgDataCompressed) diff --git a/pitfall/pitfall/test/test8.pdf b/pitfall/pitfall/test/test8.pdf index ebe02788..9105c7fe 100644 Binary files a/pitfall/pitfall/test/test8.pdf and b/pitfall/pitfall/test/test8.pdf differ diff --git a/pitfall/pitfall/test/test8.rkt b/pitfall/pitfall/test/test8.rkt index 8a4e7e74..d104070f 100644 --- a/pitfall/pitfall/test/test8.rkt +++ b/pitfall/pitfall/test/test8.rkt @@ -10,7 +10,7 @@ [image pic 100 160 (hash 'width 412)])) (define-runtime-path this "test8rkt.pdf") -(make-doc this #f proc #:test #f) +(make-doc this #f proc #:pdfkit #f) ; node's zlib.deflate makes smaller files, for some reason -#;(define-runtime-path that "test8crkt.pdf") -#;(make-doc that #t proc) +(define-runtime-path that "test8crkt.pdf") +(make-doc that #t proc #:pdfkit #f) diff --git a/pitfall/pitfall/test/test8crkt copy.pdf b/pitfall/pitfall/test/test8crkt copy.pdf new file mode 100644 index 00000000..910ac94c Binary files /dev/null and b/pitfall/pitfall/test/test8crkt copy.pdf differ diff --git a/pitfall/pitfall/test/test8crkt.pdf b/pitfall/pitfall/test/test8crkt.pdf new file mode 100644 index 00000000..910ac94c Binary files /dev/null and b/pitfall/pitfall/test/test8crkt.pdf differ diff --git a/pitfall/pitfall/test/test8rkt copy.pdf b/pitfall/pitfall/test/test8rkt copy.pdf new file mode 100644 index 00000000..a3c965d5 Binary files /dev/null and b/pitfall/pitfall/test/test8rkt copy.pdf differ