[gs-commits] rev 11659 - trunk/gs/Resource/Init

alexcher at ghostscript.com alexcher at ghostscript.com
Thu Aug 26 23:34:28 UTC 2010


Author: alexcher
Date: 2010-08-26 23:34:28 +0000 (Thu, 26 Aug 2010)
New Revision: 11659

Modified:
   trunk/gs/Resource/Init/pdf_draw.ps
Log:
Implement rendering of /Squiggly annotation without an appearance stream.
Bug 691572, customer 532.


Modified: trunk/gs/Resource/Init/pdf_draw.ps
===================================================================
--- trunk/gs/Resource/Init/pdf_draw.ps	2010-08-26 15:49:51 UTC (rev 11658)
+++ trunk/gs/Resource/Init/pdf_draw.ps	2010-08-26 23:34:28 UTC (rev 11659)
@@ -2201,6 +2201,52 @@
     } ifelse
   } bdef
 
+  /Squiggly {
+    dup /AP oknown {
+      //true
+    } {
+      dup annotsetcolor
+      dup calc_annot_scale scale
+
+      /QuadPoints knownoget {
+        aload length 8 idiv {
+          gsave
+          8 copy moveto lineto
+          4 2 roll lineto lineto closepath clip newpath
+          //quadpoints2basis exec
+          6 -2 roll translate    % adjust for x0 y0      % x1-x0 y1-y0 x2-x0 y2-y0
+          1 index 56 div 1 index 56 div translate        % zigzag box is 1/56 up
+          1 index 72 div 1 index 72 div translate        % the line in the box is 1/72 up
+          2 copy dup mul exch dup mul add sqrt           % x1-x0 y1-y0 x2-x0 y2-y0 |p2|
+          4 index dup mul 4 index dup mul add sqrt       % x1-x0 y1-y0 x2-x0 y2-y0 |p2| |p1|
+          dup 0 gt 2 index 0 gt and {                 
+            div                                          % x1-x0 y1-y0 x2-x0 y2-y0 |p2|/|p1|=p12 
+            dup 1 exch div 4 mul 1 add cvi exch 6 2 roll % cnt p12 x1-x0 y1-y0 x2-x0 y2-y0
+            4 2 roll                                     % cnt p12 x2-x0 y2-y0 x1-x0 y1-y0
+            4 index mul exch 4 index mul exch            % cnt p12 x2-x0 y2-y0 (x1-x0)*p12 (y1-y0)*p12
+            4 2 roll 0 0 6 array astore concat           % cnt p12
+            1 40 div 1 72 div scale                     
+            pop                                          % cnt
+            0 0 moveto
+            1 setlinecap
+            1 setlinejoin
+            1 setlinewidth
+            {
+              5 10 lineto
+              10 0 lineto
+              10 0 translate 
+            } repeat
+            stroke
+          } {
+            6 { pop } repeat
+          } ifelse
+          grestore
+        } repeat
+      } if
+      //false
+    } ifelse
+  } bdef
+
   /Text {
     dup /AP oknown {
       //true



More information about the gs-commits mailing list