Class: PSD::VectorMask

Inherits:
LayerInfo show all
Defined in:
lib/psd/layer/info/vector_mask.rb

Instance Attribute Summary collapse

Attributes inherited from LayerInfo

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LayerInfo

#initialize, #skip

Constructor Details

This class inherits a constructor from PSD::LayerInfo

Instance Attribute Details

#disableObject (readonly)

Returns the value of attribute disable.



9
10
11
# File 'lib/psd/layer/info/vector_mask.rb', line 9

def disable
  @disable
end

#invertObject (readonly)

Returns the value of attribute invert.



9
10
11
# File 'lib/psd/layer/info/vector_mask.rb', line 9

def invert
  @invert
end

Returns the value of attribute not_link.



9
10
11
# File 'lib/psd/layer/info/vector_mask.rb', line 9

def not_link
  @not_link
end

#pathsObject (readonly)

Returns the value of attribute paths.



9
10
11
# File 'lib/psd/layer/info/vector_mask.rb', line 9

def paths
  @paths
end

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/psd/layer/info/vector_mask.rb', line 5

def self.should_parse?(key)
  ['vmsk', 'vsms'].include?(key)
end

Instance Method Details

#parseObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/psd/layer/info/vector_mask.rb', line 11

def parse
  version = @file.read_int
  tag = @file.read_int

  @invert = tag & 0x01
  @not_link = (tag & (0x01 << 1)) > 0
  @disable = (tag & (0x01 << 2)) > 0

  # I haven't figured out yet why this is 10 and not 8.
  num_records = (@length - 10) / 26
  @paths = []
  num_records.times do
    @paths << PathRecord.new(@file)
  end
end