Sha256: 06b0925d6537d05b05606e97342384280674fe2d92189304fa4c9a3fb600df63

Contents?: true

Size: 856 Bytes

Versions: 5

Compression:

Stored size: 856 Bytes

Contents

require 'psd/layer_info'

class PSD
  class SelectiveColor < LayerInfo
    def self.should_parse?(key)
      key == 'selc'
    end

    attr_reader :correction_mode, :cyan_correction, :magenta_correction,
                :yellow_correction, :black_correction

    def parse
      @file.seek 2, IO::SEEK_CUR

      @correction_mode = @file.read_short == 0 ? :relative : :absolute
      @cyan_correction = []
      @magenta_correction = []
      @yellow_correction = []
      @black_correction = []

      10.times do |i|
        # First record is all 0 and is ignored by Photoshop
        @file.seek(8, IO::SEEK_CUR) and next if i == 0

        @cyan_correction    << @file.read_short
        @magenta_correction << @file.read_short
        @yellow_correction  << @file.read_short
        @black_correction   << @file.read_short
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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