summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2019-10-15 12:24:12 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-08-13 11:26:55 +0200
commite088156d5b620e5e639580dacf85c6dc13823c74 (patch)
tree57f5c025e203279944da512166c20bc0521d8ccd /examples/transparency_example.ps
downloadghostscript-gpl-patches-e088156d5b620e5e639580dacf85c6dc13823c74.tar.gz
ghostscript-gpl-patches-e088156d5b620e5e639580dacf85c6dc13823c74.tar.bz2
ghostscript-gpl-patches-e088156d5b620e5e639580dacf85c6dc13823c74.zip
Import Ghostscript 9.50ghostscript-9.50
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'examples/transparency_example.ps')
-rw-r--r--examples/transparency_example.ps48
1 files changed, 48 insertions, 0 deletions
diff --git a/examples/transparency_example.ps b/examples/transparency_example.ps
new file mode 100644
index 00000000..82ffadab
--- /dev/null
+++ b/examples/transparency_example.ps
@@ -0,0 +1,48 @@
+%!PS
+% Postscript that uses Ghostscript extensions to do simple transparency
+
+/PageUsesTransparency true def
+
+systemdict /.pushpdf14devicefilter known not
+{
+ (\n\n%%%% WARNING: Transparency operations ignored - probably due to using -dSAFER\n\n) print flush
+ /.pushpdf14devicefilter {pop} bind def
+ /.begintransparencygroup {pop pop pop pop pop} bind def
+ /.endtransparencygroup {} bind def
+ /.poppdf14devicefilter {} bind def
+ /.setopacityalpha {pop} bind def
+ /.setshapealpha {pop} bind def
+ /PageUsesTransparency false def
+} if
+
+
+<<
+ /PageUsesTransparency PageUsesTransparency % needed if we are using transparency
+ /CompatibilityLevel 1.4
+ /PageSpotColors 0
+>> setpagedevice % in case we are going to pdfwrite
+
+% work around rectfill mapping directly to device fill_rectangle
+/rectfill {
+ gsave 4 2 roll moveto 1 index 0 rlineto
+ 0 exch rlineto neg 0 rlineto closepath fill grestore
+} bind def
+
+0 .pushpdf14devicefilter % depth .pushpdf14devicefilter -
+.5 .9 .2 setrgbcolor
+0 0 300 700 rectfill
+
+.2 .5 .9 setrgbcolor
+200 100 400 400 rectfill
+
+ << >> clippath pathbbox newpath .begintransparencygroup
+
+ .5 .setopacityalpha 1 .setshapealpha
+
+ .9 .3 .1 setrgbcolor
+
+ 100 200 500 500 rectfill
+
+ .endtransparencygroup
+.poppdf14devicefilter
+showpage