[Therion] Adjust opacity value in transparent color

Martin Sluka martinsluka at mac.com
Tue Jul 19 14:00:55 CEST 2016


There is transparency parameter in MetaPost:

Transparent colors 

You can use transparent colors with the transparent(method, factor, color) function. For example:
\runMPgraphicstrue
\setupcolors[state=start]
\starttext
\startreusableMPgraphic{a}
fill unitsquare scaled 1cm withcolor yellow;
fill unitsquare shifted (0.5,0.5)
  % method 1 = normal
  scaled 1cm withcolor transparent(1,0.5,red);
\stopreusableMPgraphic

\placefigure[force,none]{}{\reuseMPgraphic{a}}
\stoptext

The available transparency methods are the twelve methods supported by PDF specification:
1. normal 
2. multiply 
3. screen 
4. overlay
5. softlight 
6. hardlight 
7. colordodge 
8. colorburn
9. darken 
10. lighten 
11. difference 
12. exclusion

On Jul 19, 2016, at 12:25 PM, Robert Staven <robert at staven.no> wrote:

Hi,

I'm using Therion to map waterfilled caves, and some systems have 
'air-locks' (air chambers), so it's necessary to distinguish between air 
filled cave, waterfilled cave and water surfaces. But the waterfilled 
area should show details (be transparent) in same way as dry cave.

Is there any way to adjust the opacity value (in meta code?) when 
setting a transparent color?


I have made a test to show my issues:
The files can be found on http://www.staven.no/cavetest/


The cave (ca 100m long)
plan:
-> http://www.staven.no/cavetest/testcave_plan.pdf
elevation:
-> http://www.staven.no/cavetest/testcave_elevation.pdf

This doesn't work to well draw underwater maps.


*** Changing the water color:

layout test
code metapost

def a_water (expr p) =
T:=identity;
thfill p withcolor (0.8, 0.8, 1.0);
enddef;

endcode
endlayout

-> http://www.staven.no/cavetest/testcave_elevation_2.pdf

Looks better but the cave and line 'behind' doesn't show thru the water.


*** Try with transparent water color:

def_transparent_rgb(tr_lblue, 0.80, 0.80, 1.00);

def a_water (expr p) =
T:=identity;
thfill p withtransparentcolor tr_lblue;
enddef;

-> http://www.staven.no/cavetest/testcave_elevation_3.pdf


*** Almost perfect, but I like to adjust the opacity value so it looks 
like this:

def a_water (expr p) =
T:=identity;
enddef;
# no drawing of water

color map-fg [80 80 100]

-> http://www.staven.no/cavetest/testcave_elevation_4.pdf
(NB You won't see the difference in Adobe Reader, but it shows up in 
SumatraPDF)


Is there any way to adjust the opacity value when setting a transparent 
color?

Or should I do this another way?
_______________________________________________
Therion mailing list
Therion at speleo.sk
http://mailman.speleo.sk/listinfo/therion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20160719/d207aebf/attachment.htm>


More information about the Therion mailing list