]> git.donarmstrong.com Git - lilypond.git/commitdiff
Gets rid of bezier-sandwich stencil
authorMike Solomon <mike@apollinemike.com>
Mon, 6 Feb 2012 14:03:20 +0000 (15:03 +0100)
committerMike Solomon <mike@apollinemike.com>
Mon, 6 Feb 2012 14:03:20 +0000 (15:03 +0100)
lily/lookup.cc
ps/music-drawing-routines.ps
scm/define-stencil-commands.scm
scm/fret-diagrams.scm
scm/output-ps.scm
scm/output-socket.scm
scm/output-svg.scm
scm/stencil.scm

index 3f393e05ac058d3d0115e4934589543a1cc4b744..7b63b83111e4ccf9000710f087d526453c2d1176 100644 (file)
@@ -449,22 +449,32 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick,
 Stencil
 Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve, Real thickness)
 {
-  /*
-    Need the weird order b.o. the way PS want its arguments
-  */
-  SCM list = SCM_EOL;
-  list = scm_cons (ly_offset2scm (bottom_curve.control_[3]), list);
-  list = scm_cons (ly_offset2scm (bottom_curve.control_[0]), list);
-  list = scm_cons (ly_offset2scm (bottom_curve.control_[1]), list);
-  list = scm_cons (ly_offset2scm (bottom_curve.control_[2]), list);
-  list = scm_cons (ly_offset2scm (top_curve.control_[0]), list);
-  list = scm_cons (ly_offset2scm (top_curve.control_[3]), list);
-  list = scm_cons (ly_offset2scm (top_curve.control_[2]), list);
-  list = scm_cons (ly_offset2scm (top_curve.control_[1]), list);
-
-  SCM horizontal_bend = scm_list_n (ly_symbol2scm ("bezier-sandwich"),
-                                    ly_quote_scm (list),
+  SCM commands  = scm_list_n (ly_symbol2scm ("moveto"),
+                              scm_from_double (top_curve.control_[0][X_AXIS]),
+                              scm_from_double (top_curve.control_[0][Y_AXIS]),
+                              ly_symbol2scm ("curveto"),
+                              scm_from_double (top_curve.control_[1][X_AXIS]),
+                              scm_from_double (top_curve.control_[1][Y_AXIS]),
+                              scm_from_double (top_curve.control_[2][X_AXIS]),
+                              scm_from_double (top_curve.control_[2][Y_AXIS]),
+                              scm_from_double (top_curve.control_[3][X_AXIS]),
+                              scm_from_double (top_curve.control_[3][Y_AXIS]),
+                              ly_symbol2scm ("curveto"),
+                              scm_from_double (bottom_curve.control_[2][X_AXIS]),
+                              scm_from_double (bottom_curve.control_[2][Y_AXIS]),
+                              scm_from_double (bottom_curve.control_[1][X_AXIS]),
+                              scm_from_double (bottom_curve.control_[1][Y_AXIS]),
+                              scm_from_double (bottom_curve.control_[0][X_AXIS]),
+                              scm_from_double (bottom_curve.control_[0][Y_AXIS]),
+                              ly_symbol2scm ("closepath"),
+                              SCM_UNDEFINED);
+
+  SCM horizontal_bend = scm_list_n (ly_symbol2scm ("path"),
                                     scm_from_double (thickness),
+                                    ly_quote_scm (commands),
+                                    ly_quote_scm (ly_symbol2scm ("round")),
+                                    ly_quote_scm (ly_symbol2scm ("round")),
+                                    SCM_BOOL_T,
                                     SCM_UNDEFINED);
 
   Interval x_extent = top_curve.extent (X_AXIS);
index 9d2e4070b0b73974d6613a39d92ea08f1ef862c5..2d17d57ab9f0e2cc00dc0132c9f43c6fd8023139 100644 (file)
@@ -150,27 +150,6 @@ bind def
        closepath fill
 } bind def
 
-% this is for drawing slurs and barre-indicators.
-/draw_bezier_sandwich  % x5 y5 x6 y6 x7 y7
-                       % x4 y4
-                       % x1 y1 x2 y2 x3 y3
-                       % x0 y0
-                       % linewidth draw_bezier_sandwich
-{
-       gsave
-       currentpoint translate
-        % round ending and round beginning
-        1 setlinejoin 1 setlinecap
-       setlinewidth
-       moveto
-       curveto
-       lineto
-       curveto
-       closepath
-       stroke_and_fill
-       grestore
-} bind def
-
 /draw_circle % filled? radius thickness draw_circle
 {
        setlinewidth    % f? r
index 06177cb5126d1f5d16f6cc744a4bbfe34f92e6c8..c6b9c99b44f1e6b68c52856b2e78c71fb0a01060 100644 (file)
@@ -21,8 +21,7 @@
 (define-public (ly:all-stencil-commands)
   "Return the list of stencil commands that can be
 defined in the output modules (@file{output-*.scm})."
-  '(bezier-sandwich
-    blank
+  '(blank
     char
     circle
     dashed-line
index 46af7edb01ca5a7beb4ce9ae05867cfa182dace9..cd734b2ecf34616ac1e8aa4983fb78f531f1a031 100644 (file)
@@ -528,10 +528,9 @@ fret-diagram overall parameters."
                   (+ (* size end-string-coordinate) half-thickness)))
               (x-extent (cons (car box-lower-left) (car box-upper-right)))
               (y-extent (cons (cdr box-lower-left) (cdr box-upper-right))))
-         (ly:make-stencil
-           (list 'bezier-sandwich
-                 `(quote ,bezier-list)
-                 (* size bezier-thick))
+         (make-bezier-sandwich-stencil
+           bezier-list
+           (* size bezier-thick)
            x-extent
            y-extent)))
 
index 8c8e853567f4851cae95d8a3da82c798813562a6..aa3cce06ae56d9d2a9093e5e096bbf9bb4e0e564 100644 (file)
 ;;; Lily output interface, PostScript implementation --- cleanup and docme
 ;;;
 
-;; two beziers
-(define (bezier-sandwich lst thick)
-  (ly:format "~l ~4f draw_bezier_sandwich"
-            (map number-pair->string4 lst)
-         thick))
-
 (define (char font i)
   (ly:format "~a (\\~a) show"
    (ps-font-command font)
index 28e22f72a3c3ba3733d290b443e8b1a47d804a91..352ff2989dfbbed5ee8d02245d48d94972e322fd 100644 (file)
 ;;; stencil commands
 ;;;
 
-(define (bezier-sandwich lst thick)
-  (format #f "bezier_sandwich ~a [~a]"
-         thick
-         (string-append
-           (string-join (map
-                          (lambda (x)
-                            (format #f "(~a,~a)" (car x) (cdr x)))
-                          lst)
-                        ","))))
-
 (define (draw-line thick x1 y1 x2 y2)
   (format #f "drawline ~a ~a ~a ~a ~a"
          thick x1 y2 x2 y2))
index e3af710b1509a9debcec827ed48f2b4df8ef9028..eaff36294263541245257708998c036dca08fd9c 100644 (file)
 ;;; stencil outputters
 ;;;
 
-(define (bezier-sandwich lst thick)
-  (let* ((first (list-tail lst 4))
-        (second (list-head lst 4)))
-    (entity 'path ""
-           '(stroke-linejoin . "round")
-           '(stroke-linecap . "round")
-           '(stroke . "currentColor")
-           '(fill . "currentColor")
-           `(stroke-width . ,thick)
-           `(d . ,(string-append (svg-bezier first #f)
-                                 (svg-bezier second #t))))))
-
 (define (char font i)
   (dispatch
    `(fontify ,font ,(entity 'tspan (char->entity (integer->char i))))))
index 21d7bb86f9924f697df71b92e7d5cc3553ea53cc..0ecc9abe8ed4f4206f351b822d5973497b612013 100644 (file)
 ;;;; You should have received a copy of the GNU General Public License
 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
+(define (make-bezier-sandwich-stencil coords thick xext yext)
+  (let* ((command-list `(moveto
+                         ,(car (list-ref coords 3))
+                         ,(cdr (list-ref coords 3))
+                         curveto
+                         ,(car (list-ref coords 0))
+                         ,(cdr (list-ref coords 0))
+                         ,(car (list-ref coords 1))
+                         ,(cdr (list-ref coords 1))
+                         ,(car (list-ref coords 2))
+                         ,(cdr (list-ref coords 2))
+                         curveto
+                         ,(car (list-ref coords 4))
+                         ,(cdr (list-ref coords 4))
+                         ,(car (list-ref coords 5))
+                         ,(cdr (list-ref coords 5))
+                         ,(car (list-ref coords 6))
+                         ,(cdr (list-ref coords 6))
+                         closepath)))
+  (ly:make-stencil
+    `(path ,thick `(,@' ,command-list) 'round 'round #t)
+    xext
+    yext)))
+
 (define-public (stack-stencils axis dir padding stils)
   "Stack stencils @var{stils} in direction @var{axis}, @var{dir}, using
 @var{padding}."
@@ -128,26 +152,25 @@ the more angular the shape of the parenthesis."
         (lower-inner-control-point
          (cons inner-control-x lower-control-y)))
 
-    (ly:make-stencil
-     (list 'bezier-sandwich
-          `(quote ,(list
-                    ;; Step 4: curve through inner control points
-                    ;; to lower end point.
-                    upper-inner-control-point
-                    lower-inner-control-point
-                    lower-end-point
-                    ;; Step 3: move to upper end point.
-                    upper-end-point
-                    ;; Step 2: curve through outer control points
-                    ;; to upper end point.
-                    lower-outer-control-point
-                    upper-outer-control-point
-                    upper-end-point
-                    ;; Step 1: move to lower end point.
-                    lower-end-point))
-          line-width)
-     (interval-widen x-extent (/ line-width 2))
-     (interval-widen y-extent (/ line-width 2)))))
+    (make-bezier-sandwich-stencil
+      (list
+            ;; Step 4: curve through inner control points
+            ;; to lower end point.
+            upper-inner-control-point
+            lower-inner-control-point
+            lower-end-point
+            ;; Step 3: move to upper end point.
+            upper-end-point
+            ;; Step 2: curve through outer control points
+            ;; to upper end point.
+            lower-outer-control-point
+            upper-outer-control-point
+            upper-end-point
+            ;; Step 1: move to lower end point.
+            lower-end-point)
+      line-width
+      (interval-widen x-extent (/ line-width 2))
+      (interval-widen y-extent (/ line-width 2)))))
 
 (define-public (parenthesize-stencil
                stencil half-thickness width angularity padding)