~ubuntu-branches/ubuntu/wily/libpostscriptbarcode/wily

« back to all changes in this revision

Viewing changes to src/renmaximatrix.ps

  • Committer: Package Import Robot
  • Author(s): Alexander List
  • Date: 2014-06-06 17:37:19 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140606173719-rvjku8todk2j353x
Tags: 20140312-2
* acknowledge package from maintainer
* debian/control: Use latest Standards-Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%!PS
 
2
 
 
3
% Barcode Writer in Pure PostScript
 
4
% http://www.terryburton.co.uk/barcodewriter/
 
5
%
 
6
% Copyright (c) 2004-2014 Terry Burton
 
7
%
 
8
% $Id$
 
9
%
 
10
% Permission is hereby granted, free of charge, to any
 
11
% person obtaining a copy of this software and associated
 
12
% documentation files (the "Software"), to deal in the
 
13
% Software without restriction, including without
 
14
% limitation the rights to use, copy, modify, merge,
 
15
% publish, distribute, sublicense, and/or sell copies of
 
16
% the Software, and to permit persons to whom the Software
 
17
% is furnished to do so, subject to the following
 
18
% conditions:
 
19
%
 
20
% The above copyright notice and this permission notice
 
21
% shall be included in all copies or substantial portions
 
22
% of the Software.
 
23
%
 
24
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
 
25
% KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 
26
% THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 
27
% PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 
28
% THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 
29
% DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 
30
% CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
31
% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 
32
% IN THE SOFTWARE.
 
33
 
 
34
% --BEGIN RENDERER renmaximatrix--
 
35
% --REQUIRES preamble raiseerror--
 
36
/setpacking where {pop currentpacking true setpacking} if
 
37
1 dict
 
38
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
 
39
begin
 
40
/renmaximatrix {
 
41
 
 
42
    20 dict begin
 
43
 
 
44
    /args exch def   % We are given some arguments
 
45
 
 
46
    % Default options
 
47
    /barcolor (unset) def
 
48
    /backgroundcolor (unset) def
 
49
 
 
50
    % Apply the renderer options and the user options
 
51
    args {def} forall
 
52
    opt {def} forall
 
53
 
 
54
    /barcolor barcolor cvlit def
 
55
    /backgroundcolor backgroundcolor cvlit def
 
56
 
 
57
    % Set RGB or CMYK color depending on length of given hex string
 
58
    /setanycolor {
 
59
        /anycolor exch def
 
60
        anycolor length 6 eq {
 
61
            (<      >) 8 string copy dup 1 anycolor putinterval cvx exec {255 div} forall setrgbcolor
 
62
        } if
 
63
        anycolor length 8 eq {
 
64
            (<        >) 10 string copy dup 1 anycolor putinterval cvx exec {255 div} forall setcmykcolor
 
65
        } if
 
66
    } bind def
 
67
 
 
68
    gsave
 
69
 
 
70
    currentpoint translate
 
71
 
 
72
    2.4945 dup scale  % from 1pt to 1.88mm
 
73
 
 
74
    0 0 moveto 30 0 lineto 30 29 lineto 0 29 lineto closepath
 
75
    backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if 
 
76
    barcolor (unset) ne { barcolor setanycolor } if
 
77
 
 
78
    0.5 0.5774 translate
 
79
 
 
80
    newpath
 
81
    pixs {
 
82
        dup 
 
83
        /x exch 30 mod def 
 
84
        /y exch 30 idiv def
 
85
        y 2 mod 0 eq {x} {x 0.5 add} ifelse
 
86
        32 y sub 0.8661 mul
 
87
        moveto
 
88
        0     0.5774 rmoveto
 
89
        -0.5 -0.2887 rlineto
 
90
        0    -0.5774 rlineto
 
91
        0.5  -0.2887 rlineto
 
92
        0.5   0.2887 rlineto
 
93
        0     0.5774 rlineto
 
94
        -0.5  0.2887 rlineto
 
95
        closepath
 
96
    } forall
 
97
    fill
 
98
 
 
99
    % Plot the locator symbol
 
100
    newpath 14 13.8576 0.5774 0 360 arc closepath
 
101
    14 13.8576 1.3359 360 0 arcn closepath fill
 
102
    newpath 14 13.8576 2.1058 0 360 arc closepath
 
103
    14 13.8576 2.8644 360 0 arcn closepath fill
 
104
    newpath 14 13.8576 3.6229 0 360 arc closepath
 
105
    14 13.8576 4.3814 360 0 arcn closepath fill
 
106
 
 
107
    grestore
 
108
 
 
109
    end
 
110
 
 
111
} bind def
 
112
/renmaximatrix dup load /uk.co.terryburton.bwipp defineresource pop
 
113
end
 
114
/setpacking where {pop setpacking} if
 
115
% --END RENDERER renmaximatrix--