Class: PSD::ChannelBlendingRestrictions

Inherits:
LayerInfo
  • Object
show all
Defined in:
lib/psd/layer/info/channel_blending_restrictions.rb

Constant Summary collapse

MODES =
{
  'RGBColor' => ['R', 'G', 'B'],
  'CMYKColor' => ['C', 'M', 'Y', 'K']
}

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

#restricted_channelsObject (readonly)

Returns the value of attribute restricted_channels.



14
15
16
# File 'lib/psd/layer/info/channel_blending_restrictions.rb', line 14

def restricted_channels
  @restricted_channels
end

#restricted_channels_by_letterObject (readonly)

Returns the value of attribute restricted_channels_by_letter.



14
15
16
# File 'lib/psd/layer/info/channel_blending_restrictions.rb', line 14

def restricted_channels_by_letter
  @restricted_channels_by_letter
end

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.should_parse?(key)
  key == 'brst'
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/psd/layer/info/channel_blending_restrictions.rb', line 16

def parse
  @restricted_channels = []
  @restricted_channels_by_letter = []

  (@length / 4).times do
    channel = @file.read_int
    @restricted_channels << channel
    @restricted_channels_by_letter << MODES[@layer.header.mode_name][channel]
  end
end