Class: Pdfrb::Model::Type::Function
Overview
PDF Function dictionary (s8.9.1). Functions map input values to
output values; used by shadings, color spaces, and other
computational graphics primitives.
Four function types exist (s8.9.4..7):
* Type 0: Sampled (N-dimensional lookup table)
* Type 2: Exponential (C0 + (C1 - C0) * t^r)
* Type 3: Stitching (concatenation of multiple subfunctions)
* Type 4: PostScript calculator (most flexible)
Instance Attribute Summary
Attributes inherited from Object
#document, #gen, #oid, #value
Instance Method Summary
collapse
#[], #[]=, arlington_available?, arlington_default, arlington_key_to_symbol, arlington_loaded_for?, arlington_mark_loaded, arlington_object, arlington_one_type_to_ruby, arlington_required?, arlington_types_to_ruby, arlington_version, define_field, define_field_from_arlington, #delete, #each, each_field, #each_raw, #empty?, field, #initialize, #key?, #keys, lookup_type, own_fields, #pdf_type, register_type, type_map, #validate
Methods inherited from Object
#==, define_type, #deref, #indirect?, #initialize, #must_be_indirect?, #pdf_type, pdf_type
Instance Method Details
18
|
# File 'lib/pdfrb/model/type/function.rb', line 18
def domain; self[:Domain]; end
|
#exponential? ⇒ Boolean
22
|
# File 'lib/pdfrb/model/type/function.rb', line 22
def exponential?; function_type == 2; end
|
#function_type ⇒ Object
16
|
# File 'lib/pdfrb/model/type/function.rb', line 16
def function_type; self[:FunctionType]; end
|
26
27
28
29
30
31
|
# File 'lib/pdfrb/model/type/function.rb', line 26
def input_dimension
return nil unless domain
arr = domain.is_a?(Pdfrb::Model::PdfArray) ? domain.to_a : domain
arr.is_a?(Array) ? arr.size / 2 : nil
end
|
#output_dimension ⇒ Object
33
34
35
36
37
38
|
# File 'lib/pdfrb/model/type/function.rb', line 33
def output_dimension
return nil unless range
arr = range.is_a?(Pdfrb::Model::PdfArray) ? range.to_a : range
arr.is_a?(Array) ? arr.size / 2 : nil
end
|
#postscript? ⇒ Boolean
24
|
# File 'lib/pdfrb/model/type/function.rb', line 24
def postscript?; function_type == 4; end
|
19
|
# File 'lib/pdfrb/model/type/function.rb', line 19
def range; self[:Range]; end
|
#sampled? ⇒ Boolean
21
|
# File 'lib/pdfrb/model/type/function.rb', line 21
def sampled?; function_type.zero?; end
|
#stitching? ⇒ Boolean
23
|
# File 'lib/pdfrb/model/type/function.rb', line 23
def stitching?; function_type == 3; end
|