Sha256: 8b9337b8caa4e494f7e336f501f0b956e4ac15a30a12ca1d3a103647ca0bf0c5

Contents?: true

Size: 594 Bytes

Versions: 42

Compression:

Stored size: 594 Bytes

Contents

class PSD
  # Definition for a single Resource record.
  #
  # Most of the resources are options/preferences set by the user
  # or automatically by Photoshop.
  class Resource
    attr_reader :type, :id, :name, :size
    attr_accessor :data

    def initialize(file)
      @file = file
      @data = {}
      @type = nil
    end

    def parse
      @type = @file.read_string(4) # Always 8BIM
      @id = @file.read_short

      name_length = Util.pad2(@file.read(1).bytes.to_a[0] + 1) - 1
      @name = @file.read_string(name_length)

      @size = Util.pad2(@file.read_int)
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
psd-0.4.1 lib/psd/resource.rb
psd-0.4.0 lib/psd/resource.rb