diff options
-rw-r--r-- | examples/transparency_example.ps | 7 | ||||
-rw-r--r-- | psi/ztrans.c | 26 |
2 files changed, 31 insertions, 2 deletions
diff --git a/examples/transparency_example.ps b/examples/transparency_example.ps index ec4f914b0..e9cb4a21a 100644 --- a/examples/transparency_example.ps +++ b/examples/transparency_example.ps | |||
@@ -1,8 +1,11 @@ | |||
1 | %!PS | 1 | %!PS |
2 | % Postscript that uses Ghostscript extensions to do simple transparency | 2 | % Postscript that uses Ghostscript extensions to do simple transparency |
3 | 3 | ||
4 | << /CompatibilityLevel 1.4 | 4 | << |
5 | /PageSpotColors 0>> setpagedevice % in case we are going to pdfwrite | 5 | /PageUsesSpotColors true % needed if we are using transparency |
6 | /CompatibilityLevel 1.4 | ||
7 | /PageSpotColors 0 | ||
8 | >> setpagedevice % in case we are going to pdfwrite | ||
6 | 9 | ||
7 | % work around rectfill mapping directly to device fill_rectangle | 10 | % work around rectfill mapping directly to device fill_rectangle |
8 | /rectfill { | 11 | /rectfill { |
diff --git a/psi/ztrans.c b/psi/ztrans.c index 6f3dd7254..394ec5a9e 100644 --- a/psi/ztrans.c +++ b/psi/ztrans.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "iname.h" | 33 | #include "iname.h" |
34 | #include "store.h" | 34 | #include "store.h" |
35 | #include "gsdfilt.h" | 35 | #include "gsdfilt.h" |
36 | #include "gspaint.h" /* gs_erasepage prototype */ | ||
36 | #include "gdevdevn.h" | 37 | #include "gdevdevn.h" |
37 | #include "gxblend.h" | 38 | #include "gxblend.h" |
38 | #include "gdevp14.h" | 39 | #include "gdevp14.h" |
@@ -484,8 +485,33 @@ zpushpdf14devicefilter(i_ctx_t *i_ctx_p) | |||
484 | { | 485 | { |
485 | int code; | 486 | int code; |
486 | os_ptr op = osp; | 487 | os_ptr op = osp; |
488 | gx_device *cdev = gs_currentdevice_inline(igs); | ||
487 | 489 | ||
488 | check_type(*op, t_integer); | 490 | check_type(*op, t_integer); |
491 | /* Bug 698087: In case some program uses our .pushpdf14devicefilter make */ | ||
492 | /* sure that the device knows that we are using the pdf14 */ | ||
493 | /* transparency. Note this will close and re-open the device */ | ||
494 | /* and erase the page. This should not occur with PDF files. */ | ||
495 | if (cdev->page_uses_transparency == 0) { | ||
496 | gs_c_param_list list; | ||
497 | bool bool_true = 1; | ||
498 | |||
499 | gs_c_param_list_write(&list, imemory); | ||
500 | param_write_bool(&list, "PageUsesTransparency", &bool_true); | ||
501 | gs_c_param_list_read(&list); | ||
502 | code = gs_gstate_putdeviceparams(igs, cdev, (gs_param_list *)&list); | ||
503 | gs_c_param_list_release(&list); | ||
504 | if (code < 0) | ||
505 | return code; | ||
506 | if (cdev->is_open) { | ||
507 | if ((code = gs_closedevice((gx_device *)cdev)) < 0) | ||
508 | return code; | ||
509 | } | ||
510 | if ((code = gs_opendevice((gx_device *)cdev)) < 0) | ||
511 | return code; | ||
512 | if ((code = gs_erasepage(igs)) < 0) | ||
513 | return code; | ||
514 | } | ||
489 | code = gs_push_pdf14trans_device(igs, false); | 515 | code = gs_push_pdf14trans_device(igs, false); |
490 | if (code < 0) | 516 | if (code < 0) |
491 | return code; | 517 | return code; |