origami 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/bin/gui/config.rb +2 -1
  4. data/bin/gui/file.rb +118 -240
  5. data/bin/gui/gtkhex.rb +5 -5
  6. data/bin/gui/hexview.rb +20 -16
  7. data/bin/gui/imgview.rb +1 -1
  8. data/bin/gui/menu.rb +138 -158
  9. data/bin/gui/properties.rb +46 -48
  10. data/bin/gui/signing.rb +183 -214
  11. data/bin/gui/textview.rb +1 -1
  12. data/bin/gui/treeview.rb +13 -7
  13. data/bin/gui/walker.rb +102 -71
  14. data/bin/gui/xrefs.rb +1 -1
  15. data/bin/pdf2ruby +3 -3
  16. data/bin/pdfcop +18 -11
  17. data/bin/pdfextract +14 -5
  18. data/bin/pdfmetadata +3 -3
  19. data/bin/shell/console.rb +8 -8
  20. data/bin/shell/hexdump.rb +4 -4
  21. data/examples/attachments/nested_document.rb +1 -1
  22. data/examples/javascript/hello_world.rb +3 -3
  23. data/lib/origami.rb +0 -1
  24. data/lib/origami/acroform.rb +3 -3
  25. data/lib/origami/array.rb +1 -3
  26. data/lib/origami/boolean.rb +1 -3
  27. data/lib/origami/catalog.rb +3 -9
  28. data/lib/origami/destinations.rb +2 -2
  29. data/lib/origami/dictionary.rb +15 -29
  30. data/lib/origami/encryption.rb +334 -692
  31. data/lib/origami/extensions/fdf.rb +3 -2
  32. data/lib/origami/extensions/ppklite.rb +5 -9
  33. data/lib/origami/filespec.rb +2 -2
  34. data/lib/origami/filters.rb +54 -36
  35. data/lib/origami/filters/ascii.rb +67 -49
  36. data/lib/origami/filters/ccitt.rb +4 -236
  37. data/lib/origami/filters/ccitt/tables.rb +267 -0
  38. data/lib/origami/filters/crypt.rb +1 -1
  39. data/lib/origami/filters/dct.rb +0 -1
  40. data/lib/origami/filters/flate.rb +3 -43
  41. data/lib/origami/filters/lzw.rb +62 -99
  42. data/lib/origami/filters/predictors.rb +135 -105
  43. data/lib/origami/filters/runlength.rb +34 -22
  44. data/lib/origami/graphics.rb +2 -2
  45. data/lib/origami/graphics/colors.rb +89 -63
  46. data/lib/origami/graphics/path.rb +14 -14
  47. data/lib/origami/graphics/patterns.rb +31 -33
  48. data/lib/origami/graphics/render.rb +0 -1
  49. data/lib/origami/graphics/state.rb +9 -9
  50. data/lib/origami/graphics/text.rb +17 -17
  51. data/lib/origami/graphics/xobject.rb +102 -92
  52. data/lib/origami/javascript.rb +91 -68
  53. data/lib/origami/linearization.rb +22 -20
  54. data/lib/origami/metadata.rb +1 -1
  55. data/lib/origami/name.rb +1 -3
  56. data/lib/origami/null.rb +1 -3
  57. data/lib/origami/numeric.rb +3 -13
  58. data/lib/origami/object.rb +100 -72
  59. data/lib/origami/page.rb +24 -28
  60. data/lib/origami/parser.rb +34 -51
  61. data/lib/origami/parsers/fdf.rb +2 -2
  62. data/lib/origami/parsers/pdf.rb +41 -18
  63. data/lib/origami/parsers/pdf/lazy.rb +83 -46
  64. data/lib/origami/parsers/pdf/linear.rb +19 -10
  65. data/lib/origami/parsers/ppklite.rb +1 -1
  66. data/lib/origami/pdf.rb +150 -206
  67. data/lib/origami/reference.rb +4 -6
  68. data/lib/origami/signature.rb +76 -48
  69. data/lib/origami/stream.rb +69 -63
  70. data/lib/origami/string.rb +2 -19
  71. data/lib/origami/trailer.rb +25 -22
  72. data/lib/origami/version.rb +1 -1
  73. data/lib/origami/xfa.rb +6 -4
  74. data/lib/origami/xreftable.rb +29 -29
  75. data/test/test_annotations.rb +16 -38
  76. data/test/test_pdf_attachment.rb +1 -1
  77. data/test/test_pdf_parse.rb +1 -1
  78. data/test/test_xrefs.rb +2 -2
  79. metadata +4 -4
  80. data/lib/origami/export.rb +0 -247
@@ -209,6 +209,7 @@ module Origami
209
209
  @header = FDF::Header.new
210
210
  @revisions = [ Revision.new(self) ]
211
211
  @revisions.first.trailer = Trailer.new
212
+ @parser = parser
212
213
 
213
214
  init if parser.nil?
214
215
  end
@@ -249,10 +250,10 @@ module Origami
249
250
  end
250
251
  alias root_objects indirect_objects
251
252
 
252
- def cast_object(reference, type, parser = nil) #:nodoc:
253
+ def cast_object(reference, type) #:nodoc:
253
254
  @revisions.each do |rev|
254
255
  if rev.body.include?(reference) and type < rev.body[reference].class
255
- rev.body[reference] = rev.body[reference].cast_to(type, parser)
256
+ rev.body[reference] = rev.body[reference].cast_to(type, @parser)
256
257
 
257
258
  rev.body[reference]
258
259
  else
@@ -134,7 +134,7 @@ module Origami
134
134
  include StandardObject
135
135
  include Descriptor
136
136
 
137
- add_type_info self, :ABEType, Descriptor::CERTIFICATE
137
+ add_type_signature :ABEType, Descriptor::CERTIFICATE
138
138
 
139
139
  module Flags
140
140
  CAN_CERTIFY = 1 << 1
@@ -160,7 +160,7 @@ module Origami
160
160
  include StandardObject
161
161
  include Descriptor
162
162
 
163
- add_type_info self, :ABEType, Descriptor::USER
163
+ add_type_signature :ABEType, Descriptor::USER
164
164
 
165
165
  field :ABEType, :Type => Integer, :Default => Descriptor::USER, :Required => true
166
166
  field :Name, :Type => String, :Required => true
@@ -204,6 +204,7 @@ module Origami
204
204
  @header = PPKLite::Header.new
205
205
  @revisions = [ Revision.new(self) ]
206
206
  @revisions.first.trailer = Trailer.new
207
+ @parser = parser
207
208
 
208
209
  init if parser.nil?
209
210
  end
@@ -213,10 +214,10 @@ module Origami
213
214
  end
214
215
  alias root_objects indirect_objects
215
216
 
216
- def cast_object(reference, type, parser = nil) #:nodoc:
217
+ def cast_object(reference, type) #:nodoc:
217
218
  @revisions.each do |rev|
218
219
  if rev.body.include?(reference) and type < rev.body[reference].class
219
- rev.body[reference] = rev.body[reference].cast_to(type, parser)
220
+ rev.body[reference] = rev.body[reference].cast_to(type, @parser)
220
221
 
221
222
  rev.body[reference]
222
223
  else
@@ -260,11 +261,6 @@ module Origami
260
261
  get_object(@revisions.first.trailer.Root)
261
262
  end
262
263
 
263
- def indirect_objects
264
- @revisions.inject([]) do |set, rev| set.concat(rev.objects) end
265
- end
266
- alias root_objects indirect_objects
267
-
268
264
  def save(path)
269
265
  bin = "".b
270
266
  bin << @header.to_s
@@ -95,7 +95,7 @@ module Origami
95
95
  # Converts MacOS file path into PDF file path.
96
96
  #
97
97
  def Mac(file)
98
- LiteralString.new("/" + file.gsub(":", "/"))
98
+ LiteralString.new("/" + file.tr(":", "/"))
99
99
  end
100
100
 
101
101
  #
@@ -109,7 +109,7 @@ module Origami
109
109
  file.sub!(":","")
110
110
  end
111
111
 
112
- file.gsub!("\\", "/")
112
+ file.tr!("\\", "/")
113
113
  LiteralString.new(path + file)
114
114
  end
115
115
  end
@@ -25,6 +25,24 @@ module Origami
25
25
  #
26
26
  module Filter
27
27
 
28
+ autoload :ASCIIHex, "origami/filters/ascii"
29
+ autoload :AHx, "origami/filters/ascii"
30
+ autoload :ASCII85, "origami/filters/ascii"
31
+ autoload :A85, "origami/filters/ascii"
32
+ autoload :CCITTFax, "origami/filters/ccitt"
33
+ autoload :CCF, "origami/filters/ccitt"
34
+ autoload :Crypt, "origami/filters/crypt"
35
+ autoload :DCT, "origami/filters/dct"
36
+ autoload :Flate, "origami/filters/flate"
37
+ autoload :Fl, "origami/filters/flate"
38
+ autoload :JBIG2, "origami/filters/jbig2"
39
+ autoload :JPX, "origami/filters/jpx"
40
+ autoload :LZW, "origami/filters/lzw"
41
+ autoload :RunLength, "origami/filters/runlength"
42
+ autoload :RL, "origami/filters/runlength"
43
+ autoload :Predictor, "origami/filters/predictors"
44
+
45
+
28
46
  #
29
47
  # Base class for filter Exceptions.
30
48
  #
@@ -59,7 +77,7 @@ module Origami
59
77
  #
60
78
  class BitWriter
61
79
  def initialize
62
- @data = ''
80
+ @data = ''.b
63
81
  @last_byte = nil
64
82
  @ptr_bit = 0
65
83
  end
@@ -68,7 +86,7 @@ module Origami
68
86
  # Writes _data_ represented as Fixnum to a _length_ number of bits.
69
87
  #
70
88
  def write(data, length)
71
- return BitWriterError, "Invalid data length" unless length > 0 and (1 << length) > data
89
+ return BitWriterError, "Invalid data length" unless length > 0 and length >= data.bit_length
72
90
 
73
91
  # optimization for aligned byte writing
74
92
  if length == 8 and @last_byte.nil? and @ptr_bit == 0
@@ -76,30 +94,7 @@ module Origami
76
94
  return self
77
95
  end
78
96
 
79
- while length > 0
80
- if length >= 8 - @ptr_bit
81
- length -= 8 - @ptr_bit
82
- @last_byte ||= 0
83
- @last_byte |= (data >> length) & ((1 << (8 - @ptr_bit)) - 1)
84
-
85
- data &= (1 << length) - 1
86
- @data << @last_byte.chr
87
- @last_byte = nil
88
- @ptr_bit = 0
89
- else
90
- @last_byte ||= 0
91
- @last_byte |= (data & ((1 << length) - 1)) << (8 - @ptr_bit - length)
92
- @ptr_bit += length
93
-
94
- if @ptr_bit == 8
95
- @data << @last_byte.chr
96
- @last_byte = nil
97
- @ptr_bit = 0
98
- end
99
-
100
- length = 0
101
- end
102
- end
97
+ write_bits(data, length)
103
98
 
104
99
  self
105
100
  end
@@ -128,6 +123,39 @@ module Origami
128
123
  def to_s
129
124
  @data.dup
130
125
  end
126
+
127
+ private
128
+
129
+ #
130
+ # Write the bits into the internal data.
131
+ #
132
+ def write_bits(data, length)
133
+
134
+ while length > 0
135
+ if length >= 8 - @ptr_bit
136
+ length -= 8 - @ptr_bit
137
+ @last_byte ||= 0
138
+ @last_byte |= (data >> length) & ((1 << (8 - @ptr_bit)) - 1)
139
+
140
+ data &= (1 << length) - 1
141
+ @data << @last_byte.chr
142
+ @last_byte = nil
143
+ @ptr_bit = 0
144
+ else
145
+ @last_byte ||= 0
146
+ @last_byte |= (data & ((1 << length) - 1)) << (8 - @ptr_bit - length)
147
+ @ptr_bit += length
148
+
149
+ if @ptr_bit == 8
150
+ @data << @last_byte.chr
151
+ @last_byte = nil
152
+ @ptr_bit = 0
153
+ end
154
+
155
+ length = 0
156
+ end
157
+ end
158
+ end
131
159
  end
132
160
 
133
161
  class BitReaderError < Error #:nodoc:
@@ -336,13 +364,3 @@ module Origami
336
364
  end
337
365
 
338
366
  end
339
-
340
- require 'origami/filters/ascii'
341
- require 'origami/filters/lzw'
342
- require 'origami/filters/flate'
343
- require 'origami/filters/runlength'
344
- require 'origami/filters/ccitt'
345
- require 'origami/filters/dct'
346
- require 'origami/filters/jbig2'
347
- require 'origami/filters/jpx'
348
- require 'origami/filters/crypt'
@@ -91,23 +91,14 @@ module Origami
91
91
  addend = 0
92
92
  end
93
93
 
94
- inblock = (input[i].ord * 256**3 +
95
- input[i+1].ord * 256**2 +
96
- input[i+2].ord * 256 +
97
- input[i+3].ord)
98
- outblock = ""
99
-
100
- 5.times do |p|
101
- c = inblock / 85 ** (4 - p)
102
- outblock << ("!".ord + c).chr
103
-
104
- inblock -= c * 85 ** (4 - p)
105
- end
94
+ # Encode the 4 bytes input value into a 5 character string.
95
+ value = input[i, 4].unpack("L>")[0]
96
+ outblock = encode_block(value)
106
97
 
107
98
  outblock = "z" if outblock == "!!!!!" and addend == 0
108
99
 
109
100
  if addend != 0
110
- outblock = outblock[0,(4 - addend) + 1]
101
+ outblock = outblock[0, 4 - addend + 1]
111
102
  end
112
103
 
113
104
  code << outblock
@@ -123,60 +114,41 @@ module Origami
123
114
  # _string_:: The data to decode.
124
115
  #
125
116
  def decode(string)
126
- input = (string.include?(EOD) ? string[0..string.index(EOD) - 1] : string).delete(" \f\t\r\n\0")
117
+ input = filter_input(string)
127
118
 
128
119
  i = 0
129
- result = "".b
130
- while i < input.size do
120
+ result = ''.b
121
+
122
+ while i < input.size
131
123
 
132
124
  outblock = ""
125
+ value = 0
126
+ addend = 0
133
127
 
134
128
  if input[i] == "z"
135
- inblock = 0
136
129
  codelen = 1
137
130
  else
138
- inblock = 0
139
131
  codelen = 5
140
132
 
141
- if input.length - i < 5
133
+ if input.length - i < codelen
142
134
  raise InvalidASCII85StringError.new("Invalid length", input_data: string, decoded_data: result) if input.length - i == 1
143
135
 
144
- addend = 5 - (input.length - i)
136
+ addend = codelen - (input.length - i)
145
137
  input << "u" * addend
146
- else
147
- addend = 0
148
138
  end
149
139
 
150
- # Checking if this string is in base85
151
- 5.times do |j|
152
- if input[i+j].ord > "u".ord or input[i+j].ord < "!".ord
153
- raise InvalidASCII85StringError.new(
154
- "Invalid character sequence: #{input[i,5].inspect}",
155
- input_data: string,
156
- decoded_data: result
157
- )
158
- else
159
- inblock += (input[i+j].ord - "!".ord) * 85 ** (4 - j)
160
- end
140
+ # Decode the 5 characters input block into a 32 bit integer.
141
+ begin
142
+ value = decode_block input[i, codelen]
143
+ rescue InvalidASCII85StringError => error
144
+ error.input_data = string
145
+ error.decoded_data = result
146
+ raise(error)
161
147
  end
162
-
163
- raise InvalidASCII85StringError.new(
164
- "Invalid value (#{inblock}) for block #{input[i,5].inspect}",
165
- input_data: string,
166
- decoded_data: result
167
- ) if inblock >= 2**32
168
148
  end
169
149
 
170
- 4.times do |p|
171
- c = inblock / 256 ** (3 - p)
172
- outblock << c.chr
173
-
174
- inblock -= c * 256 ** (3 - p)
175
- end
176
-
177
- if addend != 0
178
- outblock = outblock[0, 4 - addend]
179
- end
150
+ outblock = [ value ].pack "L>"
151
+ outblock = outblock[0, 4 - addend]
180
152
 
181
153
  result << outblock
182
154
 
@@ -186,6 +158,52 @@ module Origami
186
158
  result
187
159
  end
188
160
 
161
+ private
162
+
163
+ def filter_input(string)
164
+ string = string[0, string.index(EOD)] if string.include?(EOD)
165
+ string.delete(" \f\t\r\n\0")
166
+ end
167
+
168
+ #
169
+ # Encodes an integer value into an ASCII85 block of 5 characters.
170
+ #
171
+ def encode_block(value)
172
+ block = "".b
173
+
174
+ 5.times do |p|
175
+ c = value / 85 ** (4 - p)
176
+ block << ("!".ord + c).chr
177
+
178
+ value -= c * 85 ** (4 - p)
179
+ end
180
+
181
+ block
182
+ end
183
+
184
+ #
185
+ # Decodes a 5 character ASCII85 block into an integer value.
186
+ #
187
+ def decode_block(block)
188
+ value = 0
189
+
190
+ 5.times do |i|
191
+ byte = block[i].ord
192
+
193
+ if byte > "u".ord or byte < "!".ord
194
+ raise InvalidASCII85StringError, "Invalid character sequence: #{block.inspect}"
195
+ else
196
+ value += (byte - "!".ord) * 85 ** (4 - i)
197
+ end
198
+ end
199
+
200
+ if value >= (1 << 32)
201
+ raise InvalidASCII85StringError, "Invalid value (#{value}) for block #{block.inspect}"
202
+ end
203
+
204
+ value
205
+ end
206
+
189
207
  end
190
208
  A85 = ASCII85
191
209
 
@@ -18,6 +18,8 @@
18
18
 
19
19
  =end
20
20
 
21
+ require 'origami/filters/ccitt/tables'
22
+
21
23
  module Origami
22
24
 
23
25
  module Filter
@@ -47,243 +49,9 @@ module Origami
47
49
  field :DamagedRowsBeforeError, :Type => :Integer, :Default => 0
48
50
  end
49
51
 
50
- def self.codeword(str) #:nodoc:
51
- [ str.to_i(2), str.length ]
52
- end
53
-
54
52
  EOL = codeword('000000000001')
55
53
  RTC = codeword('000000000001' * 6)
56
54
 
57
- WHITE_TERMINAL_ENCODE_TABLE =
58
- {
59
- 0 => codeword('00110101'),
60
- 1 => codeword('000111'),
61
- 2 => codeword('0111'),
62
- 3 => codeword('1000'),
63
- 4 => codeword('1011'),
64
- 5 => codeword('1100'),
65
- 6 => codeword('1110'),
66
- 7 => codeword('1111'),
67
- 8 => codeword('10011'),
68
- 9 => codeword('10100'),
69
- 10 => codeword('00111'),
70
- 11 => codeword('01000'),
71
- 12 => codeword('001000'),
72
- 13 => codeword('000011'),
73
- 14 => codeword('110100'),
74
- 15 => codeword('110101'),
75
- 16 => codeword('101010'),
76
- 17 => codeword('101011'),
77
- 18 => codeword('0100111'),
78
- 19 => codeword('0001100'),
79
- 20 => codeword('0001000'),
80
- 21 => codeword('0010111'),
81
- 22 => codeword('0000011'),
82
- 23 => codeword('0000100'),
83
- 24 => codeword('0101000'),
84
- 25 => codeword('0101011'),
85
- 26 => codeword('0010011'),
86
- 27 => codeword('0100100'),
87
- 28 => codeword('0011000'),
88
- 29 => codeword('00000010'),
89
- 30 => codeword('00000011'),
90
- 31 => codeword('00011010'),
91
- 32 => codeword('00011011'),
92
- 33 => codeword('00010010'),
93
- 34 => codeword('00010011'),
94
- 35 => codeword('00010100'),
95
- 36 => codeword('00010101'),
96
- 37 => codeword('00010110'),
97
- 38 => codeword('00010111'),
98
- 39 => codeword('00101000'),
99
- 40 => codeword('00101001'),
100
- 41 => codeword('00101010'),
101
- 42 => codeword('00101011'),
102
- 43 => codeword('00101100'),
103
- 44 => codeword('00101101'),
104
- 45 => codeword('00000100'),
105
- 46 => codeword('00000101'),
106
- 47 => codeword('00001010'),
107
- 48 => codeword('00001011'),
108
- 49 => codeword('01010010'),
109
- 50 => codeword('01010011'),
110
- 51 => codeword('01010100'),
111
- 52 => codeword('01010101'),
112
- 53 => codeword('00100100'),
113
- 54 => codeword('00100101'),
114
- 55 => codeword('01011000'),
115
- 56 => codeword('01011001'),
116
- 57 => codeword('01011010'),
117
- 58 => codeword('01011011'),
118
- 59 => codeword('01001010'),
119
- 60 => codeword('01001011'),
120
- 61 => codeword('00110010'),
121
- 62 => codeword('00110011'),
122
- 63 => codeword('00110100')
123
- }
124
- WHITE_TERMINAL_DECODE_TABLE = WHITE_TERMINAL_ENCODE_TABLE.invert
125
-
126
- BLACK_TERMINAL_ENCODE_TABLE =
127
- {
128
- 0 => codeword('0000110111'),
129
- 1 => codeword('010'),
130
- 2 => codeword('11'),
131
- 3 => codeword('10'),
132
- 4 => codeword('011'),
133
- 5 => codeword('0011'),
134
- 6 => codeword('0010'),
135
- 7 => codeword('00011'),
136
- 8 => codeword('000101'),
137
- 9 => codeword('000100'),
138
- 10 => codeword('0000100'),
139
- 11 => codeword('0000101'),
140
- 12 => codeword('0000111'),
141
- 13 => codeword('00000100'),
142
- 14 => codeword('00000111'),
143
- 15 => codeword('000011000'),
144
- 16 => codeword('0000010111'),
145
- 17 => codeword('0000011000'),
146
- 18 => codeword('0000001000'),
147
- 19 => codeword('00001100111'),
148
- 20 => codeword('00001101000'),
149
- 21 => codeword('00001101100'),
150
- 22 => codeword('00000110111'),
151
- 23 => codeword('00000101000'),
152
- 24 => codeword('00000010111'),
153
- 25 => codeword('00000011000'),
154
- 26 => codeword('000011001010'),
155
- 27 => codeword('000011001011'),
156
- 28 => codeword('000011001100'),
157
- 29 => codeword('000011001101'),
158
- 30 => codeword('000001101000'),
159
- 31 => codeword('000001101001'),
160
- 32 => codeword('000001101010'),
161
- 33 => codeword('000001101011'),
162
- 34 => codeword('000011010010'),
163
- 35 => codeword('000011010011'),
164
- 36 => codeword('000011010100'),
165
- 37 => codeword('000011010101'),
166
- 38 => codeword('000011010110'),
167
- 39 => codeword('000011010111'),
168
- 40 => codeword('000001101100'),
169
- 41 => codeword('000001101101'),
170
- 42 => codeword('000011011010'),
171
- 43 => codeword('000011011011'),
172
- 44 => codeword('000001010100'),
173
- 45 => codeword('000001010101'),
174
- 46 => codeword('000001010110'),
175
- 47 => codeword('000001010111'),
176
- 48 => codeword('000001100100'),
177
- 49 => codeword('000001100101'),
178
- 50 => codeword('000001010010'),
179
- 51 => codeword('000001010011'),
180
- 52 => codeword('000000100100'),
181
- 53 => codeword('000000110111'),
182
- 54 => codeword('000000111000'),
183
- 55 => codeword('000000100111'),
184
- 56 => codeword('000000101000'),
185
- 57 => codeword('000001011000'),
186
- 58 => codeword('000001011001'),
187
- 59 => codeword('000000101011'),
188
- 60 => codeword('000000101100'),
189
- 61 => codeword('000001011010'),
190
- 62 => codeword('000001100110'),
191
- 63 => codeword('000001100111')
192
- }
193
- BLACK_TERMINAL_DECODE_TABLE = BLACK_TERMINAL_ENCODE_TABLE.invert
194
-
195
- WHITE_CONFIGURATION_ENCODE_TABLE =
196
- {
197
- 64 => codeword('11011'),
198
- 128 => codeword('10010'),
199
- 192 => codeword('010111'),
200
- 256 => codeword('0110111'),
201
- 320 => codeword('00110110'),
202
- 384 => codeword('00110111'),
203
- 448 => codeword('01100100'),
204
- 512 => codeword('01100101'),
205
- 576 => codeword('01101000'),
206
- 640 => codeword('01100111'),
207
- 704 => codeword('011001100'),
208
- 768 => codeword('011001101'),
209
- 832 => codeword('011010010'),
210
- 896 => codeword('011010011'),
211
- 960 => codeword('011010100'),
212
- 1024 => codeword('011010101'),
213
- 1088 => codeword('011010110'),
214
- 1152 => codeword('011010111'),
215
- 1216 => codeword('011011000'),
216
- 1280 => codeword('011011001'),
217
- 1344 => codeword('011011010'),
218
- 1408 => codeword('011011011'),
219
- 1472 => codeword('010011000'),
220
- 1536 => codeword('010011001'),
221
- 1600 => codeword('010011010'),
222
- 1664 => codeword('011000'),
223
- 1728 => codeword('010011011'),
224
-
225
- 1792 => codeword('00000001000'),
226
- 1856 => codeword('00000001100'),
227
- 1920 => codeword('00000001001'),
228
- 1984 => codeword('000000010010'),
229
- 2048 => codeword('000000010011'),
230
- 2112 => codeword('000000010100'),
231
- 2176 => codeword('000000010101'),
232
- 2240 => codeword('000000010110'),
233
- 2340 => codeword('000000010111'),
234
- 2368 => codeword('000000011100'),
235
- 2432 => codeword('000000011101'),
236
- 2496 => codeword('000000011110'),
237
- 2560 => codeword('000000011111')
238
- }
239
- WHITE_CONFIGURATION_DECODE_TABLE = WHITE_CONFIGURATION_ENCODE_TABLE.invert
240
-
241
- BLACK_CONFIGURATION_ENCODE_TABLE =
242
- {
243
- 64 => codeword('0000001111'),
244
- 128 => codeword('000011001000'),
245
- 192 => codeword('000011001001'),
246
- 256 => codeword('000001011011'),
247
- 320 => codeword('000000110011'),
248
- 384 => codeword('000000110100'),
249
- 448 => codeword('000000110101'),
250
- 512 => codeword('0000001101100'),
251
- 576 => codeword('0000001101101'),
252
- 640 => codeword('0000001001010'),
253
- 704 => codeword('0000001001011'),
254
- 768 => codeword('0000001001100'),
255
- 832 => codeword('0000001001101'),
256
- 896 => codeword('0000001110010'),
257
- 960 => codeword('0000001110011'),
258
- 1024 => codeword('0000001110100'),
259
- 1088 => codeword('0000001110101'),
260
- 1152 => codeword('0000001110110'),
261
- 1216 => codeword('0000001110111'),
262
- 1280 => codeword('0000001010010'),
263
- 1344 => codeword('0000001010011'),
264
- 1408 => codeword('0000001010100'),
265
- 1472 => codeword('0000001010101'),
266
- 1536 => codeword('0000001011010'),
267
- 1600 => codeword('0000001011011'),
268
- 1664 => codeword('0000001100100'),
269
- 1728 => codeword('0000001100101'),
270
-
271
- 1792 => codeword('00000001000'),
272
- 1856 => codeword('00000001100'),
273
- 1920 => codeword('00000001001'),
274
- 1984 => codeword('000000010010'),
275
- 2048 => codeword('000000010011'),
276
- 2112 => codeword('000000010100'),
277
- 2176 => codeword('000000010101'),
278
- 2240 => codeword('000000010110'),
279
- 2340 => codeword('000000010111'),
280
- 2368 => codeword('000000011100'),
281
- 2432 => codeword('000000011101'),
282
- 2496 => codeword('000000011110'),
283
- 2560 => codeword('000000011111')
284
- }
285
- BLACK_CONFIGURATION_DECODE_TABLE = BLACK_CONFIGURATION_ENCODE_TABLE.invert
286
-
287
55
  #
288
56
  # Creates a new CCITT Fax Filter.
289
57
  #
@@ -459,7 +227,7 @@ module Origami
459
227
  end
460
228
  end
461
229
 
462
- def encode_two_dimensional_line(input, output, columns, colors, prev_line) #:nodoc:
230
+ def encode_two_dimensional_line(_input, _output, _columns, _colors, _prev_line) #:nodoc:
463
231
  raise NotImplementedError "CCITT two-dimensional encoding scheme not supported."
464
232
  end
465
233
 
@@ -486,7 +254,7 @@ module Origami
486
254
  end
487
255
  end
488
256
 
489
- def decode_two_dimensional_line(input, output, columns, colors, prev_line) #:nodoc:
257
+ def decode_two_dimensional_line(_input, _output, _columns, _colors, _prev_line) #:nodoc:
490
258
  raise NotImplementedError, "CCITT two-dimensional decoding scheme not supported."
491
259
  end
492
260