Sha256: 3b823df5a448fbb5694e93c3e891492720e28735fb18343f95760f81b5e75b43

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

class PSD
  module ImageMode
    module Greyscale
      private

      def combine_greyscale_channel
        if channels == 2
          (0...@num_pixels).step(pixel_step) do |i|
            alpha = @channel_data[i]
            grey = @channel_data[@channel_length + i]

            @pixel_data.push grey, grey, grey, alpha
          end
        else
          (0...@num_pixels).step(pixel_step) do |i|
            @pixel_data.push *([@channel_data[i]] * 3), 255
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
psd-1.1.1 lib/psd/image_modes/greyscale.rb
psd-1.1.0 lib/psd/image_modes/greyscale.rb