Class: Pdfrb::Model::Type::FunctionSampled
Overview
Type 0 Sampled function (s8.9.3). N-dimensional lookup table
with interpolation. Carries sample data in the stream payload.
Instance Attribute Summary
Attributes inherited from Cos::Stream
#stream
Attributes inherited from Object
#document, #gen, #oid, #value
Instance Method Summary
collapse
Methods inherited from Cos::Stream
#decoded_stream, #encoded_stream=, #initialize
#[], #[]=, 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
#bit_depth_16? ⇒ Boolean
49
50
51
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 49
def bit_depth_16?
bits_per_sample == 16
end
|
#bit_depth_8? ⇒ Boolean
45
46
47
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 45
def bit_depth_8?
bits_per_sample == 8
end
|
#bits_per_sample ⇒ Object
14
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 14
def bits_per_sample; self[:BitsPerSample]; end
|
16
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 16
def decode; self[:Decode]; end
|
11
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 11
def domain; self[:Domain]; end
|
15
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 15
def encode; self[:Encode]; end
|
#function_type ⇒ Object
9
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 9
def function_type; self[:FunctionType] || 0; end
|
22
23
24
25
26
27
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 22
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
29
30
31
32
33
34
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 29
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
|
12
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 12
def range; self[:Range]; end
|
#sample_count ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 36
def sample_count
return 1 unless size
arr = size.is_a?(Pdfrb::Model::PdfArray) ? size.to_a : size
return 1 unless arr.is_a?(Array) && !arr.empty?
arr.reduce(1) { |product, n| product * n.to_i }
end
|
#sampled? ⇒ Boolean
18
19
20
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 18
def sampled?
true
end
|
13
|
# File 'lib/pdfrb/model/type/function_sampled.rb', line 13
def size; self[:Size]; end
|