Sha256: 544d2cf285b9cdeaaf5caa2ae1cb3d042fd77e0414f1bf29f940c08516eaa4c3

Contents?: true

Size: 562 Bytes

Versions: 4

Compression:

Stored size: 562 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 < BinData::Record
    endian  :big

    string  :type, read_length: 4
    uint16  :id
    uint8   :name_len
    stringz :name, read_length: :name_length
    uint32  :res_size

    skip    length: :resource_size

    #---
    # Really weird padding business
    def name_length
      Util.pad2(name_len + 1) - 1
    end

    def resource_size
      Util.pad2(res_size)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
psd-0.3.5 lib/psd/resource.rb
psd-0.3.4 lib/psd/resource.rb
psd-0.3.3 lib/psd/resource.rb
psd-0.3.2 lib/psd/resource.rb