Class: PSD::HueSaturation

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

#colorizationObject (readonly)

Returns the value of attribute colorization


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

def colorization
  @colorization
end

#masterObject (readonly)

Returns the value of attribute master


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

def master
  @master
end

#range_valuesObject (readonly)

Returns the value of attribute range_values


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

def range_values
  @range_values
end

#setting_valuesObject (readonly)

Returns the value of attribute setting_values


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

def setting_values
  @setting_values
end

#typeObject (readonly)

Returns the value of attribute type


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

def type
  @type
end

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)

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

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

Instance Method Details

#parseObject


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/psd/layer/info/hue_saturation.rb', line 11

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

  @type = @file.read_byte == 0 ? :hue : :colorization

  # Padding byte
  @file.seek 1, IO::SEEK_CUR

  @colorization = {
    hue: @file.read_short,
    saturation: @file.read_short,
    lightness: @file.read_short
  }

  @master = {
    hue: @file.read_short,
    saturation: @file.read_short,
    lightness: @file.read_short
  }

  @range_values = []
  @setting_values = []

  6.times do
    @range_values << 4.times.map { @file.read_short }
    @setting_values << 3.times.map { @file.read_short }
  end
end