Sha256: b7a0d8a1a2c0c10d964797836a835f4b4edbf95f858740ca8232d90d7a4a6b9c

Contents?: true

Size: 804 Bytes

Versions: 4

Compression:

Stored size: 804 Bytes

Contents

require 'psd/layer_info'

class PSD
  class MetadataSetting < LayerInfo
    def self.should_parse?(key)
      key == 'shmd'
    end

    def parse
      count = @file.read_int

      count.times do
        @file.seek 4, IO::SEEK_CUR # signature, always 8BIM
        
        key = @file.read_string(4)
        copy_on_sheet_dup = @file.read(1).bytes.to_a[0]
        @file.seek 3, IO::SEEK_CUR # Padding

        len = @file.read_int
        data_end = @file.tell + len

        PSD.logger.debug "Layer metadata: key = #{key}, length = #{len}"

        parse_layer_comp_setting if key == 'cmls'

        @file.seek data_end
      end
    end

    private

    def parse_layer_comp_setting
      @file.seek 4, IO::SEEK_CUR # Version
      @data[:layer_comp] = Descriptor.new(@file).parse
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
psd-3.9.0 lib/psd/layer/info/metadata_setting.rb
psd-3.8.0 lib/psd/layer/info/metadata_setting.rb
psd-3.7.0 lib/psd/layer/info/metadata_setting.rb
psd-3.6.0 lib/psd/layer/info/metadata_setting.rb