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
Info::BIG_LAYER_INFO_KEYS, Info::LAYER_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.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/psd/layer.rb', line 31 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.
28 29 30 |
# File 'lib/psd/layer.rb', line 28 def file @file end |
#group_layer ⇒ Object
Returns the value of attribute group_layer.
28 29 30 |
# File 'lib/psd/layer.rb', line 28 def group_layer @group_layer end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
27 28 29 |
# File 'lib/psd/layer.rb', line 27 def header @header end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
27 28 29 |
# File 'lib/psd/layer.rb', line 27 def id @id end |
#info_keys ⇒ Object (readonly)
Returns the value of attribute info_keys.
27 28 29 |
# File 'lib/psd/layer.rb', line 27 def info_keys @info_keys end |
#node ⇒ Object
Returns the value of attribute node.
28 29 30 |
# File 'lib/psd/layer.rb', line 28 def node @node end |
Instance Method Details
#[](val) ⇒ Object
We just delegate this to a normal method call.
70 71 72 |
# File 'lib/psd/layer.rb', line 70 def [](val) self.send(val) end |
#parse(index = nil) ⇒ Object
Parse the layer and all of it’s sub-sections.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/psd/layer.rb', line 48 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 |