Class: PSD::SelectiveColor

Inherits:
LayerInfo show all
Defined in:
lib/psd/layer/info/selective_color.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

#black_correctionObject (readonly)

Returns the value of attribute black_correction.



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

def black_correction
  @black_correction
end

#correction_modeObject (readonly)

Returns the value of attribute correction_mode.



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

def correction_mode
  @correction_mode
end

#cyan_correctionObject (readonly)

Returns the value of attribute cyan_correction.



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

def cyan_correction
  @cyan_correction
end

#magenta_correctionObject (readonly)

Returns the value of attribute magenta_correction.



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

def magenta_correction
  @magenta_correction
end

#yellow_correctionObject (readonly)

Returns the value of attribute yellow_correction.



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

def yellow_correction
  @yellow_correction
end

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)


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

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

Instance Method Details

#parseObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/psd/layer/info/selective_color.rb', line 12

def parse
  @file.seek 2, IO::SEEK_CUR

  @correction_mode = @file.read_short == 0 ? :relative : :absolute
  @cyan_correction = []
  @magenta_correction = []
  @yellow_correction = []
  @black_correction = []

  10.times do |i|
    # First record is all 0 and is ignored by Photoshop
    @file.seek(8, IO::SEEK_CUR) and next if i == 0

    @cyan_correction    << @file.read_short
    @magenta_correction << @file.read_short
    @yellow_correction  << @file.read_short
    @black_correction   << @file.read_short
  end
end