Sha256: 12e114bceea8eef95f43c9494e36f82e4130e9ef6fcafd6f5ef06f802c7254b0

Contents?: true

Size: 743 Bytes

Versions: 5

Compression:

Stored size: 743 Bytes

Contents

class PSD
  class Resource
    class Section
      class Guides < Section
        def self.id; 1032; end
        def self.name; :guides; end

        def parse
          # Descriptor version
          @file.seek 4, IO::SEEK_CUR

          # Future implementation of document-specific grids
          @file.seek 8, IO::SEEK_CUR

          num_guides = @file.read_int

          @data = []

          num_guides.times do
            location = @file.read_int / 32
            direction = @file.read_byte == 0 ? "vertical" : "horizontal"

            @data.push({ :location => location, :direction => direction })
          end

          @resource.data = self
        end

        def to_a
          @data
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
bench9000-0.1 vendor/psd.rb/lib/psd/resources/guides.rb
psd-2.1.2 lib/psd/resources/guides.rb
psd-2.1.1 lib/psd/resources/guides.rb
psd-2.1.0 lib/psd/resources/guides.rb
psd-2.0.0 lib/psd/resources/guides.rb