ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* shading in metapost
@ 2008-01-16 19:07 Thomas A. Schmitz
  2008-01-16 22:22 ` John Luciani
  2008-01-24  0:28 ` Mojca Miklavec
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas A. Schmitz @ 2008-01-16 19:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

Hi all,

I have a somewhat silly question about metapost/metafun. To emphasize  
parts of a picture, I place a bright red arrow or circle/ellipse on  
top of the picture. I would like to make this arrow more visible by  
putting a shade beneath it (I attach a jpg that will hopefully show  
the desired effect). Right now, I simply draw the arrow twice with a  
transparent black color, once with a smaller pencircle, so the effect  
is like a shadow that is darker in the center than at the edges.  
However, I think the effect would be more dramatic if I could have a  
transparent area with a smooth grading. Is this possible at all in  
metapost? filling a path with a transparent AND shaded color?

All best

Thomas


[-- Attachment #2: test.jpg --]
[-- Type: image/jpeg, Size: 27762 bytes --]

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



[-- Attachment #4: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shading in metapost
  2008-01-16 19:07 shading in metapost Thomas A. Schmitz
@ 2008-01-16 22:22 ` John Luciani
  2008-01-24  8:15   ` Thomas A. Schmitz
  2008-01-24  0:28 ` Mojca Miklavec
  1 sibling, 1 reply; 7+ messages in thread
From: John Luciani @ 2008-01-16 22:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

There is some information on doing transparencies in
METAPOST at http://www-math.univ-poitiers.fr/~phan/metalpha.html

Using the code at the above link you should be able to produce
the effect in your jpeg.

(* jcl *)

-- 
http://www.luciani.org
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shading in metapost
  2008-01-16 19:07 shading in metapost Thomas A. Schmitz
  2008-01-16 22:22 ` John Luciani
@ 2008-01-24  0:28 ` Mojca Miklavec
  1 sibling, 0 replies; 7+ messages in thread
From: Mojca Miklavec @ 2008-01-24  0:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz

On Jan 16, 2008 8:07 PM, Thomas A. Schmitz wrote:
> Hi all,
>
> I have a somewhat silly question about metapost/metafun. To emphasize
> parts of a picture, I place a bright red arrow or circle/ellipse on
> top of the picture. I would like to make this arrow more visible by
> putting a shade beneath it (I attach a jpg that will hopefully show
> the desired effect). Right now, I simply draw the arrow twice with a
> transparent black color, once with a smaller pencircle, so the effect
> is like a shadow that is darker in the center than at the edges.
> However, I think the effect would be more dramatic if I could have a
> transparent area with a smooth grading. Is this possible at all in
> metapost? filling a path with a transparent AND shaded color?

In theory possible, but in practice not implemented in metafun. But see
    http://www.fauskes.net/media/pgf/pgfmanualCVS2008-01-23.pdf
It might satisfy your needs. (Impressive!)

Mojca
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shading in metapost
  2008-01-24  8:15   ` Thomas A. Schmitz
@ 2008-01-24  8:03     ` Aditya Mahajan
  2008-01-24  9:26       ` Thomas A. Schmitz
  2008-01-24  9:59     ` Hans Hagen
  1 sibling, 1 reply; 7+ messages in thread
From: Aditya Mahajan @ 2008-01-24  8:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Thomas,

On Thu, 24 Jan 2008, Thomas A. Schmitz wrote:

> On Jan 24, 2008, at 1:28 AM, Mojca Miklavec wrote:
>>
>> In theory possible, but in practice not implemented in metafun. But
>> see
>>    http://www.fauskes.net/media/pgf/pgfmanualCVS2008-01-23.pdf
>> It might satisfy your needs. (Impressive!)
>>
>> Mojca
>
> Thanks, Mojca, that's what I suspected. For the time being, I prefer
> metafun just because I know a little bit about it (and almost nothing
> about tikz).

TikZ has a nice interface. The only drawback right now is the speed. 
Hopefully sometime in the near future, some of the backend of tikz will be 
written in lua and mplib, which will make things much faster.

> I have solved the problem at hand by drawing ten
> instances of a very transparent black circle on top of each other and
> increasing the scale of the pencircle slightly at every run. Which
> leads me to one last question: I wanted to be clever and do it in a
> for-loop like this:
>
>  for i=1 upto 10:
>  	pickup pencircle scaled (i*0.5) pt ;
>  	draw fullcircle scaled 5mm withcolor transparent (1,0.04,black) ;
>  endfor ;
>
> Is this because the expression "pencircle scaled" expects a "numeric
> primary" as argument? And is there any way around this?

scaled expects a dimension. (i*0.5)pt is not a dimension. You need to 
either write (i*0.5pt) or ((i*0.5)*1pt). The extra parenthesis are needed 
to keep the metapost parser happy.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shading in metapost
  2008-01-16 22:22 ` John Luciani
@ 2008-01-24  8:15   ` Thomas A. Schmitz
  2008-01-24  8:03     ` Aditya Mahajan
  2008-01-24  9:59     ` Hans Hagen
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas A. Schmitz @ 2008-01-24  8:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Jan 16, 2008, at 11:22 PM, John Luciani wrote:

> There is some information on doing transparencies in
> METAPOST at http://www-math.univ-poitiers.fr/~phan/metalpha.html
>
> Using the code at the above link you should be able to produce
> the effect in your jpeg.
>
> (* jcl *)

John,

I never thanked you for your message; sorry about that! Unless I'm  
missing something, this page is just about transparency, but that  
works quite well in metafun; it was the combination of transparency  
and shading which I couldn't get right.


On Jan 24, 2008, at 1:28 AM, Mojca Miklavec wrote:
>
> In theory possible, but in practice not implemented in metafun. But  
> see
>    http://www.fauskes.net/media/pgf/pgfmanualCVS2008-01-23.pdf
> It might satisfy your needs. (Impressive!)
>
> Mojca

Thanks, Mojca, that's what I suspected. For the time being, I prefer  
metafun just because I know a little bit about it (and almost nothing  
about tikz). I have solved the problem at hand by drawing ten  
instances of a very transparent black circle on top of each other and  
increasing the scale of the pencircle slightly at every run. Which  
leads me to one last question: I wanted to be clever and do it in a  
for-loop like this:

  for i=1 upto 10:
  	pickup pencircle scaled (i*0.5) pt ;
  	draw fullcircle scaled 5mm withcolor transparent (1,0.04,black) ;
  endfor ;

Is this because the expression "pencircle scaled" expects a "numeric  
primary" as argument? And is there any way around this?

All best, and thanks to all

Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shading in metapost
  2008-01-24  8:03     ` Aditya Mahajan
@ 2008-01-24  9:26       ` Thomas A. Schmitz
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas A. Schmitz @ 2008-01-24  9:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Jan 24, 2008, at 9:03 AM, Aditya Mahajan wrote:

> Hi Thomas,
>
> On Thu, 24 Jan 2008, Thomas A. Schmitz wrote:
>>

>>  I wanted to be clever and do it in a
>> for-loop like this:
>>
>> for i=1 upto 10:
>> 	pickup pencircle scaled (i*0.5) pt ;
>> 	draw fullcircle scaled 5mm withcolor transparent (1,0.04,black) ;
>> endfor ;
>>
>> Is this because the expression "pencircle scaled" expects a "numeric
>> primary" as argument? And is there any way around this?
>
> scaled expects a dimension. (i*0.5)pt is not a dimension. You need to
> either write (i*0.5pt) or ((i*0.5)*1pt). The extra parenthesis are  
> needed
> to keep the metapost parser happy.
>
> Aditya
>

Hi Aditya,

arrrrgh. So easy - and I had no idea how to do it. Works perfectly!  
I'm glad I'm in the humanities and not in engineering; my bridges  
would collapse real soon... Thanks so much; this loop looks so much  
nicer than having ten lines of code doing the same circle all over  
again!

All best

Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shading in metapost
  2008-01-24  8:15   ` Thomas A. Schmitz
  2008-01-24  8:03     ` Aditya Mahajan
@ 2008-01-24  9:59     ` Hans Hagen
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2008-01-24  9:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thomas A. Schmitz wrote:

> I never thanked you for your message; sorry about that! Unless I'm  
> missing something, this page is just about transparency, but that  
> works quite well in metafun; it was the combination of transparency  
> and shading which I couldn't get right.

in mkiv at some point this may work because there transparency and color 
are separated, but there will be no changes to metafun till mplib is 
around

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-01-24  9:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-16 19:07 shading in metapost Thomas A. Schmitz
2008-01-16 22:22 ` John Luciani
2008-01-24  8:15   ` Thomas A. Schmitz
2008-01-24  8:03     ` Aditya Mahajan
2008-01-24  9:26       ` Thomas A. Schmitz
2008-01-24  9:59     ` Hans Hagen
2008-01-24  0:28 ` Mojca Miklavec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).