Sha256: c7e67c43966cf3dcca5a8665cb7fde8ba57eecfd9c2773c711a84e0301e18624

Contents?: true

Size: 929 Bytes

Versions: 4

Compression:

Stored size: 929 Bytes

Contents

class PSD
  class Resource
    class Section
      class LayerComps < Section
        def self.id; 1065; end
        def self.name; :layer_comps; end

        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

4 entries across 4 versions & 2 rubygems

Version Path
bench9000-0.1 vendor/psd.rb/lib/psd/resources/layer_comps.rb
psd-2.1.2 lib/psd/resources/layer_comps.rb
psd-2.1.1 lib/psd/resources/layer_comps.rb
psd-2.1.0 lib/psd/resources/layer_comps.rb