chengse66 / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

[Feature Request] Allow non-closed paths #243

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I want to be able to draw free-form lines where the end of the line is not 
connected to the beginning of the line. I found there was a simple fix to 
allow this, a minor change to the PDF.end() method. I added a parameter, 
with a default value that mimics the old behavior, so people upgrading to 
use the new API will not need to change anything, but can use it if they 
want.

diff --git a/AlivePDF/AlivePDFBeta/src/org/alivepdf/pdf/PDF.as 
b/AlivePDF/AlivePDFBeta/src/org/alivepdf/pdf/PDF.as
index 9e48e04..75ee939 100755
--- a/AlivePDF/AlivePDFBeta/src/org/alivepdf/pdf/PDF.as
+++ b/AlivePDF/AlivePDFBeta/src/org/alivepdf/pdf/PDF.as
@@ -1299,10 +1299,14 @@ package org.alivepdf.pdf
         * </pre>
         * </div>
         */
-       public function end ():void
+       public function end (closePath:Boolean=true):void
        {
-           if ( !filled )
-               write ("s");
+           if ( !filled ) {
+               if(closePath)
+                   write("s");
+               else
+                   write("S");
+           }
            else if ( !stroking )
                write (windingRule == WindingRule.NON_ZERO 
? "f" : "f*");
            else write (windingRule == WindingRule.NON_ZERO ? 
"b" : "b*");

Original issue reported on code.google.com by dro...@gmail.com on 12 May 2010 at 1:43

GoogleCodeExporter commented 8 years ago
Hi drorex,

Great addition, thank you :)

I will commit this right now.

best,

Thibault

Original comment by thibault.imbert on 25 May 2010 at 8:46