Class: Pdfrb::Model::Type::XObjectImage
Overview
Image XObject (s8.9). /Type /XObject, /Subtype /Image,
/Width, /Height, /ColorSpace, /BitsPerComponent, etc.
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
#alternates ⇒ Object
25
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 25
def alternates; self[:Alternates]; end
|
#associated_files ⇒ Object
29
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 29
def associated_files; self[:AF]; end
|
#bits_per_component ⇒ Object
15
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 15
def bits_per_component; self[:BitsPerComponent]; end
|
#bytes_per_row ⇒ Object
61
62
63
64
65
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 61
def bytes_per_row
return nil unless width && bits_per_component && components
((width * components * bits_per_component) + 7) / 8
end
|
#color_space ⇒ Object
14
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 14
def color_space; self[:ColorSpace]; end
|
#components ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 31
def components
cs = color_space
return 0 unless cs
case cs.to_sym
when :DeviceGray, :CalGray, :Indexed then 1
when :DeviceRGB, :CalRGB, :Lab then 3
when :DeviceCMYK then 4
end
rescue StandardError
nil
end
|
17
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 17
def decode; self[:Decode]; end
|
#decode_parms ⇒ Object
23
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 23
def decode_parms; self[:DecodeParms]; end
|
16
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 16
def filter; self[:Filter]; end
|
#has_soft_mask? ⇒ Boolean
48
49
50
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 48
def has_soft_mask?
!!smask || smask_in_data.to_i.positive?
end
|
13
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 13
def height; self[:Height]; end
|
#image_mask? ⇒ Boolean
19
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 19
def image_mask?; truthy?(self[:ImageMask]); end
|
#indexed? ⇒ Boolean
56
57
58
59
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 56
def indexed?
color_space.is_a?(Array) &&
color_space.to_ary.first&.to_sym == :Indexed
end
|
#inline_soft_mask? ⇒ Boolean
52
53
54
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 52
def inline_soft_mask?
smask_in_data.to_i == 2
end
|
18
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 18
def intent; self[:Intent]; end
|
#interpolate? ⇒ Boolean
24
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 24
def interpolate?; truthy?(self[:Interpolate]); end
|
20
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 20
def mask; self[:Mask]; end
|
#masked? ⇒ Boolean
44
45
46
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 44
def masked?
image_mask? || !!mask
end
|
27
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 27
def name; self[:Name]; end
|
26
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 26
def oc; self[:OC]; end
|
21
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 21
def smask; self[:SMask]; end
|
#smask_in_data ⇒ Object
22
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 22
def smask_in_data; self[:SMaskInData]; end
|
#struct_parent ⇒ Object
28
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 28
def struct_parent; self[:StructParent]; end
|
11
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 11
def subtype; self[:Subtype]; end
|
12
|
# File 'lib/pdfrb/model/type/xobject_image.rb', line 12
def width; self[:Width]; end
|