|
| 14 Sep |
|
| 23 Apr |
|
| 2 Jul |
|
| 18 May |
|
| 27 Jan |
|
| 17 Jan |
|
| 17 Jan |
|
| 17 Jan |
|
| 17 Jan |
|
| 12 Oct |
|
RendererThe procedure labelled barcode is known as the renderer, which we now consider. Its purpose is to accept as input an instance of the dictionary-based data structure described in section 2.1 that represents a barcode in some arbitrary symbology and produce a visual rendering of this at the current point. The variables that we use in this procedure are confined to local scope by declaring the procedure as follows: /barcode {
We then immediately read the dictionary-based data structure which is passed as a single argument to this procedure by an encoder. From this we extract and initialise each entry including the space bar succession, bar height succession, bar base succession, human readable text and any encoder specific default options. Just as with the encoders, we read and tokenise the user supplied options allowing the default rendering options to be overridden. /args exch def % We are given some arguments We have extracted or derived all of the necessary information from the input, and now use the space bar succession, bar height succession and bar base succession in calculations that create a single array containing elements that give coordinates for each of the bars in the barcode. We start by creating a bars array that is half the length of the space bar succession. We build this by repeatedly adding array elements that contain the height, x-coordinate, y-coordinate and width of single bars. The height and y-coordinates are read from the bar height succession and the bar base succession, respectively, whilst the x-coordinate and the width are made from a calculation of the total indent, based on the space bar succession and a compensating factor that accounts for ink spread. % Create bar elements and put them into the bars array Now we perform the actual rendering in seperate phases. The graphics state is preserved accross calls by wrapping the actual rendering in a gsave/grestore pair in order to prevent unexpected interference with the user's environment. gsave We ensure that we are rendering the symbol from the "current point" by translating the coordinate system so that the current point temporarily becomes the origin. Also, since we know the total width of the symbol from the above processes we are able to horizonally scale the symbol so that it exactly to a user specified width, when supplied. currentpoint translate We plot the border and fill the background setting each componants color only when supplied. % Display the border and background We iterated over the bars array to display each bar, setting the color only when requested. % Display the bars for elements in the bars array We iterate over the txt array to render the text, setting its color when requested. % Display the text for elements in the text array The whitespace guard symbols are plotted where required. % Display the guard elements
|
|
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2008 Google |