lib/origami/functions.rb in origami-1.2.7 vs lib/origami/functions.rb in origami-2.0.0
- old
+ new
@@ -1,93 +1,79 @@
=begin
-= File
- functions.rb
+ This file is part of Origami, PDF manipulation framework for Ruby
+ Copyright (C) 2016 Guillaume Delugré.
-= Info
- This file is part of Origami, PDF manipulation framework for Ruby
- Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org>
- All right reserved.
-
- Origami is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ Origami is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- Origami is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
+ Origami is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with Origami. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with Origami. If not, see <http://www.gnu.org/licenses/>.
=end
module Origami
- module Function
+ module Function
- module Type
- SAMPLED = 0
- EXPONENTIAL = 2
- STITCHING = 3
- POSTSCRIPT = 4
- end
-
- def self.included(receiver)
- receiver.field :FunctionType, :Type => Integer, :Required => true
- receiver.field :Domain, :Type => Array, :Required => true
- receiver.field :Range, :Type => Array
- end
+ module Type
+ SAMPLED = 0
+ EXPONENTIAL = 2
+ STITCHING = 3
+ POSTSCRIPT = 4
+ end
- class Sampled < Stream
+ def self.included(receiver)
+ receiver.field :FunctionType, :Type => Integer, :Required => true
+ receiver.field :Domain, :Type => Array.of(Number), :Required => true
+ receiver.field :Range, :Type => Array.of(Number)
+ end
- include Function
+ class Sampled < Stream
+ include Function
- field :FunctionType, :Type => Integer, :Default => Type::SAMPLED, :Version => "1.3", :Required => true
- field :Range, :Type => Array, :Required => true
- field :Size, :Type => Array, :Required => true
- field :BitsPerSample, :Type => Integer, :Required => true
- field :Order, :Type => Integer, :Default => 1
- field :Encode, :Type => Array
- field :Decode, :Type => Array
+ field :FunctionType, :Type => Integer, :Default => Type::SAMPLED, :Version => "1.3", :Required => true
+ field :Range, :Type => Array.of(Number), :Required => true
+ field :Size, :Type => Array.of(Integer), :Required => true
+ field :BitsPerSample, :Type => Integer, :Required => true
+ field :Order, :Type => Integer, :Default => 1
+ field :Encode, :Type => Array.of(Number)
+ field :Decode, :Type => Array.of(Number)
+ end
- end
+ class Exponential < Dictionary
+ include StandardObject
+ include Function
- class Exponential < Dictionary
-
- include StandardObject
- include Function
+ field :FunctionType, :Type => Integer, :Default => Type::EXPONENTIAL, :Version => "1.3", :Required => true
+ field :C0, :Type => Array.of(Number), :Default => [ 0.0 ]
+ field :C1, :Type => Array.of(Number), :Default => [ 1.0 ]
+ field :N, :Type => Number, :Required => true
+ end
- field :FunctionType, :Type => Integer, :Default => Type::EXPONENTIAL, :Version => "1.3", :Required => true
- field :C0, :Type => Array, :Default => [ 0.0 ]
- field :C1, :Type => Array, :Default => [ 1.0 ]
- field :N, :Type => Number, :Required => true
+ class Stitching < Dictionary
+ include StandardObject
+ include Function
- end
+ field :FunctionType, :Type => Integer, :Default => Type::STITCHING, :Version => "1.3", :Required => true
+ field :Functions, :Type => Array, :Required => true
+ field :Bounds, :Type => Array.of(Number), :Required => true
+ field :Encode, :Type => Array.of(Number), :Required => true
+ end
- class Stitching < Dictionary
+ class PostScript < Stream
+ include Function
- include StandardObject
- include Function
-
- field :FunctionType, :Type => Integer, :Default => Type::STITCHING, :Version => "1.3", :Required => true
- field :Functions, :Type => Array, :Required => true
- field :Bounds, :Type => Array, :Required => true
- field :Encode, :Type => Array, :Required => true
-
+ field :FunctionType, :Type => Integer, :Default => Type::POSTSCRIPT, :Version => "1.3", :Required => true
+ field :Range, :Type => Array.of(Number), :Required => true
+ end
end
-
- class PostScript < Stream
-
- include Function
-
- field :FunctionType, :Type => Integer, :Default => Type::POSTSCRIPT, :Version => "1.3", :Required => true
- field :Range, :Type => Array, :Required => true
-
- end
-
- end
end