diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2018-04-10 18:40:21 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2018-04-10 18:40:21 +0200 |
commit | 860145884e4f883f01948579eee43e17b006924a (patch) | |
tree | aa120774ba9646ba28bf12621d1753ba663305f9 | |
parent | 61d5199b483e9da107d2ed940f95749897b646da (diff) |
Add pin-over and pin-under.
-rw-r--r-- | pict.scm | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -89,6 +89,9 @@ rc-superimpose rb-superimpose + pin-over + pin-under + ;; colors rgb colors)) @@ -800,6 +803,36 @@ bottom." "Stack the given PICTS and align them right and at the bottom." (append-align 'right 'bottom picts)) +(define (pin-over base dx dy pict) + "Create a pict with the same dimensions as BASE, but with PICT +placed on top. PICT is offset from the top left corner of BASE by DX +and DY." + (make-pict + `(svg (@ (height ,(pict-height base)) + (width ,(pict-width base)) + (class "pinned") + (x 0) + (y 0)) + ,(pict-sxml base) + ,((compose (attribute-modifier 'y (const dy)) + (attribute-modifier 'x (const dx))) + (pict-sxml pict))))) + +(define (pin-under base dx dy pict) + "Create a pict with the same dimensions as BASE, but with PICT +placed underneath. PICT is offset from the top left corner of BASE by +DX and DY." + (make-pict + `(svg (@ (height ,(pict-height base)) + (width ,(pict-width base)) + (class "pinned") + (x 0) + (y 0)) + ,((compose (attribute-modifier 'y (const dy)) + (attribute-modifier 'x (const dx))) + (pict-sxml pict)) + ,(pict-sxml base)))) + ;;; Colors |