Class: RQRCodePNG::Image
- Inherits:
-
Object
- Object
- RQRCodePNG::Image
- Defined in:
- lib/rqrcode_png/image.rb
Constant Summary collapse
- BLACK =
::ChunkyPNG::Color::BLACK
- WHITE =
::ChunkyPNG::Color::WHITE
- TRANSPARENT =
::ChunkyPNG::Color::TRANSPARENT
Instance Method Summary collapse
-
#initialize(qr_code) ⇒ Image
constructor
A new instance of Image.
-
#render(bg_color = WHITE) ⇒ Object
Returns an image file of the QR Code.
Constructor Details
Instance Method Details
#render(bg_color = WHITE) ⇒ Object
Returns an image file of the QR Code
12 13 14 15 16 17 18 |
# File 'lib/rqrcode_png/image.rb', line 12 def render bg_color = WHITE png = blank_img(bg_color) @sequence.dark_squares_only do |x, y| png[y + @sequence.border_width(), x + @sequence.border_width()] = BLACK end return png end |