%! % Revised Scribble scribble1a.psl % ============================================================== % Copyright c 2019 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % Linking welcome. Reposting expressly forbidden. % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 1.1 % This is a revision of the scribble utilities of Laserwriter Secrets. % It includes a small Gonzo extract and makes use of the Webfriendly colors % The intent is to be both Google Drive and Distiller compatible % requires level 2 or higher PostScript for best results. %% ////// Extracted Gonzo Utilities ////// /random {rand 65536 div 32768 div mul cvi} def %% ////// end gonzo extractions ///// % ///////// (A) WEB FRIENDLY COLOR UTILITIES ///////////// % tintmat is a self-generating list of 216 triple color values /webtintmat [ 0 1 5 { /a exch store 0 1 5 { /b exch store 0 1 5 { 5 div b 5 div a 5 div }for } for } for ] def % setwebtint accepts a color number 0 to 215 and then % sets the PostScript color generator for later use... /setwebtint { abs cvi 216 cvi mod % restrict range webtintmat exch 3 mul 3 getinterval % get values from table aload pop setrgbcolor} def % and set them % The blocks are arranged as red to the right, green % up in order of increasing blue. % Some "pure color" sequences are % red: 0 1 2 3 4 5 % orange: 0 7 8 15 16 23 (sort of) % yellow: 0 7 14 21 28 35 % green: 0 6 12 18 24 30 % aqua: 0 42 84 126 168 210 % blue: 0 36 72 108 144 180 % magenta: 0 37 74 111 148 185 % purple 0 73 73 110 147 183 (sort of) % gray 0 43 86 129 172 215 %%%%%%%%% scribble code starts here %%%%%%%%%%%%% % A SCRIBBLE UTILITY TOOLKIT % /random is borrowed from the gonzo powertools. It returns a random integer % as in 6 random gives you a value from 0 to 5... /random {rand 65536 div 32768 div mul cvi} def % /scribblepat sets the exact pattern used, assuming you want it to be the same % for each and every copy. Changing scribblepat changes when and where the % wiggles appear. Use any integer... /scribblepat 12345 def % set fuzzy pattern scribblepat srand % place this line at the start of your FIRST % USE ONLY of the scribbling routines. % /scribbleres determines how long each straight line approximation to the fuzzy % line will be. Use 1 for one point increments or 4.16667 or 0.24 for single % pixels. The smaller the number and the longer the line, the longer your path. % This can cause problems on level 1... /scribbleres 1 def % length of shortest scribble % /ratticity determines how violently the fuzzy line deviates from the intended % path. It is expressed as a fraction of scribbleres. Use 0.2 for a fuzzy line, 5 % for a stock graph. Experiment... /ratticity 0.2 def % how erratic is the line to be? % /hominginstinct determines how motivated the ratty line will be towards % getting back on path. This is really a "high pass filter" or a "house take" that % prevents major deviations from piling up on a long term basis. % You can think of this as an "excess deviation tax" Normal range is 0 to 0.3 % (zero to thirty percent) with a value of 0.3 being "get back on track fast" % and 1.0 being "wander all you want". /hominginstinct 0.01 def % how fast does the line get back on track? % /scribblerlineto works just like rlineto, except that an erratic path is % generated... /scribblerlineto {currentpoint 2 copy translate /cury exch store /curx exch def 2 copy exch atan dup /curang exch store rotate dup mul exch dup mul add sqrt /fulllength exch store fulllength scribbleres div ceiling cvi /numsegs exch def fulllength numsegs div /incr1 exch store /deltay 0 store numsegs {incr1 101 random 50 sub dup 0 eq {pop 0.00001}if 50 div scribbleres ratticity mul mul currentpoint exch pop hominginstinct mul neg add rlineto} repeat curang neg rotate curx neg cury neg translate} def % /scribblecurveres uses setflat and flattenpath to approximate the curve as % line segments. Allowable values in pixels are 0.2 to 100. The larger the value, % the greater the deviation from the curve, but the faster the execution time... /scribblecurveres 5 def % allowable curveto path deviation % /scribblecurveto works just like curveto, except that an erratic path % is generated that more or less follows the curve... /scribblecurveto {gsave currentpoint newpath moveto scribblecurveres setflat curveto flattenpath mark { }{ }{ }{ } pathforall] /cpath exch store grestore 0 1 cpath length 2 sub 2 div 1 sub cvi {2 mul /posn exch def cpath posn get /cx0 exch store cpath posn 1 add get /cy0 exch store cpath posn 2 add get /cx1 exch store cpath posn 3 add get /cy1 exch store cx1 cx0 sub cy1 cy0 sub scribblerlineto} for} def % //// demo - remove or alter before reuse. /// % ///////////// (A) A PLAIN OLD "HAND DRAWN" LINE //////////// % This shows you how to draw a fuzzy line.... /hominginstinct 0.3 def % how fast does the line get back on track? /scribbleres 1 def % length of shortest scribble /ratticity 1 def % how erratic is the line 196 setwebtint % purple 100 200 moveto % set initial position of line 200 0 scribblerlineto % and draw the fuzzy line stroke % complete the path % ///// (B) A FAKE STOCK MARKET PRICE HISTORY //// % This shows you how to draw an erratic graph .... 5 setwebtint % red /hominginstinct 0 def % how fast does the line get back on track? /scribbleres 1 def % length of shortest scribble /ratticity 6 def % how erratic is the line to be? 0 setlinewidth % set width of stroked line 100 300 moveto % set initial position of line 200 0 scribblerlineto % and draw the fuzzy line stroke % and complete the path % //// (C) A SLIGHTLY RATTY BORDER ///// % This shows you how to draw a slightly ratty border .... 180 setwebtint % dark blue /hominginstinct 0.3 def % how fast does the line get back on track? /scribbleres 1 def % length of shortest scribble /ratticity 0.8 def % how erratic is the line to be? 1 setlinecap % smooth line closures 1 setlinejoin % ditto 6 setlinewidth % set width of stroked line 150 350 moveto % set initial position of line 100 0 scribblerlineto % and draw the box bottom 0 133 scribblerlineto % right side -100 0 scribblerlineto % top 0 -133 scribblerlineto % left side closepath gsave 213 setwebtint fill grestore stroke % ////// (D) DRAWING A FILLED FUZZY CIRCLE ///// 18 setwebtint % green /hominginstinct 0.4 def % how fast does the line get back on track? /scribbleres 1 def % length of shortest scribble /ratticity 0.5 def % how erratic is the line to be? 4 setlinewidth % set width of stroked line 525 350 moveto % initial position 525 391.4 491.4 425 450 425 scribblecurveto % first quadrant 408.6 425 375 391.4 375 350 scribblecurveto % second quadrant 375 308.6 408.6 275 450 275 scribblecurveto % third quadrant 491.4 275 525 308.6 525 350 scribblecurveto % fourth quadrant gsave 105 setwebtint fill grestore stroke % outline and fill showpage % EOF