|
| 1 | +% Barcode Writer in Pure PostScript |
| 2 | +% https://bwipp.terryburton.co.uk |
| 3 | +% |
| 4 | +% Copyright (c) 2004-2026 Terry Burton |
| 5 | + |
| 6 | +% vim: set ts=4 sw=4 et : |
| 7 | + |
| 8 | +/setanycolor dup /uk.co.terryburton.bwipp findresource cvx def |
| 9 | + |
| 10 | +/ok_tmpl { |
| 11 | + { 0 setanycolor } dup 3 -1 roll 0 exch put |
| 12 | + stopped { stop } if |
| 13 | +} def |
| 14 | + |
| 15 | +% |
| 16 | +% RGB (6 hex chars) |
| 17 | +% |
| 18 | +(000000) ok_tmpl |
| 19 | +(FFFFFF) ok_tmpl |
| 20 | +(FF0000) ok_tmpl |
| 21 | +(00FF00) ok_tmpl |
| 22 | +(0000FF) ok_tmpl |
| 23 | +(ff00ff) ok_tmpl |
| 24 | +(Ab12Cd) ok_tmpl |
| 25 | + |
| 26 | +{ (GG0000) setanycolor } /bwipp.colorBadCharacter isError |
| 27 | +{ (00GG00) setanycolor } /bwipp.colorBadCharacter isError |
| 28 | +{ (0000GG) setanycolor } /bwipp.colorBadCharacter isError |
| 29 | +{ (GGGGGG) setanycolor } /bwipp.colorBadCharacter isError |
| 30 | + |
| 31 | + |
| 32 | +% |
| 33 | +% CMYK (8 hex chars) |
| 34 | +% |
| 35 | +(00000000) ok_tmpl |
| 36 | +(FF000000) ok_tmpl |
| 37 | +(00FF0000) ok_tmpl |
| 38 | +(0000FF00) ok_tmpl |
| 39 | +(000000FF) ok_tmpl |
| 40 | + |
| 41 | +{ (GG000000) setanycolor } /bwipp.colorBadCharacter isError |
| 42 | +{ (00GG0000) setanycolor } /bwipp.colorBadCharacter isError |
| 43 | +{ (0000GG00) setanycolor } /bwipp.colorBadCharacter isError |
| 44 | +{ (000000GG) setanycolor } /bwipp.colorBadCharacter isError |
| 45 | +{ (GGGGGGGG) setanycolor } /bwipp.colorBadCharacter isError |
| 46 | + |
| 47 | + |
| 48 | +% |
| 49 | +% Named colors |
| 50 | +% |
| 51 | +/uk.co.terryburton.bwipp.global_ctx << |
| 52 | + /named_colors << |
| 53 | + (_testrgb) [ /DeviceRGB 1 0 0 ] |
| 54 | + (_testcmyk) [ /DeviceCMYK 0 1 0 0 ] |
| 55 | + (_testsep) [ |
| 56 | + [ /Separation (Test Separation) /DeviceCMYK { dup 0.49 mul exch dup 0 mul exch dup 0.03 mul exch 0 mul } ] 1.0 |
| 57 | + ] |
| 58 | + >> |
| 59 | +>> def |
| 60 | + |
| 61 | +(_testrgb) ok_tmpl |
| 62 | +(_testcmyk) ok_tmpl |
| 63 | +(_testsep) ok_tmpl |
| 64 | + |
| 65 | +{ (_undefined) setanycolor } /bwipp.colorUnknown isError |
| 66 | + |
| 67 | + |
| 68 | +% |
| 69 | +% Invalid inputs |
| 70 | +% |
| 71 | +{ () setanycolor } /bwipp.colorEnpty isError |
| 72 | +{ (F) setanycolor } /bwipp.colorBadLength isError |
| 73 | +{ (FF) setanycolor } /bwipp.colorBadLength isError |
| 74 | +{ (FFF) setanycolor } /bwipp.colorBadLength isError |
| 75 | +{ (FFFF) setanycolor } /bwipp.colorBadLength isError |
| 76 | +{ (FFFFF) setanycolor } /bwipp.colorBadLength isError |
| 77 | +{ (FFFFFFF) setanycolor } /bwipp.colorBadLength isError |
| 78 | +{ (FFFFFFFFF) setanycolor } /bwipp.colorBadLength isError |
| 79 | +{ (FFFFFFFFFF) setanycolor } /bwipp.colorBadLength isError |
| 80 | + |
0 commit comments