Method: PSD::Resource::Section::Guides#parse

Defined in:
lib/psd/resources/guides.rb

#parseObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/psd/resources/guides.rb', line 8

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