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-3.9.0 lib/psd/resource.rb
psd-3.8.0 lib/psd/resource.rb
psd-3.7.0 lib/psd/resource.rb
psd-3.6.0 lib/psd/resource.rb
bench9000-0.1 vendor/psd.rb/lib/psd/resource.rb
psd-3.5.0 lib/psd/resource.rb
psd-3.4.0 lib/psd/resource.rb
psd-3.3.3 lib/psd/resource.rb
psd-3.3.2 lib/psd/resource.rb
psd-3.3.1 lib/psd/resource.rb
psd-3.2.4 lib/psd/resource.rb
psd-3.2.3 lib/psd/resource.rb
psd-3.2.2 lib/psd/resource.rb
psd-3.2.1 lib/psd/resource.rb
psd-3.2.0 lib/psd/resource.rb
psd-3.1.5 lib/psd/resource.rb
psd-3.1.4 lib/psd/resource.rb
psd-3.1.3 lib/psd/resource.rb
psd-3.1.2 lib/psd/resource.rb
psd-2.1.2 lib/psd/resource.rb