Class: PSD::LayerSectionDivider
- Defined in:
- lib/psd/layer/info/layer_section_divider.rb
Constant Summary collapse
- SECTION_DIVIDER_TYPES =
[ "other", "open folder", "closed folder", "bounding section divider" ]
Instance Attribute Summary collapse
-
#blend_mode ⇒ Object
readonly
Returns the value of attribute blend_mode.
-
#is_folder ⇒ Object
readonly
Returns the value of attribute is_folder.
-
#is_hidden ⇒ Object
readonly
Returns the value of attribute is_hidden.
-
#layer_type ⇒ Object
readonly
Returns the value of attribute layer_type.
-
#sub_type ⇒ Object
readonly
Returns the value of attribute sub_type.
Attributes inherited from LayerInfo
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file, length) ⇒ LayerSectionDivider
constructor
A new instance of LayerSectionDivider.
- #parse ⇒ Object
Methods inherited from LayerInfo
Constructor Details
#initialize(file, length) ⇒ LayerSectionDivider
Returns a new instance of LayerSectionDivider.
18 19 20 21 22 23 24 25 |
# File 'lib/psd/layer/info/layer_section_divider.rb', line 18 def initialize(file, length) super @is_folder = false @is_hidden = false @blend_mode = nil @sub_type = nil end |
Instance Attribute Details
#blend_mode ⇒ Object (readonly)
Returns the value of attribute blend_mode.
9 10 11 |
# File 'lib/psd/layer/info/layer_section_divider.rb', line 9 def blend_mode @blend_mode end |
#is_folder ⇒ Object (readonly)
Returns the value of attribute is_folder.
9 10 11 |
# File 'lib/psd/layer/info/layer_section_divider.rb', line 9 def is_folder @is_folder end |
#is_hidden ⇒ Object (readonly)
Returns the value of attribute is_hidden.
9 10 11 |
# File 'lib/psd/layer/info/layer_section_divider.rb', line 9 def is_hidden @is_hidden end |
#layer_type ⇒ Object (readonly)
Returns the value of attribute layer_type.
9 10 11 |
# File 'lib/psd/layer/info/layer_section_divider.rb', line 9 def layer_type @layer_type end |
#sub_type ⇒ Object (readonly)
Returns the value of attribute sub_type.
9 10 11 |
# File 'lib/psd/layer/info/layer_section_divider.rb', line 9 def sub_type @sub_type end |
Class Method Details
.should_parse?(key) ⇒ Boolean
5 6 7 |
# File 'lib/psd/layer/info/layer_section_divider.rb', line 5 def self.should_parse?(key) key == 'lsct' end |
Instance Method Details
#parse ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/psd/layer/info/layer_section_divider.rb', line 27 def parse code = @file.read_int @layer_type = SECTION_DIVIDER_TYPES[code] case code when 1, 2 then @is_folder = true when 3 then @is_hidden = true end PSD.logger.warn "Section divider is unexpected value: #{code}" if code > 4 return self unless @length >= 12 @file.seek 4, IO::SEEK_CUR # sig @blend_mode = @file.read_string(4) return self unless @length >= 16 @sub_type = @file.read_int == 0 ? 'normal' : 'scene group' return self end |