Sha256: 0d627e81dc807c185a217c351cd61467f01a0d93ab36313885a087b420a83154

Contents?: true

Size: 750 Bytes

Versions: 18

Compression:

Stored size: 750 Bytes

Contents

require 'psd/resources/base'

class PSD
  class Resource
    module Section
      class Guides < Base
        resource_id 1032
        name :guides

        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

18 entries across 18 versions & 1 rubygems

Version Path
psd-3.9.0 lib/psd/resources/guides.rb
psd-3.8.0 lib/psd/resources/guides.rb
psd-3.7.0 lib/psd/resources/guides.rb
psd-3.6.0 lib/psd/resources/guides.rb
psd-3.5.0 lib/psd/resources/guides.rb
psd-3.4.0 lib/psd/resources/guides.rb
psd-3.3.3 lib/psd/resources/guides.rb
psd-3.3.2 lib/psd/resources/guides.rb
psd-3.3.1 lib/psd/resources/guides.rb
psd-3.2.4 lib/psd/resources/guides.rb
psd-3.2.3 lib/psd/resources/guides.rb
psd-3.2.2 lib/psd/resources/guides.rb
psd-3.2.1 lib/psd/resources/guides.rb
psd-3.2.0 lib/psd/resources/guides.rb
psd-3.1.5 lib/psd/resources/guides.rb
psd-3.1.4 lib/psd/resources/guides.rb
psd-3.1.3 lib/psd/resources/guides.rb
psd-3.1.2 lib/psd/resources/guides.rb