Class: PSD::EffectsLayer

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

Overview

The file specification is majorly fucked for this info block. Had to make lots of tweaks.

Constant Summary collapse

BEVEL_STYLES =
[
  'Outer Bevel',
  'Inner Bevel',
  'Emboss',
  'Pillow Emboss',
  'Stroke Emboss'
].freeze

Instance Attribute Summary

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

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/psd/layer/info/effects_layer.rb', line 7

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

Instance Method Details

#parseObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/psd/layer/info/effects_layer.rb', line 19

def parse
  version = @file.read_short
  effects_count = @file.read_short

  @data = {}
  effects_count.times do
    sig = @file.read_string(4)
    if sig != "8BIM"
      PSD.logger.debug "Effect layer signature was not 8BIM, got #{sig}. Skipping."
      return false
    end

    key = @file.read_string(4)
    case key
    when 'cmnS' then common_state
    when 'dsdw' then shadow(:drop_shadow)
    when 'isdw' then shadow(:inner_shadow)
    when 'oglw' then outer_glow
    when 'iglw' then inner_glow
    when 'bevl' then bevel
    when 'sofi' then solid_fill
    end
  end
end