Class: PSD::Layer
- Inherits:
-
Object
- Object
- PSD::Layer
- Includes:
- BlendModes, BlendingRanges, ChannelImage, Exporting, Helpers, Info, Mask, Name, PathComponents, PositionAndChannels
- Defined in:
- lib/psd/layer.rb,
lib/psd/layer/info.rb,
lib/psd/layer/mask.rb,
lib/psd/layer/name.rb,
lib/psd/layer/helpers.rb,
lib/psd/layer/exporting.rb,
lib/psd/layer/blend_modes.rb,
lib/psd/layer/channel_image.rb,
lib/psd/layer/blending_ranges.rb,
lib/psd/layer/path_components.rb,
lib/psd/layer/position_and_channels.rb
Overview
Represents a single layer and all of the data associated with that layer.
Defined Under Namespace
Modules: BlendModes, BlendingRanges, ChannelImage, Exporting, Helpers, Info, Mask, Name, PathComponents, PositionAndChannels
Constant Summary
Constants included from Info
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#group_layer ⇒ Object
Returns the value of attribute group_layer.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#info_keys ⇒ Object
readonly
Returns the value of attribute info_keys.
-
#node ⇒ Object
Returns the value of attribute node.
Attributes included from PositionAndChannels
#bottom, #channels, #channels_info, #cols, #left, #right, #rows, #top
Attributes included from Mask
Attributes included from Info
Attributes included from ChannelImage
Attributes included from BlendingRanges
Attributes included from BlendModes
Instance Method Summary collapse
-
#[](val) ⇒ Object
We just delegate this to a normal method call.
-
#initialize(file, header) ⇒ Layer
constructor
Initializes all of the defaults for the layer.
-
#parse(index = nil) ⇒ Object
Parse the layer and all of it’s sub-sections.
Methods included from Helpers
#all_locked?, #composite_locked?, #fill_opacity, #folder?, #folder_end?, #layer_type, #position_locked?, #raster_mask?, #text, #transparency_locked?, #vector_mask?
Methods included from PathComponents
#scale_path_components, #translate
Methods included from Name
Methods included from Exporting
Methods included from ChannelImage
Methods included from BlendModes
Constructor Details
#initialize(file, header) ⇒ Layer
Initializes all of the defaults for the layer.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/psd/layer.rb', line 20 def initialize(file, header) @file = file @header = header @mask = {} @blending_ranges = {} @adjustments = {} @channels_info = [] @blend_mode = {} @group_layer = nil # Just used for tracking which layer adjustments we're parsing. # Not essential. @info_keys = [] end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
17 18 19 |
# File 'lib/psd/layer.rb', line 17 def file @file end |
#group_layer ⇒ Object
Returns the value of attribute group_layer.
17 18 19 |
# File 'lib/psd/layer.rb', line 17 def group_layer @group_layer end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
16 17 18 |
# File 'lib/psd/layer.rb', line 16 def header @header end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
16 17 18 |
# File 'lib/psd/layer.rb', line 16 def id @id end |
#info_keys ⇒ Object (readonly)
Returns the value of attribute info_keys.
16 17 18 |
# File 'lib/psd/layer.rb', line 16 def info_keys @info_keys end |
#node ⇒ Object
Returns the value of attribute node.
17 18 19 |
# File 'lib/psd/layer.rb', line 17 def node @node end |
Instance Method Details
#[](val) ⇒ Object
We just delegate this to a normal method call.
59 60 61 |
# File 'lib/psd/layer.rb', line 59 def [](val) self.send(val) end |
#parse(index = nil) ⇒ Object
Parse the layer and all of it’s sub-sections.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/psd/layer.rb', line 37 def parse(index=nil) @id = index parse_position_and_channels parse_blend_modes extra_len = @file.read_int @layer_end = @file.tell + extra_len parse_mask_data parse_blending_ranges parse_legacy_layer_name parse_layer_info PSD.logger.debug "Layer name = #{name}" @file.seek @layer_end # Skip over any filler zeros return self end |