1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | "use strict";
|
23 |
|
24 | Object.defineProperty(exports, "__esModule", {
|
25 | value: true
|
26 | });
|
27 | exports.CCITTFaxStream = void 0;
|
28 |
|
29 | var _ccitt = require("./ccitt.js");
|
30 |
|
31 | var _decode_stream = require("./decode_stream.js");
|
32 |
|
33 | var _primitives = require("./primitives.js");
|
34 |
|
35 | class CCITTFaxStream extends _decode_stream.DecodeStream {
|
36 | constructor(str, maybeLength, params) {
|
37 | super(maybeLength);
|
38 | this.str = str;
|
39 | this.dict = str.dict;
|
40 |
|
41 | if (!(params instanceof _primitives.Dict)) {
|
42 | params = _primitives.Dict.empty;
|
43 | }
|
44 |
|
45 | const source = {
|
46 | next() {
|
47 | return str.getByte();
|
48 | }
|
49 |
|
50 | };
|
51 | this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
|
52 | K: params.get("K"),
|
53 | EndOfLine: params.get("EndOfLine"),
|
54 | EncodedByteAlign: params.get("EncodedByteAlign"),
|
55 | Columns: params.get("Columns"),
|
56 | Rows: params.get("Rows"),
|
57 | EndOfBlock: params.get("EndOfBlock"),
|
58 | BlackIs1: params.get("BlackIs1")
|
59 | });
|
60 | }
|
61 |
|
62 | readBlock() {
|
63 | while (!this.eof) {
|
64 | const c = this.ccittFaxDecoder.readNextChar();
|
65 |
|
66 | if (c === -1) {
|
67 | this.eof = true;
|
68 | return;
|
69 | }
|
70 |
|
71 | this.ensureBuffer(this.bufferLength + 1);
|
72 | this.buffer[this.bufferLength++] = c;
|
73 | }
|
74 | }
|
75 |
|
76 | }
|
77 |
|
78 | exports.CCITTFaxStream = CCITTFaxStream; |
\ | No newline at end of file |