Sha256: dc0be291b1e0844e0b5fef8994b8637d84f30b7d75ebcd1ec54003574c3e9ede

Contents?: true

Size: 936 Bytes

Versions: 18

Compression:

Stored size: 936 Bytes

Contents

require 'psd/resources/base'

class PSD
  class Resource
    module Section
      class LayerComps < Base
        resource_id 1065
        name :layer_comps

        def self.visibility_captured?(comp)
          comp[:captured_info] & 0b001 > 0
        end

        def self.position_captured?(comp)
          comp[:captured_info] & 0b010 > 0
        end

        def self.appearance_captured?(comp)
          comp[:captured_info] & 0b100 > 0
        end

        def parse
          # Descriptor version
          @file.seek 4, IO::SEEK_CUR
          
          @data = Descriptor.new(@file).parse
          @resource.data = self
        end

        def names
          @data['list'].map { |c| c['Nm  '] }
        end

        def [](val)
          @data[val]
        end

        def to_a
          @data['list'].map { |c| {id: c['compID'], name: c['Nm  '], captured_info: c['capturedInfo']} }
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
psd-3.9.0 lib/psd/resources/layer_comps.rb
psd-3.8.0 lib/psd/resources/layer_comps.rb
psd-3.7.0 lib/psd/resources/layer_comps.rb
psd-3.6.0 lib/psd/resources/layer_comps.rb
psd-3.5.0 lib/psd/resources/layer_comps.rb
psd-3.4.0 lib/psd/resources/layer_comps.rb
psd-3.3.3 lib/psd/resources/layer_comps.rb
psd-3.3.2 lib/psd/resources/layer_comps.rb
psd-3.3.1 lib/psd/resources/layer_comps.rb
psd-3.2.4 lib/psd/resources/layer_comps.rb
psd-3.2.3 lib/psd/resources/layer_comps.rb
psd-3.2.2 lib/psd/resources/layer_comps.rb
psd-3.2.1 lib/psd/resources/layer_comps.rb
psd-3.2.0 lib/psd/resources/layer_comps.rb
psd-3.1.5 lib/psd/resources/layer_comps.rb
psd-3.1.4 lib/psd/resources/layer_comps.rb
psd-3.1.3 lib/psd/resources/layer_comps.rb
psd-3.1.2 lib/psd/resources/layer_comps.rb