Class: Pdfrb::Model::Type::DeviceN

Inherits:
Cos::Dictionary show all
Defined in:
lib/pdfrb/model/type/device_n.rb

Overview

DeviceN attributes dictionary (s8.6.6.4, the 5th element of the DeviceN color space array). Names extra colorants and process/mixing hints.

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Instance Method Summary collapse

Methods inherited from Cos::Dictionary

#[], #[]=, apply_arlington_definition, arlington_default, arlington_key_to_symbol, arlington_one_type_to_ruby, arlington_required?, arlington_scalar, 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, merged_field, own_fields, #pdf_type, register_type, type_map, #validate

Methods included from Cos::ArlingtonBacked

#arlington_object

Methods inherited from Object

#==, define_type, #deref, #indirect?, #initialize, #must_be_indirect?, #pdf_type, pdf_type

Constructor Details

This class inherits a constructor from Pdfrb::Model::Cos::Dictionary

Instance Method Details

#colorant_countObject



20
21
22
23
24
25
# File 'lib/pdfrb/model/type/device_n.rb', line 20

def colorant_count
  return 0 unless colorants

  arr = colorants.is_a?(Pdfrb::Model::PdfArray) ? colorants.to_a : colorants
  arr.is_a?(Array) ? arr.size : 0
end

#colorantsObject



12
# File 'lib/pdfrb/model/type/device_n.rb', line 12

def colorants; self[:Colorants]; end

#componentsObject



27
28
29
# File 'lib/pdfrb/model/type/device_n.rb', line 27

def components
  colorant_count
end

#each_colorantObject



31
32
33
34
35
36
37
38
39
# File 'lib/pdfrb/model/type/device_n.rb', line 31

def each_colorant(&)
  return enum_for(:each_colorant) unless block_given?
  return unless colorants

  arr = colorants.is_a?(Pdfrb::Model::PdfArray) ? colorants.to_a : colorants
  return unless arr.is_a?(Array)

  arr.each(&)
end

#mixing_hintsObject



14
# File 'lib/pdfrb/model/type/device_n.rb', line 14

def mixing_hints; self[:MixingHints]; end

#nchannel?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/pdfrb/model/type/device_n.rb', line 16

def nchannel?
  subtype == :NChannel
end

#processObject



13
# File 'lib/pdfrb/model/type/device_n.rb', line 13

def process; self[:Process]; end

#subtypeObject



11
# File 'lib/pdfrb/model/type/device_n.rb', line 11

def subtype; self[:Subtype]&.to_sym; end