barby-chunky_png 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/README +29 -0
  2. data/bin/barby +41 -0
  3. data/lib/barby/barcode/bookland.rb +37 -0
  4. data/lib/barby/barcode/code_128.rb +410 -0
  5. data/lib/barby/barcode/code_25.rb +193 -0
  6. data/lib/barby/barcode/code_25_iata.rb +23 -0
  7. data/lib/barby/barcode/code_25_interleaved.rb +73 -0
  8. data/lib/barby/barcode/code_39.rb +233 -0
  9. data/lib/barby/barcode/code_93.rb +230 -0
  10. data/lib/barby/barcode/data_matrix.rb +46 -0
  11. data/lib/barby/barcode/ean_13.rb +178 -0
  12. data/lib/barby/barcode/ean_8.rb +32 -0
  13. data/lib/barby/barcode/gs1_128.rb +42 -0
  14. data/lib/barby/barcode/pdf_417.rb +76 -0
  15. data/lib/barby/barcode/qr_code.rb +101 -0
  16. data/lib/barby/barcode.rb +116 -0
  17. data/lib/barby/outputter/ascii_outputter.rb +41 -0
  18. data/lib/barby/outputter/cairo_outputter.rb +185 -0
  19. data/lib/barby/outputter/pdfwriter_outputter.rb +83 -0
  20. data/lib/barby/outputter/png_outputter.rb +97 -0
  21. data/lib/barby/outputter/prawn_outputter.rb +99 -0
  22. data/lib/barby/outputter/rmagick_outputter.rb +126 -0
  23. data/lib/barby/outputter/svg_outputter.rb +225 -0
  24. data/lib/barby/outputter.rb +132 -0
  25. data/lib/barby/vendor.rb +3 -0
  26. data/lib/barby/version.rb +9 -0
  27. data/lib/barby.rb +17 -0
  28. data/vendor/Pdf417lib-java-0.91/lib/Pdf417lib.jar +0 -0
  29. data/vendor/Pdf417lib-java-0.91/lib/Pdf417lib.java +1471 -0
  30. data/vendor/rqrcode/CHANGELOG +29 -0
  31. data/vendor/rqrcode/COPYING +19 -0
  32. data/vendor/rqrcode/README +98 -0
  33. data/vendor/rqrcode/Rakefile +65 -0
  34. data/vendor/rqrcode/lib/rqrcode/core_ext/array/behavior.rb +9 -0
  35. data/vendor/rqrcode/lib/rqrcode/core_ext/array.rb +5 -0
  36. data/vendor/rqrcode/lib/rqrcode/core_ext/integer/bitwise.rb +11 -0
  37. data/vendor/rqrcode/lib/rqrcode/core_ext/integer.rb +5 -0
  38. data/vendor/rqrcode/lib/rqrcode/core_ext.rb +5 -0
  39. data/vendor/rqrcode/lib/rqrcode/qrcode/qr_8bit_byte.rb +37 -0
  40. data/vendor/rqrcode/lib/rqrcode/qrcode/qr_bit_buffer.rb +56 -0
  41. data/vendor/rqrcode/lib/rqrcode/qrcode/qr_code.rb +421 -0
  42. data/vendor/rqrcode/lib/rqrcode/qrcode/qr_math.rb +63 -0
  43. data/vendor/rqrcode/lib/rqrcode/qrcode/qr_polynomial.rb +78 -0
  44. data/vendor/rqrcode/lib/rqrcode/qrcode/qr_rs_block.rb +313 -0
  45. data/vendor/rqrcode/lib/rqrcode/qrcode/qr_util.rb +254 -0
  46. data/vendor/rqrcode/lib/rqrcode/qrcode.rb +4 -0
  47. data/vendor/rqrcode/lib/rqrcode.rb +13 -0
  48. data/vendor/rqrcode/test/runtest.rb +78 -0
  49. data/vendor/rqrcode/test/test_data.rb +21 -0
  50. metadata +129 -0
@@ -0,0 +1,29 @@
1
+ *0.3.2* (Mar 15th, 2009)
2
+
3
+ * Ruby 1.9 fixes by [Tore Darell http://tore.darell.no] [Chris Mowforth http://blog.99th.st]
4
+
5
+ *0.3.1* (Nov 24th, 2008)
6
+
7
+ * expanded RS block table to QRcode version 40 [Vladislav Gorodetskiy]
8
+
9
+ *0.3.0* (Feb 28th, 2008)
10
+
11
+ * added more documentation
12
+ * changed to_console to to_s (what was I thinking)
13
+ * add more tests
14
+
15
+ *0.2.1* (Feb 24th, 2008)
16
+
17
+ * small changes to rakefile and readme
18
+ * small change to to_console method
19
+ * make console_count method private (use modules.size instead)
20
+ * slowy updating rdocs
21
+
22
+ *0.2.0* (Feb 23rd, 2008)
23
+
24
+ * Split files up [DR]
25
+ * added rdoc comment ... more to do there
26
+
27
+ *0.1.0* (Feb 22rd, 2008)
28
+
29
+ * Initial Release [DR]
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2008 Duncan Robertson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
+
@@ -0,0 +1,98 @@
1
+ == rQRCode, Encode QRCodes
2
+
3
+ rQRCode is a library for encoding QR Codes in Ruby. It has a simple interface with all the standard qrcode options. It was adapted from the Javascript library by Kazuhiko Arase.
4
+
5
+ RubyForge Project Page http://rubyforge.org/projects/rqrcode/
6
+
7
+ == An Overview
8
+
9
+ Let's clear up some rQRCode stuff.
10
+
11
+ # rQRCode is a *standalone library*. It requires no other libraries. Just Ruby!
12
+ # It is an encoding library. You can't decode QR codes with it.
13
+ # The interface is simple and assumes you just want to encode a string into a QR code
14
+ # QR code is trademarked by Denso Wave inc
15
+
16
+ == Resources
17
+
18
+ wikipedia:: http://en.wikipedia.org/wiki/QR_Code
19
+ Denso-Wave website:: http://www.denso-wave.com/qrcode/index-e.html
20
+ kaywa:: http://qrcode.kaywa.com
21
+
22
+
23
+ == Installing
24
+
25
+ You may get the latest stable version from Rubyforge.
26
+
27
+ $ gem install rqrcode
28
+
29
+ You can also get the source from http://github.com/whomwah/rqrcode/tree/master
30
+
31
+ $ git clone git://github.com/whomwah/rqrcode.git
32
+
33
+
34
+ === Loading rQRCode Itself
35
+
36
+ You have installed the gem already, yeah?
37
+
38
+ require 'rubygems'
39
+ require 'rqrcode'
40
+
41
+ === Simple QRCode generation to screen
42
+
43
+ qr = RQRCode::QRCode.new( 'my string to generate', :size => 4, :level => :h )
44
+ puts qr.to_s
45
+ #
46
+ # Prints:
47
+ # xxxxxxx x x x x x xx xxxxxxx
48
+ # x x xxx xxxxxx xxx x x
49
+ # x xxx x xxxxx x xx x xxx x
50
+ # ... etc
51
+
52
+ === Simple QRCode generation to view (RubyOnRails)
53
+
54
+ <b>Controller:</b>
55
+ @qr = RQRCode::QRCode.new( 'my string to generate', :size => 4, :level => :h )
56
+
57
+ <b>View: (minimal styling added)</b>
58
+ <style type="text/css">
59
+ table {
60
+ border-width: 0;
61
+ border-style: none;
62
+ border-color: #0000ff;
63
+ border-collapse: collapse;
64
+ }
65
+ td {
66
+ border-width: 0;
67
+ border-style: none;
68
+ border-color: #0000ff;
69
+ border-collapse: collapse;
70
+ padding: 0;
71
+ margin: 0;
72
+ width: 10px;
73
+ height: 10px;
74
+ }
75
+ td.black { background-color: #000; }
76
+ td.white { background-color: #fff; }
77
+ </style>
78
+
79
+ <table>
80
+ <% @qr.modules.each_index do |x| %>
81
+ <tr>
82
+ <% @qr.modules.each_index do |y| %>
83
+ <% if @qr.is_dark(x,y) %>
84
+ <td class="black"/>
85
+ <% else %>
86
+ <td class="white"/>
87
+ <% end %>
88
+ <% end %>
89
+ </tr>
90
+ <% end %>
91
+ </table>
92
+
93
+ == Contact
94
+
95
+ Author:: Duncan Robertson
96
+ Email:: duncan@whomwah.com
97
+ Home Page:: http://whomwah.com
98
+ License:: MIT Licence (http://www.opensource.org/licenses/mit-license.html)
@@ -0,0 +1,65 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/gempackagetask'
5
+ require 'rake/rdoctask'
6
+ require 'rake/testtask'
7
+
8
+ NAME = "rqrcode"
9
+ VERS = "0.3.2"
10
+ CLEAN.include ['pkg', 'rdoc']
11
+
12
+ Gem::manage_gems
13
+
14
+ spec = Gem::Specification.new do |s|
15
+ s.name = NAME
16
+ s.version = VERS
17
+ s.author = "Duncan Robertson"
18
+ s.email = "duncan@whomwah.com"
19
+ s.homepage = "http://rqrcode.rubyforge.org"
20
+ s.platform = Gem::Platform::RUBY
21
+ s.summary = "A library to encode QR Codes"
22
+ s.rubyforge_project = NAME
23
+ s.description = <<EOF
24
+ rQRCode is a library for encoding QR Codes. The simple
25
+ interface allows you to create QR Code data structures
26
+ ready to be displayed in the way you choose.
27
+ EOF
28
+ s.files = FileList["lib/**/*", "test/*"].exclude("rdoc").to_a
29
+ s.require_path = "lib"
30
+ s.has_rdoc = true
31
+ s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
32
+ s.test_file = "test/runtest.rb"
33
+ end
34
+
35
+ task :build_package => [:repackage]
36
+ Rake::GemPackageTask.new(spec) do |pkg|
37
+ #pkg.need_zip = true
38
+ #pkg.need_tar = true
39
+ pkg.gem_spec = spec
40
+ end
41
+
42
+ desc "Default: run unit tests."
43
+ task :default => :test
44
+
45
+ desc "Run all the tests"
46
+ Rake::TestTask.new(:test) do |t|
47
+ t.libs << "lib"
48
+ t.pattern = "test/runtest.rb"
49
+ t.verbose = true
50
+ end
51
+
52
+ desc "Generate documentation for the library"
53
+ Rake::RDocTask.new("rdoc") { |rdoc|
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "rQRCode Documentation"
56
+ rdoc.template = "~/bin/jamis.rb"
57
+ rdoc.options << '--line-numbers' << '--inline-source'
58
+ rdoc.main = "README"
59
+ rdoc.rdoc_files.include("README", "CHANGELOG", "COPYING", 'lib/**/*.rb')
60
+ }
61
+
62
+ desc "rdoc to rubyforge"
63
+ task :rubyforge => [:rdoc] do
64
+ sh %{/usr/bin/scp -r -p rdoc/* rubyforge:/var/www/gforge-projects/rqrcode}
65
+ end
@@ -0,0 +1,9 @@
1
+ module CoreExtensions #:nodoc:
2
+ module Array #:nodoc:
3
+ module Behavior
4
+ def extract_options!
5
+ last.is_a?(::Hash) ? pop : {}
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ require 'rqrcode/core_ext/array/behavior'
2
+
3
+ class Array #:nodoc:
4
+ include CoreExtensions::Array::Behavior
5
+ end
@@ -0,0 +1,11 @@
1
+ module CoreExtensions #:nodoc:
2
+ module Integer #:nodoc:
3
+ module Bitwise
4
+ def rszf(count)
5
+ # zero fill right shift
6
+ (self >> count) & ((2 ** ((self.size * 8) - count))-1)
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,5 @@
1
+ require 'rqrcode/core_ext/integer/bitwise'
2
+
3
+ class Integer #:nodoc:
4
+ include CoreExtensions::Integer::Bitwise
5
+ end
@@ -0,0 +1,5 @@
1
+ Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].sort.each do |path|
2
+ filename = File.basename(path)
3
+ require "rqrcode/core_ext/#{filename}"
4
+ end
5
+
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #--
4
+ # Copyright 2004 by Duncan Robertson (duncan@whomwah.com).
5
+ # All rights reserved.
6
+
7
+ # Permission is granted for use, copying, modification, distribution,
8
+ # and distribution of modified versions of this work as long as the
9
+ # above copyright notice is included.
10
+ #++
11
+
12
+ module RQRCode
13
+
14
+ class QR8bitByte
15
+ attr_reader :mode
16
+
17
+ def initialize( data )
18
+ @mode = QRMODE[:mode_8bit_byte]
19
+ @data = data;
20
+ end
21
+
22
+
23
+ def get_length
24
+ @data.size
25
+ end
26
+
27
+
28
+ def write( buffer )
29
+ ( 0...@data.size ).each do |i|
30
+ c = @data[i]
31
+ c = c.ord if c.respond_to?(:ord)#String#[] returns single-char string in 1.9, .ord gets ASCII pos
32
+ buffer.put( c, 8 )
33
+ end
34
+ end
35
+ end
36
+
37
+ end
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #--
4
+ # Copyright 2004 by Duncan Robertson (duncan@whomwah.com).
5
+ # All rights reserved.
6
+
7
+ # Permission is granted for use, copying, modification, distribution,
8
+ # and distribution of modified versions of this work as long as the
9
+ # above copyright notice is included.
10
+ #++
11
+
12
+ module RQRCode
13
+
14
+ class QRBitBuffer
15
+ attr_reader :buffer
16
+
17
+ def initialize
18
+ @buffer = []
19
+ @length = 0
20
+ end
21
+
22
+
23
+ def get( index )
24
+ buf_index = (index / 8).floor
25
+ (( (@buffer[buf_index]).rszf(7 - index % 8)) & 1) == 1
26
+ end
27
+
28
+
29
+ def put( num, length )
30
+ ( 0...length ).each do |i|
31
+ put_bit((((num).rszf(length - i - 1)) & 1) == 1)
32
+ end
33
+ end
34
+
35
+
36
+ def get_length_in_bits
37
+ @length
38
+ end
39
+
40
+
41
+ def put_bit( bit )
42
+ buf_index = ( @length / 8 ).floor
43
+ if @buffer.size <= buf_index
44
+ @buffer << 0
45
+ end
46
+
47
+ if bit
48
+ @buffer[buf_index] |= ((0x80).rszf(@length % 8))
49
+ end
50
+
51
+ @length += 1
52
+ end
53
+
54
+ end
55
+
56
+ end