class EncodeImage
  @@password = ""
  @@message  = ""

  @@img = nil

  @@utils = nil


  def initialize(p, m, uri)
    @@password = p
    @@message  = m

    @@utils = ImageUtils.new(@@password, @@message, uri)

    @@table = @@utils.generateLookupTable
  end

  def encode
    msg_bits = @@utils.getImage.getBits(@@message)
    msg_bits = msg_bits << 8 | 0
    msg_bits = msg_bits << 16 | @@message.length

    s = @@utils.getImage.getSize

    original_img = @@utils.getImage.fuzzImage

    @@table.each do |loc|
      pixel = @@utils.getImage.getPixel(loc[:x], loc[:y])
      msg_bits = pixel.encodeBits(msg_bits)
    end

    @@utils.getImage.saveImage
  end
end