From: Mike Solomon Date: Mon, 6 Feb 2012 14:03:20 +0000 (+0100) Subject: Gets rid of bezier-sandwich stencil X-Git-Tag: release/2.15.29-1~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=35725a573e47be7c02c51964641ea534fb88be6b;p=lilypond.git Gets rid of bezier-sandwich stencil --- diff --git a/lily/lookup.cc b/lily/lookup.cc index 3f393e05ac..7b63b83111 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -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); diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps index 9d2e4070b0..2d17d57ab9 100644 --- a/ps/music-drawing-routines.ps +++ b/ps/music-drawing-routines.ps @@ -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 diff --git a/scm/define-stencil-commands.scm b/scm/define-stencil-commands.scm index 06177cb512..c6b9c99b44 100644 --- a/scm/define-stencil-commands.scm +++ b/scm/define-stencil-commands.scm @@ -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 diff --git a/scm/fret-diagrams.scm b/scm/fret-diagrams.scm index 46af7edb01..cd734b2ecf 100644 --- a/scm/fret-diagrams.scm +++ b/scm/fret-diagrams.scm @@ -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))) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 8c8e853567..aa3cce06ae 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -58,12 +58,6 @@ ;;; 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) diff --git a/scm/output-socket.scm b/scm/output-socket.scm index 28e22f72a3..352ff2989d 100644 --- a/scm/output-socket.scm +++ b/scm/output-socket.scm @@ -48,16 +48,6 @@ ;;; 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)) diff --git a/scm/output-svg.scm b/scm/output-svg.scm index e3af710b15..eaff362942 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -329,18 +329,6 @@ ;;; 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)))))) diff --git a/scm/stencil.scm b/scm/stencil.scm index 21d7bb86f9..0ecc9abe8e 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -15,6 +15,30 @@ ;;;; You should have received a copy of the GNU General Public License ;;;; along with LilyPond. If not, see . +(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)