Class: PSD::BlackWhite

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

#blueObject (readonly)

Returns the value of attribute blue.



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

def blue
  @blue
end

#cyanObject (readonly)

Returns the value of attribute cyan.



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

def cyan
  @cyan
end

#greenObject (readonly)

Returns the value of attribute green.



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

def green
  @green
end

#magentaObject (readonly)

Returns the value of attribute magenta.



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

def magenta
  @magenta
end

#preset_idObject (readonly)

Returns the value of attribute preset_id.



10
11
12
# File 'lib/psd/layer/info/black_white.rb', line 10

def preset_id
  @preset_id
end

#preset_nameObject (readonly)

Returns the value of attribute preset_name.



10
11
12
# File 'lib/psd/layer/info/black_white.rb', line 10

def preset_name
  @preset_name
end

#redObject (readonly)

Returns the value of attribute red.



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

def red
  @red
end

#tintObject (readonly)

Returns the value of attribute tint.



10
11
12
# File 'lib/psd/layer/info/black_white.rb', line 10

def tint
  @tint
end

#tint_colorObject (readonly)

Returns the value of attribute tint_color.



10
11
12
# File 'lib/psd/layer/info/black_white.rb', line 10

def tint_color
  @tint_color
end

#yellowObject (readonly)

Returns the value of attribute yellow.



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

def yellow
  @yellow
end

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)


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

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

Instance Method Details

#parseObject



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

def parse
  @file.seek 4, IO::SEEK_CUR
  @data = Descriptor.new(@file).parse

  @red = @data['Rd  ']
  @yellow = @data['Yllw']
  @green = @data['Grn ']
  @cyan = @data['Cyn ']
  @blue = @data['Bl  ']
  @magenta = @data['Mgnt']
  @tint = @data['useTint']
  @tint_color = {
    red: @data['tintColor']['Rd  '],
    green: @data['tintColor']['Grn '],
    blue: @data['tintColor']['Bl  ']
  }

  @preset_id = @data['bwPresetKind']
  @preset_name = @data['blackAndWhitePresetFileName']
end