Sha256: 1763bf4aca6e85c6e2d7725b59aaab8285c816f5c9e05b4eeb0b73f0a0fb1ede

Contents?: true

Size: 861 Bytes

Versions: 13

Compression:

Stored size: 861 Bytes

Contents

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 for easy traversal and data access.
    def tree
      @root ||= PSD::Node::Root.new(self)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
psd-1.2.2 lib/psd/helpers.rb
psd-1.2.1 lib/psd/helpers.rb
psd-1.2.0 lib/psd/helpers.rb
psd-1.1.1 lib/psd/helpers.rb
psd-1.1.0 lib/psd/helpers.rb
psd-1.0.0 lib/psd/helpers.rb
psd-0.4.2 lib/psd/helpers.rb
psd-0.4.1 lib/psd/helpers.rb
psd-0.4.0 lib/psd/helpers.rb
psd-0.3.5 lib/psd/helpers.rb
psd-0.3.4 lib/psd/helpers.rb
psd-0.3.3 lib/psd/helpers.rb
psd-0.3.2 lib/psd/helpers.rb