]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-svg.scm
* scm/ps-to-png.scm (make-ps-images): cleanup multipage vs. single
[lilypond.git] / scm / output-svg.scm
index 830bba9ab274e73ed358793d29d7c765c0e8c2d8..786efb8602cc2212514407b30ae5ae5936c8aab6 100644 (file)
   "c = close"
   (format #f "</~S>\n" entity))
 
+
+(define-public (setcolor r g b))
+
+(define-public (resetcolor))
+
+
 (define-public (entity entity string . attributes-alist)
   (if (equal? string "")
       (apply eoc entity attributes-alist)
 (define (fontify font expr)
   (entity 'text expr
          `(style . ,(svg-font font))
+         '(fill . "currentColor")
          ))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            '(stroke-linejoin . "round")
            '(stroke-linecap . "round")
            `(stroke-width . ,blot-diameter)
-           '(stroke . "black")
-           '(fill . "black")
+           '(stroke . "currentColor")
+           '(fill . "currentColor")
            `(points . ,(string-join
                         (map offset->point
                              (list (cons (/ b 2) (/ t 2))
            '(stroke-linejoin . "round")
            '(stroke-linecap . "round")
            `(stroke-width . ,blot-diameter)
-           '(stroke . "black")
-           '(fill . "black")
+           '(stroke . "currentColor")
+           '(fill . "currentColor")
            `(d . ,(format #f "M ~S,~S l ~S,~S l ~S,~S l ~S,~S l ~S,~S"
                           (/ b 2) (/ t 2)
                           w (- h)
            '(stroke-linejoin . "round")
            '(stroke-linecap . "round")
            `(stroke-width . ,thick)
-           '(stroke . "black")
-           '(fill . "black")
+           '(stroke . "currentColor")
+           '(fill . "currentColor")
            `(d . ,(string-append (svg-bezier first #f)
                                  (svg-bezier second first-c0)))
            )))
          `((stroke-linejoin . "round")
            (stroke-linecap . "round")
            (stroke-width . ,thick)
-           (stroke . "black")
-           ;;'(fill . "black")
+           (stroke . "currentColor")
            (x1 . ,x1)
-           (y1 . ,y1)
+           (y1 . ,(- y1))
            (x2 . ,x2)
-           (y2 . ,y2))
+           (y2 . ,(- y2)))
          alist)))
 
 (define (dashed-line thick on off dx dy)
   (draw-line thick 0 0 dx dy `(style . ,(format "stroke-dasharray:~a,~a;" on off))))
 
-;; WTF is this in every backend?
-(define (horizontal-line x1 x2 th)
-  (filledbox (- x1) (- x2 x1) (* .5 th) (* .5 th)))
-
 (define (filledbox breapth width depth height)
   (round-filled-box breapth width depth height 0))
 
          `(transform . ,(format #f "translate (~f, ~f)"
                                 x (- y)))))
 
-
-(define (polygon coords blot-diameter)
-  (entity 'polygon ""
-         '(stroke-linejoin . "round")
-         '(stroke-linecap . "round")
-         `(stroke-width . ,blot-diameter)
-         '(stroke . "black")
-         ;;'(fill . "black")
-         `(points . ,(string-join
-                      (map offset->point (ly:list->offsets '() coords))))
-  ))
+(define (polygon coords blot-diameter is-filled)
+  (entity
+   'polygon ""
+   '(stroke-linejoin . "round")
+   '(stroke-linecap . "round")
+   `(stroke-width . ,blot-diameter)
+   `(fill . ,(if is-filled "currentColor" "none"))
+   '(stroke . "currentColor")
+   `(points . ,(string-join
+               (map offset->point (ly:list->offsets '() coords))))
+   ))
 
 (define (round-filled-box breapth width depth height blot-diameter)
   (entity 'rect ""
          `(ry . ,(/ blot-diameter 2))
          ))
 
+(define (circle radius thick is-filled)
+  (entity
+   'circle ""
+   '(stroke-linejoin . "round")
+   '(stroke-linecap . "round")
+   `(fill . ,(if is-filled "currentColor" "none"))
+   `(stroke . "currentColor")
+   `(stroke-width . ,thick)
+   `(r . ,radius)))
+
 (define (text font string)
   (dispatch `(fontify ,font ,(entity 'tspan (string->entities string)))))
 
 (define (utf8-string pango-font-description string)
   (dispatch `(fontify ,pango-font-description ,(entity 'tspan string))))
+
+
+
+(define (setcolor r g b)
+  (format "<g color=\"rgb(~a%,~a%,~a%)\">"
+         (* 100 r) (* 100 g) (* 100 b)
+         ))
+
+(define (resetcolor)
+  "</g>")