Skip to content

Commit

Permalink
Documented helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
meltingice committed Jul 26, 2013
1 parent 200cc44 commit bb6e2dd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/psd/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
class PSD
# Various helper methods that make accessing PSD data easier since it's
# split up among various sections.
module Helpers
# Width of the entire PSD document, in pixels.
def width
header.cols
end

# Height of the entire PSD document, in pixels.
def height
header.rows
end

# All of the layers in this document, including section divider layers.
def layers
layer_mask.layers
end

# All of the layers, but filters out the section dividers.
def actual_layers
layers.delete_if { |l| l.folder? || l.folder_end? }
end

# All of the folders in the document.
def folders
layers.select { |l| l.folder? }
end

# constructs a tree of the current document
# Constructs a tree of the current document for easy traversal and data access.
def tree
@root ||= PSD::Node::Root.new(self)
end
Expand Down

0 comments on commit bb6e2dd

Please sign in to comment.