Taking inspiration from Martins recent post on
transparent colours I thought I might make my custom point water and area water
transparent, or at least behave better with ‘transparency on’ than
the standard non-transparent colours. Alas the code compiles without fuss,
but the result is identical to the result when using standard (opaque) colour
definitions.
In my layout I have, in the order called…
Define the area and point water
def p_water (expr
pos,theta,sc,al)=
U:=(.425u,.3u);
T:=identity aligned al rotated theta scaled sc shifted pos;
pickup
PenD;
p:=fullcircle xscaled (1.2u) yscaled (0.8u) randomized (0.1u) rotated
uniformdeviate (-45);
%if
known colour_water_bg: thfill p withcolor colour_water_bg; else: thfill p
withcolor white; fi;
if known tr_colour_water_bg: thfill p
withtransparentcolor tr_colour_water_bg; else: thfill p
withtransparentcolor tr_white; fi;
thfill
p withpattern pattern_water; %%% withcolor black; %but with failed
attempt at black hatch
thdraw
p; %outline
enddef;
def a_water (expr Path) =
T:=identity;
% thclean Path;
pickup PenD;
% if known
colour_water_bg: thfill Path withcolor colour_water_bg; else: thfill Path
withcolor white; fi;
if known tr_colour_water_bg: thfill Path
withtransparentcolor tr_colour_water_bg; else: thfill Path
withtransparentcolor tr_white; fi;
thfill Path
withpattern pattern_water;
%%thdraw
Path; %outline, not needed as area drawn is defined by line border anyway
enddef;
Optionally define the colours (the tr_white not
needed as it is defined in the default distribution)
!color
colour_water_bg; %! forces interpretation as metapost
colour_water_bg
:= (0.86,1,1); %light blue
def_transparent_rgb(tr_colour_water_bg,
0.86, 1, 1);
and then
transparency on
opacity
50
Everything in these examples is in a single scrap.
I have checked that my code is being used by changing
the colours, for example from tr_white to tr_black etc and these changes are
reflected properly, it’s just that they are not transparent.
In Adobe Reader it looks like this (below) (the water
on the right is definitely not transparent – the rock place bottom is
obscured)
Adobe also seems to make the colours and line weights
different to the others – incorrectly I suspect.
If I run this example with transparency off (but
still using my custom transparent colours), the result is identical EXCEPT all
the colours are much more intense.
In Foxit Reader it looks like this (below) with
transparency on (Foxit always makes everything transparent when transparency is
on, so it is not really a test) So again, no difference whether using
transparent colour definitions or non-transparent.
When transparency is off, it looks exactly the same
as in Adobe.

In Evince it looks like this (after about 1 minute to
load the modest file-Evince also behaves just like Foxit, but has a problem
with hatches extending out into the bounding box as well)

So as you can see the viewing software may be masking
(a little) what Therion is really trying to do, however it seems to be somewhat
like either almost everything is opaque, or almost everything is transparent,
and the promise that transparent colours seem to offer some more control cannot
be realised?
What I would like is something closer to what Adobe
is rendering (with the finer line work of Foxit) , but with the ‘rock-border
place bottom’ showing through the water when the water is defined with a
transparent colour.
I guess when transparency is on, water and sump
should always be transparent to underlying objects, but closed rock-borders and
the rocks in ‘area blocks’ should never be. After all that maybe
I need to be looking at the rock-border and area blocks definitions?
Any ideas why transparent colours make no difference
at all?
Any ideas how to make the rocks in area blocks and
closed rock-borders opaque to any objects (in the same scrap) beneath them
without messing up the transparency of other objects?
Bruce