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

Instance Method Details

#actual_layersObject

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

#foldersObject

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

#heightObject

Height of the entire PSD document, in pixels.



11
12
13
# File 'lib/psd/helpers.rb', line 11

def height
  header.rows
end

#layersObject

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

#treeObject

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

#widthObject

Width of the entire PSD document, in pixels.



6
7
8
# File 'lib/psd/helpers.rb', line 6

def width
  header.cols
end