origami-docspring 2.2.0 → 2.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/examples/attachments/attachment.rb +7 -8
- data/examples/attachments/nested_document.rb +6 -5
- data/examples/encryption/encryption.rb +5 -4
- data/examples/events/events.rb +7 -6
- data/examples/flash/flash.rb +10 -9
- data/examples/forms/javascript.rb +14 -13
- data/examples/forms/xfa.rb +67 -66
- data/examples/javascript/hello_world.rb +6 -5
- data/examples/javascript/js_emulation.rb +26 -26
- data/examples/loop/goto.rb +12 -11
- data/examples/loop/named.rb +17 -16
- data/examples/signature/signature.rb +11 -11
- data/examples/uri/javascript.rb +25 -24
- data/examples/uri/open-uri.rb +5 -4
- data/examples/uri/submitform.rb +11 -10
- data/lib/origami/3d.rb +330 -334
- data/lib/origami/acroform.rb +267 -268
- data/lib/origami/actions.rb +266 -278
- data/lib/origami/annotations.rb +659 -670
- data/lib/origami/array.rb +192 -196
- data/lib/origami/boolean.rb +66 -70
- data/lib/origami/catalog.rb +360 -363
- data/lib/origami/collections.rb +132 -133
- data/lib/origami/compound.rb +125 -129
- data/lib/origami/destinations.rb +226 -237
- data/lib/origami/dictionary.rb +155 -154
- data/lib/origami/encryption.rb +967 -923
- data/lib/origami/extensions/fdf.rb +270 -275
- data/lib/origami/extensions/ppklite.rb +323 -328
- data/lib/origami/filespec.rb +170 -173
- data/lib/origami/filters/ascii.rb +162 -167
- data/lib/origami/filters/ccitt/tables.rb +248 -252
- data/lib/origami/filters/ccitt.rb +309 -312
- data/lib/origami/filters/crypt.rb +31 -34
- data/lib/origami/filters/dct.rb +47 -50
- data/lib/origami/filters/flate.rb +57 -60
- data/lib/origami/filters/jbig2.rb +50 -53
- data/lib/origami/filters/jpx.rb +40 -43
- data/lib/origami/filters/lzw.rb +151 -155
- data/lib/origami/filters/predictors.rb +250 -255
- data/lib/origami/filters/runlength.rb +111 -115
- data/lib/origami/filters.rb +319 -325
- data/lib/origami/font.rb +173 -177
- data/lib/origami/functions.rb +62 -66
- data/lib/origami/graphics/colors.rb +203 -208
- data/lib/origami/graphics/instruction.rb +79 -81
- data/lib/origami/graphics/path.rb +141 -144
- data/lib/origami/graphics/patterns.rb +156 -160
- data/lib/origami/graphics/render.rb +51 -47
- data/lib/origami/graphics/state.rb +144 -142
- data/lib/origami/graphics/text.rb +185 -188
- data/lib/origami/graphics/xobject.rb +818 -804
- data/lib/origami/graphics.rb +25 -26
- data/lib/origami/header.rb +63 -65
- data/lib/origami/javascript.rb +718 -651
- data/lib/origami/linearization.rb +284 -285
- data/lib/origami/metadata.rb +156 -135
- data/lib/origami/name.rb +98 -100
- data/lib/origami/null.rb +49 -51
- data/lib/origami/numeric.rb +133 -135
- data/lib/origami/obfuscation.rb +180 -182
- data/lib/origami/object.rb +634 -631
- data/lib/origami/optionalcontent.rb +147 -149
- data/lib/origami/outline.rb +46 -48
- data/lib/origami/outputintents.rb +76 -77
- data/lib/origami/page.rb +637 -596
- data/lib/origami/parser.rb +214 -221
- data/lib/origami/parsers/fdf.rb +44 -45
- data/lib/origami/parsers/pdf/lazy.rb +147 -154
- data/lib/origami/parsers/pdf/linear.rb +104 -109
- data/lib/origami/parsers/pdf.rb +109 -107
- data/lib/origami/parsers/ppklite.rb +44 -46
- data/lib/origami/pdf.rb +886 -896
- data/lib/origami/reference.rb +116 -120
- data/lib/origami/signature.rb +617 -625
- data/lib/origami/stream.rb +560 -558
- data/lib/origami/string.rb +366 -368
- data/lib/origami/template/patterns.rb +50 -52
- data/lib/origami/template/widgets.rb +111 -114
- data/lib/origami/trailer.rb +153 -157
- data/lib/origami/tree.rb +55 -57
- data/lib/origami/version.rb +19 -19
- data/lib/origami/webcapture.rb +87 -90
- data/lib/origami/xfa/config.rb +409 -414
- data/lib/origami/xfa/connectionset.rb +113 -117
- data/lib/origami/xfa/datasets.rb +38 -42
- data/lib/origami/xfa/localeset.rb +33 -37
- data/lib/origami/xfa/package.rb +49 -52
- data/lib/origami/xfa/pdf.rb +54 -59
- data/lib/origami/xfa/signature.rb +33 -37
- data/lib/origami/xfa/sourceset.rb +34 -38
- data/lib/origami/xfa/stylesheet.rb +35 -39
- data/lib/origami/xfa/template.rb +1630 -1634
- data/lib/origami/xfa/xdc.rb +33 -37
- data/lib/origami/xfa/xfa.rb +132 -123
- data/lib/origami/xfa/xfdf.rb +34 -38
- data/lib/origami/xfa/xmpmeta.rb +34 -38
- data/lib/origami/xfa.rb +50 -53
- data/lib/origami/xreftable.rb +462 -462
- data/lib/origami.rb +37 -38
- data/test/test_actions.rb +22 -20
- data/test/test_annotations.rb +54 -52
- data/test/test_forms.rb +23 -21
- data/test/test_native_types.rb +82 -78
- data/test/test_object_tree.rb +25 -24
- data/test/test_pages.rb +43 -41
- data/test/test_pdf.rb +2 -0
- data/test/test_pdf_attachment.rb +23 -21
- data/test/test_pdf_create.rb +16 -15
- data/test/test_pdf_encrypt.rb +69 -66
- data/test/test_pdf_parse.rb +131 -129
- data/test/test_pdf_parse_lazy.rb +53 -53
- data/test/test_pdf_sign.rb +67 -67
- data/test/test_streams.rb +145 -143
- data/test/test_xrefs.rb +46 -45
- metadata +64 -8
data/lib/origami/font.rb
CHANGED
@@ -1,196 +1,192 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# This file is part of Origami, PDF manipulation framework for Ruby
|
5
|
+
# Copyright (C) 2016 Guillaume Delugré.
|
6
|
+
#
|
7
|
+
# Origami is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# Origami is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with Origami. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
2
20
|
|
3
|
-
|
4
|
-
|
21
|
+
module Origami
|
22
|
+
#
|
23
|
+
# Embedded font stream.
|
24
|
+
#
|
25
|
+
class FontStream < Stream
|
26
|
+
field :Subtype, Type: Name
|
27
|
+
field :Length1, Type: Integer
|
28
|
+
field :Length2, Type: Integer
|
29
|
+
field :Length3, Type: Integer
|
30
|
+
field :Metadata, Type: MetadataStream
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Class representing a font details in a document.
|
35
|
+
#
|
36
|
+
class FontDescriptor < Dictionary
|
37
|
+
include StandardObject
|
38
|
+
|
39
|
+
FIXEDPITCH = 1 << 1
|
40
|
+
SERIF = 1 << 2
|
41
|
+
SYMBOLIC = 1 << 3
|
42
|
+
SCRIPT = 1 << 4
|
43
|
+
NONSYMBOLIC = 1 << 6
|
44
|
+
ITALIC = 1 << 7
|
45
|
+
ALLCAP = 1 << 17
|
46
|
+
SMALLCAP = 1 << 18
|
47
|
+
FORCEBOLD = 1 << 19
|
48
|
+
|
49
|
+
field :Type, Type: Name, Default: :FontDescriptor, Required: true
|
50
|
+
field :FontName, Type: Name, Required: true
|
51
|
+
field :FontFamily, Type: String, Version: "1.5"
|
52
|
+
field :FontStretch, Type: Name, Default: :Normal, Version: "1.5"
|
53
|
+
field :FontWeight, Type: Integer, Default: 400, Version: "1.5"
|
54
|
+
field :Flags, Type: Integer, Required: true
|
55
|
+
field :FontBBox, Type: Rectangle
|
56
|
+
field :ItalicAngle, Type: Number, Required: true
|
57
|
+
field :Ascent, Type: Number
|
58
|
+
field :Descent, Type: Number
|
59
|
+
field :Leading, Type: Number, Default: 0
|
60
|
+
field :CapHeight, Type: Number
|
61
|
+
field :XHeight, Type: Number, Default: 0
|
62
|
+
field :StemV, Type: Number
|
63
|
+
field :StemH, Type: Number, Default: 0
|
64
|
+
field :AvgWidth, Type: Number, Default: 0
|
65
|
+
field :MaxWidth, Type: Number, Default: 0
|
66
|
+
field :MissingWidth, Type: Number, Default: 0
|
67
|
+
field :FontFile, Type: FontStream
|
68
|
+
field :FontFile2, Type: FontStream, Version: "1.1"
|
69
|
+
field :FontFile3, Type: FontStream, Version: "1.2"
|
70
|
+
field :CharSet, Type: String, Version: "1.1"
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# Class representing a character encoding in a document.
|
75
|
+
#
|
76
|
+
class Encoding < Dictionary
|
77
|
+
include StandardObject
|
78
|
+
|
79
|
+
field :Type, Type: Name, Default: :Encoding
|
80
|
+
field :BaseEncoding, Type: Name
|
81
|
+
field :Differences, Type: Array
|
82
|
+
end
|
83
|
+
|
84
|
+
#
|
85
|
+
# Class representing a rendering font in a document.
|
86
|
+
#
|
87
|
+
class Font < Dictionary
|
88
|
+
include StandardObject
|
89
|
+
|
90
|
+
field :Type, Type: Name, Default: :Font, Required: true
|
91
|
+
field :Subtype, Type: Name, Required: true
|
92
|
+
field :Name, Type: Name
|
93
|
+
field :FirstChar, Type: Integer
|
94
|
+
field :LastChar, Type: Integer
|
95
|
+
field :Widths, Type: Array.of(Number)
|
96
|
+
field :FontDescriptor, Type: FontDescriptor
|
97
|
+
field :Encoding, Type: [Name, Encoding], Default: :MacRomanEncoding
|
98
|
+
field :ToUnicode, Type: Stream, Version: "1.2"
|
99
|
+
|
100
|
+
# TODO: Type0 and CID Fonts
|
5
101
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
102
|
+
#
|
103
|
+
# Type1 Fonts.
|
104
|
+
#
|
105
|
+
class Type1 < Font
|
106
|
+
field :BaseFont, Type: Name, Required: true
|
107
|
+
field :Subtype, Type: Name, Default: :Type1, Required: true
|
108
|
+
|
109
|
+
#
|
110
|
+
# 14 standard Type1 fonts.
|
111
|
+
#
|
112
|
+
module Standard
|
113
|
+
class TimesRoman < Type1
|
114
|
+
field :BaseFont, Type: Name, Default: :'Times-Roman', Required: true
|
115
|
+
end
|
10
116
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
GNU Lesser General Public License for more details.
|
117
|
+
class Helvetica < Type1
|
118
|
+
field :BaseFont, Type: Name, Default: :Helvetica, Required: true
|
119
|
+
end
|
15
120
|
|
16
|
-
|
17
|
-
|
121
|
+
class Courier < Type1
|
122
|
+
field :BaseFont, Type: Name, Default: :Courier, Required: true
|
123
|
+
end
|
18
124
|
|
19
|
-
|
125
|
+
class Symbol < Type1
|
126
|
+
field :BaseFont, Type: Name, Default: :Symbol, Required: true
|
127
|
+
end
|
20
128
|
|
21
|
-
|
129
|
+
class TimesBold < Type1
|
130
|
+
field :BaseFont, Type: Name, Default: :'Times-Bold', Required: true
|
131
|
+
end
|
22
132
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
class FontStream < Stream
|
27
|
-
field :Subtype, :Type => Name
|
28
|
-
field :Length1, :Type => Integer
|
29
|
-
field :Length2, :Type => Integer
|
30
|
-
field :Length3, :Type => Integer
|
31
|
-
field :Metadata, :Type => MetadataStream
|
32
|
-
end
|
133
|
+
class HelveticaBold < Type1
|
134
|
+
field :BaseFont, Type: Name, Default: :'Helvetica-Bold', Required: true
|
135
|
+
end
|
33
136
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
class FontDescriptor < Dictionary
|
38
|
-
include StandardObject
|
39
|
-
|
40
|
-
FIXEDPITCH = 1 << 1
|
41
|
-
SERIF = 1 << 2
|
42
|
-
SYMBOLIC = 1 << 3
|
43
|
-
SCRIPT = 1 << 4
|
44
|
-
NONSYMBOLIC = 1 << 6
|
45
|
-
ITALIC = 1 << 7
|
46
|
-
ALLCAP = 1 << 17
|
47
|
-
SMALLCAP = 1 << 18
|
48
|
-
FORCEBOLD = 1 << 19
|
49
|
-
|
50
|
-
field :Type, :Type => Name, :Default => :FontDescriptor, :Required => true
|
51
|
-
field :FontName, :Type => Name, :Required => true
|
52
|
-
field :FontFamily, :Type => String, :Version => "1.5"
|
53
|
-
field :FontStretch, :Type => Name, :Default => :Normal, :Version => "1.5"
|
54
|
-
field :FontWeight, :Type => Integer, :Default => 400, :Version => "1.5"
|
55
|
-
field :Flags, :Type => Integer, :Required => true
|
56
|
-
field :FontBBox, :Type => Rectangle
|
57
|
-
field :ItalicAngle, :Type => Number, :Required => true
|
58
|
-
field :Ascent, :Type => Number
|
59
|
-
field :Descent, :Type => Number
|
60
|
-
field :Leading, :Type => Number, :Default => 0
|
61
|
-
field :CapHeight, :Type => Number
|
62
|
-
field :XHeight, :Type => Number, :Default => 0
|
63
|
-
field :StemV, :Type => Number
|
64
|
-
field :StemH, :Type => Number, :Default => 0
|
65
|
-
field :AvgWidth, :Type => Number, :Default => 0
|
66
|
-
field :MaxWidth, :Type => Number, :Default => 0
|
67
|
-
field :MissingWidth, :Type => Number, :Default => 0
|
68
|
-
field :FontFile, :Type => FontStream
|
69
|
-
field :FontFile2, :Type => FontStream, :Version => "1.1"
|
70
|
-
field :FontFile3, :Type => FontStream, :Version => "1.2"
|
71
|
-
field :CharSet, :Type => String, :Version => "1.1"
|
72
|
-
end
|
137
|
+
class CourierBold < Type1
|
138
|
+
field :BaseFont, Type: Name, Default: :'Courier-Bold', Required: true
|
139
|
+
end
|
73
140
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
class Encoding < Dictionary
|
78
|
-
include StandardObject
|
141
|
+
class ZapfDingbats < Type1
|
142
|
+
field :BaseFont, Type: Name, Default: :ZapfDingbats, Required: true
|
143
|
+
end
|
79
144
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
145
|
+
class TimesItalic < Type1
|
146
|
+
field :BaseFont, Type: Name, Default: :'Times-Italic', Required: true
|
147
|
+
end
|
84
148
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
field :Type, :Type => Name, :Default => :Font, :Required => true
|
92
|
-
field :Subtype, :Type => Name, :Required => true
|
93
|
-
field :Name, :Type => Name
|
94
|
-
field :FirstChar, :Type => Integer
|
95
|
-
field :LastChar, :Type => Integer
|
96
|
-
field :Widths, :Type => Array.of(Number)
|
97
|
-
field :FontDescriptor, :Type => FontDescriptor
|
98
|
-
field :Encoding, :Type => [ Name, Encoding ], :Default => :MacRomanEncoding
|
99
|
-
field :ToUnicode, :Type => Stream, :Version => "1.2"
|
100
|
-
|
101
|
-
# TODO: Type0 and CID Fonts
|
102
|
-
|
103
|
-
#
|
104
|
-
# Type1 Fonts.
|
105
|
-
#
|
106
|
-
class Type1 < Font
|
107
|
-
|
108
|
-
field :BaseFont, :Type => Name, :Required => true
|
109
|
-
field :Subtype, :Type => Name, :Default => :Type1, :Required => true
|
110
|
-
|
111
|
-
#
|
112
|
-
# 14 standard Type1 fonts.
|
113
|
-
#
|
114
|
-
module Standard
|
115
|
-
|
116
|
-
class TimesRoman < Type1
|
117
|
-
field :BaseFont, :Type => Name, :Default => :"Times-Roman", :Required => true
|
118
|
-
end
|
119
|
-
|
120
|
-
class Helvetica < Type1
|
121
|
-
field :BaseFont, :Type => Name, :Default => :Helvetica, :Required => true
|
122
|
-
end
|
123
|
-
|
124
|
-
class Courier < Type1
|
125
|
-
field :BaseFont, :Type => Name, :Default => :Courier, :Required => true
|
126
|
-
end
|
127
|
-
|
128
|
-
class Symbol < Type1
|
129
|
-
field :BaseFont, :Type => Name, :Default => :Symbol, :Required => true
|
130
|
-
end
|
131
|
-
|
132
|
-
class TimesBold < Type1
|
133
|
-
field :BaseFont, :Type => Name, :Default => :"Times-Bold", :Required => true
|
134
|
-
end
|
135
|
-
|
136
|
-
class HelveticaBold < Type1
|
137
|
-
field :BaseFont, :Type => Name, :Default => :"Helvetica-Bold", :Required => true
|
138
|
-
end
|
139
|
-
|
140
|
-
class CourierBold < Type1
|
141
|
-
field :BaseFont, :Type => Name, :Default => :"Courier-Bold", :Required => true
|
142
|
-
end
|
143
|
-
|
144
|
-
class ZapfDingbats < Type1
|
145
|
-
field :BaseFont, :Type => Name, :Default => :ZapfDingbats, :Required => true
|
146
|
-
end
|
147
|
-
|
148
|
-
class TimesItalic < Type1
|
149
|
-
field :BaseFont, :Type => Name, :Default => :"Times-Italic", :Required => true
|
150
|
-
end
|
151
|
-
|
152
|
-
class HelveticaOblique < Type1
|
153
|
-
field :BaseFont, :Type => Name, :Default => :"Helvetica-Oblique", :Required => true
|
154
|
-
end
|
155
|
-
|
156
|
-
class CourierOblique < Type1
|
157
|
-
field :BaseFont, :Type => Name, :Default => :"Courier-Oblique", :Required => true
|
158
|
-
end
|
159
|
-
|
160
|
-
class TimesBoldItalic < Type1
|
161
|
-
field :BaseFont, :Type => Name, :Default => :"Times-BoldItalic", :Required => true
|
162
|
-
end
|
163
|
-
|
164
|
-
class HelveticaBoldOblique < Type1
|
165
|
-
field :BaseFont, :Type => Name, :Default => :"Helvetica-BoldOblique", :Required => true
|
166
|
-
end
|
167
|
-
|
168
|
-
class CourierBoldOblique < Type1
|
169
|
-
field :BaseFont, :Type => Name, :Default => :"Courier-BoldOblique", :Required => true
|
170
|
-
end
|
171
|
-
end
|
149
|
+
class HelveticaOblique < Type1
|
150
|
+
field :BaseFont, Type: Name, Default: :'Helvetica-Oblique', Required: true
|
151
|
+
end
|
152
|
+
|
153
|
+
class CourierOblique < Type1
|
154
|
+
field :BaseFont, Type: Name, Default: :'Courier-Oblique', Required: true
|
172
155
|
end
|
173
156
|
|
174
|
-
|
175
|
-
|
176
|
-
#
|
177
|
-
class TrueType < Font
|
178
|
-
field :Subtype, :Type => Name, :Default => :TrueType, :Required => true
|
179
|
-
field :BaseFont, :Type => Name, :Required => true
|
157
|
+
class TimesBoldItalic < Type1
|
158
|
+
field :BaseFont, Type: Name, Default: :'Times-BoldItalic', Required: true
|
180
159
|
end
|
181
160
|
|
182
|
-
|
183
|
-
|
184
|
-
#
|
185
|
-
class Type3 < Font
|
186
|
-
include ResourcesHolder
|
187
|
-
|
188
|
-
field :Subtype, :Type => Name, :Default => :Type3, :Required => true
|
189
|
-
field :FontBBox, :Type => Rectangle, :Required => true
|
190
|
-
field :FontMatrix, :Type => Array.of(Number, length: 6), :Required => true
|
191
|
-
field :CharProcs, :Type => Dictionary, :Required => true
|
192
|
-
field :Resources, :Type => Resources, :Version => "1.2"
|
161
|
+
class HelveticaBoldOblique < Type1
|
162
|
+
field :BaseFont, Type: Name, Default: :'Helvetica-BoldOblique', Required: true
|
193
163
|
end
|
164
|
+
|
165
|
+
class CourierBoldOblique < Type1
|
166
|
+
field :BaseFont, Type: Name, Default: :'Courier-BoldOblique', Required: true
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
#
|
172
|
+
# TrueType Fonts
|
173
|
+
#
|
174
|
+
class TrueType < Font
|
175
|
+
field :Subtype, Type: Name, Default: :TrueType, Required: true
|
176
|
+
field :BaseFont, Type: Name, Required: true
|
194
177
|
end
|
195
178
|
|
179
|
+
#
|
180
|
+
# Type 3 Fonts
|
181
|
+
#
|
182
|
+
class Type3 < Font
|
183
|
+
include ResourcesHolder
|
184
|
+
|
185
|
+
field :Subtype, Type: Name, Default: :Type3, Required: true
|
186
|
+
field :FontBBox, Type: Rectangle, Required: true
|
187
|
+
field :FontMatrix, Type: Array.of(Number, length: 6), Required: true
|
188
|
+
field :CharProcs, Type: Dictionary, Required: true
|
189
|
+
field :Resources, Type: Resources, Version: "1.2"
|
190
|
+
end
|
191
|
+
end
|
196
192
|
end
|
data/lib/origami/functions.rb
CHANGED
@@ -1,79 +1,75 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# This file is part of Origami, PDF manipulation framework for Ruby
|
5
|
+
# Copyright (C) 2016 Guillaume Delugré.
|
6
|
+
#
|
7
|
+
# Origami is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# Origami is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with Origami. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
21
20
|
|
22
21
|
module Origami
|
22
|
+
module Function
|
23
|
+
module Type
|
24
|
+
SAMPLED = 0
|
25
|
+
EXPONENTIAL = 2
|
26
|
+
STITCHING = 3
|
27
|
+
POSTSCRIPT = 4
|
28
|
+
end
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
STITCHING = 3
|
30
|
-
POSTSCRIPT = 4
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.included(receiver)
|
34
|
-
receiver.field :FunctionType, :Type => Integer, :Required => true
|
35
|
-
receiver.field :Domain, :Type => Array.of(Number), :Required => true
|
36
|
-
receiver.field :Range, :Type => Array.of(Number)
|
37
|
-
end
|
30
|
+
def self.included(receiver)
|
31
|
+
receiver.field :FunctionType, Type: Integer, Required: true
|
32
|
+
receiver.field :Domain, Type: Array.of(Number), Required: true
|
33
|
+
receiver.field :Range, Type: Array.of(Number)
|
34
|
+
end
|
38
35
|
|
39
|
-
|
40
|
-
|
36
|
+
class Sampled < Stream
|
37
|
+
include Function
|
41
38
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
39
|
+
field :FunctionType, Type: Integer, Default: Type::SAMPLED, Version: "1.3", Required: true
|
40
|
+
field :Range, Type: Array.of(Number), Required: true
|
41
|
+
field :Size, Type: Array.of(Integer), Required: true
|
42
|
+
field :BitsPerSample, Type: Integer, Required: true
|
43
|
+
field :Order, Type: Integer, Default: 1
|
44
|
+
field :Encode, Type: Array.of(Number)
|
45
|
+
field :Decode, Type: Array.of(Number)
|
46
|
+
end
|
50
47
|
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
class Exponential < Dictionary
|
49
|
+
include StandardObject
|
50
|
+
include Function
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
field :FunctionType, Type: Integer, Default: Type::EXPONENTIAL, Version: "1.3", Required: true
|
53
|
+
field :C0, Type: Array.of(Number), Default: [0.0]
|
54
|
+
field :C1, Type: Array.of(Number), Default: [1.0]
|
55
|
+
field :N, Type: Number, Required: true
|
56
|
+
end
|
60
57
|
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
class Stitching < Dictionary
|
59
|
+
include StandardObject
|
60
|
+
include Function
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
62
|
+
field :FunctionType, Type: Integer, Default: Type::STITCHING, Version: "1.3", Required: true
|
63
|
+
field :Functions, Type: Array, Required: true
|
64
|
+
field :Bounds, Type: Array.of(Number), Required: true
|
65
|
+
field :Encode, Type: Array.of(Number), Required: true
|
66
|
+
end
|
70
67
|
|
71
|
-
|
72
|
-
|
68
|
+
class PostScript < Stream
|
69
|
+
include Function
|
73
70
|
|
74
|
-
|
75
|
-
|
76
|
-
end
|
71
|
+
field :FunctionType, Type: Integer, Default: Type::POSTSCRIPT, Version: "1.3", Required: true
|
72
|
+
field :Range, Type: Array.of(Number), Required: true
|
77
73
|
end
|
78
|
-
|
74
|
+
end
|
79
75
|
end
|