[Therion] Adjust opacity value in transparent color

Martin Sluka martinsluka at mac.com
Wed Jul 20 07:50:15 CEST 2016


I’m sorry, I was too fast.

transparency is part of MetaFun extension only.

http://wiki.contextgarden.net/MetaFun <http://wiki.contextgarden.net/MetaFun>

Samples of using of MetaFun:

http://www.pragma-ade.com/show-gra.pdf <http://www.pragma-ade.com/show-gra.pdf>

m.s.



> 19. 7. 2016 v 14:00, Martin Sluka <martinsluka at mac.com>:
> 
> 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/ <http://www.staven.no/cavetest/>
>> 
>> 
>> The cave (ca 100m long)
>> plan:
>> -> http://www.staven.no/cavetest/testcave_plan.pdf <http://www.staven.no/cavetest/testcave_plan.pdf>
>> elevation:
>> -> http://www.staven.no/cavetest/testcave_elevation.pdf <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 <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 <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 <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 <mailto:Therion at speleo.sk>
>> http://mailman.speleo.sk/listinfo/therion <http://mailman.speleo.sk/listinfo/therion>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20160720/cf9eeeec/attachment.htm>


More information about the Therion mailing list