T
Tore Darell
Barby 0.2.0 has been released.
http://tore.darell.no/posts/barby_0_2
http://barby.rubyforge.org/
Below is a copy of the announcement from my blog.
Barby 0.2 has support for two-dimensional barcodes, and all existing
outputters have been updated to work with 2D. The first supported 2D
symbology is "QR Code":http://en.wikipedia.org/wiki/QR_Code which is
quite popular for mobile phone implementations and big in Japan. It
uses the excellent "RQRCode":http://rqrcode.rubyforge.org/ library by
"Duncan Robertson":http://whomwah.com/2008/02/24/rqrcode-a-ruby-
library-for-encoding-qr-codes.
require 'barby'
require 'barby/outputter/png_outputter'
qrcode = Barby::QrCode.new('2D power')
File.open('qrcode.png', 'w') do |f|
f << qrcode.to_png
end
To update or install:
sudo gem install barby
The implementation of 2D support is pretty simple: 2D barcodes are
considered to be 1D barcodes on top of each other. So if you're
writing a class for a 2D symbology, the difference is that your
@encoding@ method must return an array of strings instead if a single
string:
class My2DBarcode < Barby::Barcode2D
def endoding
['010011', '011001', '110001']
end
end
If you're writing an outputter that is capable of handling 2D
barcodes, you just have to keep this in mind. You can use the
@two_dimensional?@ method to check if a barcode is 2D:
class MyOutputter < Barby::Outputter
def to_something
if barcode.two_dimensional?
encoding.inject(""){|s,line| s + do_something_with(line) }
else
do_something_with(encoding)
end
end
end
http://tore.darell.no/posts/barby_0_2
http://barby.rubyforge.org/
Below is a copy of the announcement from my blog.
Barby 0.2 has support for two-dimensional barcodes, and all existing
outputters have been updated to work with 2D. The first supported 2D
symbology is "QR Code":http://en.wikipedia.org/wiki/QR_Code which is
quite popular for mobile phone implementations and big in Japan. It
uses the excellent "RQRCode":http://rqrcode.rubyforge.org/ library by
"Duncan Robertson":http://whomwah.com/2008/02/24/rqrcode-a-ruby-
library-for-encoding-qr-codes.
require 'barby'
require 'barby/outputter/png_outputter'
qrcode = Barby::QrCode.new('2D power')
File.open('qrcode.png', 'w') do |f|
f << qrcode.to_png
end
To update or install:
sudo gem install barby
The implementation of 2D support is pretty simple: 2D barcodes are
considered to be 1D barcodes on top of each other. So if you're
writing a class for a 2D symbology, the difference is that your
@encoding@ method must return an array of strings instead if a single
string:
class My2DBarcode < Barby::Barcode2D
def endoding
['010011', '011001', '110001']
end
end
If you're writing an outputter that is capable of handling 2D
barcodes, you just have to keep this in mind. You can use the
@two_dimensional?@ method to check if a barcode is 2D:
class MyOutputter < Barby::Outputter
def to_something
if barcode.two_dimensional?
encoding.inject(""){|s,line| s + do_something_with(line) }
else
do_something_with(encoding)
end
end
end