Module: PSD::Helpers
- Included in:
- PSD
- Defined in:
- lib/psd/helpers.rb
Overview
Various helper methods that make accessing PSD data easier since it’s split up among various sections.
Instance Method Summary collapse
-
#actual_layers ⇒ Object
All of the layers, but filters out the section dividers.
-
#folders ⇒ Object
All of the folders in the document.
-
#height ⇒ Object
Height of the entire PSD document, in pixels.
-
#layers ⇒ Object
All of the layers in this document, including section divider layers.
-
#tree ⇒ Object
Constructs a tree of the current document for easy traversal and data access.
-
#width ⇒ Object
Width of the entire PSD document, in pixels.
Instance Method Details
#actual_layers ⇒ Object
All of the layers, but filters out the section dividers.
21 22 23 |
# File 'lib/psd/helpers.rb', line 21 def actual_layers layers.delete_if { |l| l.folder? || l.folder_end? } end |
#folders ⇒ Object
All of the folders in the document.
26 27 28 |
# File 'lib/psd/helpers.rb', line 26 def folders layers.select { |l| l.folder? } end |
#height ⇒ Object
Height of the entire PSD document, in pixels.
11 12 13 |
# File 'lib/psd/helpers.rb', line 11 def height header.rows end |
#layers ⇒ Object
All of the layers in this document, including section divider layers.
16 17 18 |
# File 'lib/psd/helpers.rb', line 16 def layers layer_mask.layers end |
#tree ⇒ Object
Constructs a tree of the current document for easy traversal and data access.
31 32 33 |
# File 'lib/psd/helpers.rb', line 31 def tree @root ||= PSD::Node::Root.new(self) end |
#width ⇒ Object
Width of the entire PSD document, in pixels.
6 7 8 |
# File 'lib/psd/helpers.rb', line 6 def width header.cols end |