summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-04-12 20:35:16 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-04-12 20:35:16 +0200
commita3b3403a83dcaab9362186a8eac130c0c7e61ab7 (patch)
tree44b5764dc990119a3c03b9f3d137c040e48306a8
parent6f8cc553eb2982e55e18434599143b5b90220b5d (diff)
Add cellophane.
-rw-r--r--pict.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/pict.scm b/pict.scm
index 21fac99..dfa854a 100644
--- a/pict.scm
+++ b/pict.scm
@@ -44,6 +44,7 @@
shrink
rotate
blur
+ cellophane
frame
@@ -408,6 +409,20 @@ strings that are built from the list of attributes LST."
2))))
(pict-sxml pict))))))
+(define (cellophane pict opacity)
+ "Set the opacity of PICT to OPACITY, a numeric value between 0 (for
+full transparency) and 1 (for full opacity)."
+ (make-pict
+ `(svg (@ (height ,(pict-height pict))
+ (width ,(pict-width pict))
+ (class "opacity")
+ (x 0)
+ (y 0))
+ ,((attribute-modifier 'opacity (const opacity))
+ `(g (@ (class "opacity")
+ (opacity ,opacity))
+ ,(pict-sxml pict))))))
+
(define* (frame pict #:key (color "black") (stroke-width 1))
"Draw a box around PICT."
(cc-superimpose pict