comparison vendor/plugins/rfpdf/lib/barcode/image.rb @ 441:cbce1fd3b1b7 redmine-1.2

Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author Chris Cannam
date Mon, 06 Jun 2011 14:24:13 +0100
parents
children
comparison
equal deleted inserted replaced
245:051f544170fe 441:cbce1fd3b1b7
1
2 #============================================================+
3 # File name : image.rb
4 # Begin : 2002-07-31
5 # Last Update : 2005-01-08
6 # Author : Karim Mribti [barcode@mribti.com]
7 # : Nicola Asuni [info@tecnick.com]
8 # Version : 0.0.8a 2001-04-01 (original code)
9 # License : GNU LGPL (Lesser General Public License) 2.1
10 # http://www.gnu.org/copyleft/lesser.txt
11 # Source Code : http://www.mribti.com/barcode/
12 #
13 # Description : Barcode Image Rendering.
14 #
15 # NOTE:
16 # This version contains changes by Nicola Asuni:
17 # - porting to Ruby
18 # - code style and formatting
19 # - automatic php documentation in PhpDocumentor Style
20 # (www.phpdoc.org)
21 # - minor bug fixing
22 #============================================================+
23
24 #
25 # Barcode Image Rendering.
26 # @author Karim Mribti, Nicola Asuni
27 # @name BarcodeObject
28 # @package com.tecnick.tcpdf
29 # @@version 0.0.8a 2001-04-01 (original code)
30 # @since 2001-03-25
31 # @license http://www.gnu.org/copyleft/lesser.html LGPL
32 #
33
34 #
35 #
36 #
37
38 require("../../shared/barcode/barcode.rb");
39 require("../../shared/barcode/i25object.rb");
40 require("../../shared/barcode/c39object.rb");
41 require("../../shared/barcode/c128aobject.rb");
42 require("../../shared/barcode/c128bobject.rb");
43 require("../../shared/barcode/c128cobject.rb");
44
45 if (!$_REQUEST['style'].nil?) $_REQUEST['style'] = BCD_DEFAULT_STYLE;
46 if (!$_REQUEST['width'].nil?) $_REQUEST['width'] = BCD_DEFAULT_WIDTH;
47 if (!$_REQUEST['height'].nil?) $_REQUEST['height'] = BCD_DEFAULT_HEIGHT;
48 if (!$_REQUEST['xres'].nil?) $_REQUEST['xres'] = BCD_DEFAULT_XRES;
49 if (!$_REQUEST['font'].nil?) $_REQUEST['font'] = BCD_DEFAULT_FONT;
50 if (!$_REQUEST['type'].nil?) $_REQUEST['type'] = "C39";
51 if (!$_REQUEST['code'].nil?) $_REQUEST['code'] = "";
52
53 switch ($_REQUEST['type'].upcase)
54 case "I25"
55 $obj = new I25Object($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
56 break;
57 end
58 case "C128A"
59 $obj = new C128AObject($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
60 break;
61 end
62 case "C128B"
63 $obj = new C128BObject($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
64 break;
65 end
66 case "C128C"
67 $obj = new C128CObject($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
68 break;
69 end
70 case "C39":
71 default
72 $obj = new C39Object($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
73 break;
74 end
75 }
76
77 if ($obj)
78 $obj->SetFont($_REQUEST['font']);
79 $obj->DrawObject($_REQUEST['xres']);
80 $obj->FlushObject();
81 $obj->DestroyObject();
82 unset($obj); # clean#
83 }
84
85 #============================================================+
86 # END OF FILE
87 #============================================================+