w00t!

Ruby code posted by Сашка
created at 04 Feb 00:10, updated at 04 Feb 00:10

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Cairo::Context
  def block(row, col, blocksize=8)
    rectangle blocksize * col + blocksize, blocksize * row + blocksize, blocksize, blocksize
  end
end

class QRCairo
  def draw
    qrcontext.set_source_rgba white
    qrcontext.paint
    qrcode.size.times do |row|
      qrcode.size.times do |col|
        if qrcode.modules[row][col] then
          qrcontext.set_source_rgba black
          qrcontext.block(row, col)
          qrcontext.fill
        end
      end
    end


  end
end
512 Bytes in 3 ms with coderay