Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

transparency?

13 views
Skip to first unread message

Ancient_Hacker

unread,
May 11, 2007, 11:07:17 AM5/11/07
to
Hello, does GhostScript have actual working transparency?

I've been trying this example code which is supposed to work in
Acriobat, on Win32 and no luck so far:

gsave
100 100 translate % set position on page
0.4 0.7 1 setrgbcolor % draw a pastel blue box
40 40 60 60 rectfill
0.3 .setopacityalpha
0.4 .setshapealpha
1 0.5 0 setrgbcolor % draw transparent orange
20 20 60 60 rectfill
grestore
showpage

Ken Sharp

unread,
May 12, 2007, 6:57:39 AM5/12/07
to
In article <1178896037.7...@q75g2000hsh.googlegroups.com>, grg2
@comcast.net says...

> Hello, does GhostScript have actual working transparency?

Well it can certainly render transparent PDF files, and I believe PCL
files with raster ops.


> I've been trying this example code which is supposed to work in
> Acriobat, on Win32 and no luck so far:

Well its not going to work on Acrobat, because it uses non-standard
operators like '.setopacityalpha'. These are, I believe, the GhostScript
extensions which allow it to process transparent PDF files using
PostScript.

Where did you get the example from ? I concur that with my copy of GS
8.56 it renders two opaque rectangles rather than any form of
transparency...

You don't set a transparency group, and you haven't told GS up front
that you will be using transparency, both are thigns which GS' own PDF
interpretation code sems to do in pdf_main.ps:

% Let the device know if we will be using PDF 1.4 transparency.
% The clist logic may need to adjust the size of bands.
1 index pageusestransparency /PageUsesTransparency exch def


...

% If the page uses any transparency features, show it within
% a transparency group.
dup pageusestransparency dup /PDFusingtransparency exch def {
% Show the page within a PDF 1.4 device filter.
0 .pushpdf14devicefilter {
/DefaultQstate qstate store % device has changed -- reset
DefaultQstate
% If the page has a Group, enclose contents in transparency group.
% (Adobe Tech Note 5407, sec 9.2)
dup /Group knownoget {
1 index /CropBox knownoget {
/CropBox exch
} {
1 index get_media_box /MediaBox exch
} ifelse
oforce_elems normrect_elems fix_empty_rect_elems 4 array astore
.beginformgroup {
showpagecontents
} stopped {
.discardtransparencygroup stop
} if .endtransparencygroup
} {
showpagecontents
} ifelse
} stopped {
% todo: discard
.poppdf14devicefilter
/DefaultQstate qstate store % device has changed -- reset
DefaultQstate
stop
} if .poppdf14devicefilter

Looks to me like your example is way too simple, and in particular
doesn't insert the 'pdf14devicefilter, which looks essential for
transparency processing. Trying to use PostScript extensions isolated
from the PDF processing environment looks like it might be pretty hard
work to me.


Ken

0 new messages