| 62587 | for (let j = 0, end = pixels.length; j < end; j++) { |
| 62588 | alphaChannel[i++] = transparency[pixels[j]]; |
| 62589 | } |
| 62590 | |
| 62591 | this.alphaChannel = zlib.deflateSync(alphaChannel); |
| 62592 | return this.finalize(); |
| 62593 | }); |
| 62594 | } |
| 62595 | |
| 62596 | decodeData() { |
| 62597 | this.image.decodePixels(pixels => { |
| 62598 | this.imgData = zlib.deflateSync(pixels); |
| 62599 | this.finalize(); |
| 62600 | }); |
| 62601 | } |
| 62602 | |
| 62603 | } |
| 62604 | |
| 62605 | /* |
| 62606 | PDFImage - embeds images in PDF documents |
| 62607 | By Devon Govett |
| 62608 | */ |
| 62609 | |
| 62610 | class PDFImage { |
| 62611 | static open(src, label) { |
| 62612 | let data; |
| 62613 | |
| 62614 | if (Buffer.isBuffer(src)) { |
| 62615 | data = src; |
| 62616 | } else if (src instanceof ArrayBuffer) { |
| 62617 | data = new Buffer(new Uint8Array(src)); |
| 62618 | } else { |
| 62619 | let match; |
| 62620 | |