Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Zhichu Chen
Fine, I made it in a very weird way. I constructed a very
strange path to go through the outer path in counter-
clockwise direction and inner path in clockwise dir-
ection and filled it. I don't feel good but it can be done
now.

On Wed, Jun 24, 2009 at 11:13 AM, Zhichu Chenzhichu.c...@gmail.com wrote:
 Hi, I got a problem in metapost. If I want to draw a ring, and
 use the code:
 fill fullcircle scaled 2cm ;
 unfill fullcircle scaled 1cm ;
 The inner part is not transparent, it has the color of background
 variable which is white by default.

 This case is a minimal example, I actually wanna draw something
 more complex, like the glyph Q and I know the inner path and
 outer path. How can I fill the ring without jeopardizing the area inside
 the inner path?

 --
 Best Regards
 Chen
 

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
 




-- 
Best Regards
Chen


  Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
 No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
 tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
   | www.sinap.ac.cn

___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Taco Hoekwater


Zhichu Chen wrote:
 Fine, I made it in a very weird way. I constructed a very
 strange path to go through the outer path in counter-
 clockwise direction and inner path in clockwise dir-
 ection and filled it. I don't feel good but it can be done
 now.

Currently, that is how it should be done. Maybe a future
version of metapost will be able to handle this natively.

Best wishes,
Taco
___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Zhichu Chen
Cool, but just curiosity, metapost can handle fonts right?
How those glyphs don't have this problem? I've read the
specification of the type1 fonts, they don't seem to have
such weird paths, just some borderlines with different
directions.

On Wed, Jun 24, 2009 at 3:32 PM, Taco Hoekwatert...@elvenkind.com wrote:
 Currently, that is how it should be done. Maybe a future
 version of metapost will be able to handle this natively.

 Best wishes,
 Taco
 ___
 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
 ___




-- 
Best Regards
Chen


  Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
 No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
 tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
   | www.sinap.ac.cn

___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Wolfgang Schuster


Am 24.06.2009 um 05:13 schrieb Zhichu Chen:


Hi, I got a problem in metapost. If I want to draw a ring, and
use the code:
fill fullcircle scaled 2cm ;
unfill fullcircle scaled 1cm ;
The inner part is not transparent, it has the color of background
variable which is white by default.

This case is a minimal example, I actually wanna draw something
more complex, like the glyph Q and I know the inner path and
outer path. How can I fill the ring without jeopardizing the area  
inside

the inner path?


fill fullcircle scaled 2cm -- reverse -- fullcircle scaled 1cm --  
cycle ;


Wolfgang

___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Taco Hoekwater


Zhichu Chen wrote:
 Cool, but just curiosity, metapost can handle fonts right?
 How those glyphs don't have this problem? I've read the
 specification of the type1 fonts, they don't seem to have
 such weird paths, just some borderlines with different
 directions.

PostScript paths are more advanced than Metapost's draw objects,
but Metapost never sees these paths of font glyphs at all.
(well, except via the new primitive 'glyph X of', but that
indeed does have this problem.)

Best wishes,
Taco
___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Zhichu Chen
I assume there's no -- between reverse and fullcircle scaled 1cm :)

Well, my example is too simple. Actually, I was trying to draw a
treble clef, and when there're too many intersection points (caused
by the -- operator to join every path together) the output is not
so good, kind of like an even-odd-fill.

Anyway, I wrote a macro trying to handle it, but it's still weird for
me.
===
def getridof(expr mypath) =
  save p, q, r, l, Oringin, Mode , MagicPoint ;

  pair Oringin ; Oringin := center mypath ;

  pair MagicPoint ;

  numeric Mode ; Mode := 0 ;

  path p[], q[], l ;

  q0 := mypath ;
  q1 := llcorner currentpicture -- lrcorner currentpicture ;
  q2 := lrcorner currentpicture -- urcorner currentpicture ;
  q3 := urcorner currentpicture -- ulcorner currentpicture ;
  q4 := ulcorner currentpicture -- llcorner currentpicture ;
  for i=1 upto 4 :
q[i+4] := q[i] ;
  endfor
  q11 := llcorner currentpicture -- Oringin ;
  q12 := lrcorner currentpicture -- Oringin ;
  q13 := urcorner currentpicture -- Oringin ;
  q14 := ulcorner currentpicture -- Oringin ;

  for i=1 upto 4 :
p[i] := q[i] for j=1 upto 3 : -- q[i+j] endfor ;
  endfor

  if (((llcorner currentpicture -- Oringin) intersectiontimes mypath)
= (-1,-1)) :
if (((lrcorner currentpicture -- Oringin) intersectiontimes
mypath) = (-1,-1)) :
  if (((urcorner currentpicture -- Oringin) intersectiontimes
mypath) = (-1,-1)) :
Mode := 4 ;
  else :
Mode := 3 ;
  fi
else :
  Mode := 2 ;
fi
  else :
Mode := 1 ;
  fi

  l = q[10+Mode] cutafter mypath ;
  MagicPoint = point length(l) of l ;

  p0 := p[Mode]--l--(q0 cutbefore MagicPoint)--(q0 cutafter
MagicPoint)--(reverse l)--cycle ;

  clip currentpicture to p0 ;

  draw p0 withcolor cyan ;
enddef ;
===
If I use
===
path p[] ;

p1 = fullcircle scaled 10 cm ;

p2 = reverse fullcircle scaled 1cm shifted (2cm,2cm) ;
p3 = reverse fullcircle scaled 1.5cm shifted (2cm,-2cm) ;
p4 = reverse fullcircle scaled 1.75cm shifted (-2cm,2cm) ;

fill p1 ;
getridof(p2) ;
getridof(p3) ;
getridof(p4) ;
===
then only p2 was cut off, you can change the order and only the first path
can be handled.

If I use pa[] as the path variables rather than p[], that would be fine.
I don't know why, I mean I've used the save operator.

On Wed, Jun 24, 2009 at 4:21 PM, Wolfgang
Schusterschuster.wolfg...@googlemail.com wrote:

 fill fullcircle scaled 2cm -- reverse -- fullcircle scaled 1cm -- cycle ;

 Wolfgang

 ___
 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
 ___




-- 
Best Regards
Chen


  Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
 No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
 tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
   | www.sinap.ac.cn

___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Zhichu Chen
I guess I should use as few variables as possible, I suppose
no one would name their paths Helper ;)

This macro assumes the argument is clockwise, I've written
a macro to find out whether a path is clockwise or not, but
it took me forever to run the code. Maybe there's already
some primitive could do this.

\startMPinclusions
def getridof(expr p) =
  save Helper, Oringin, Mode, MagicPoint ;

  pair Oringin ; Oringin := center p ;

  pair MagicPoint ;

  numeric Mode ; Mode := 0 ;

  path Helper[] ;

  Helper0 := p ;
  Helper1 := llcorner currentpicture -- lrcorner currentpicture ;
  Helper2 := lrcorner currentpicture -- urcorner currentpicture ;
  Helper3 := urcorner currentpicture -- ulcorner currentpicture ;
  Helper4 := ulcorner currentpicture -- llcorner currentpicture ;
  for i=1 upto 4 :
Helper[i+4] := Helper[i] ;
  endfor
  Helper11 := llcorner currentpicture -- Oringin ;
  Helper12 := lrcorner currentpicture -- Oringin ;
  Helper13 := urcorner currentpicture -- Oringin ;
  Helper14 := ulcorner currentpicture -- Oringin ;


  if (((llcorner currentpicture -- Oringin) intersectiontimes p) = (-1,-1)) :
if (((lrcorner currentpicture -- Oringin) intersectiontimes p) = (-1,-1)) :
  if (((urcorner currentpicture -- Oringin) intersectiontimes p) =
(-1,-1)) :
Mode := 4 ;
  else :
Mode := 3 ;
  fi
else :
  Mode := 2 ;
fi
  else :
Mode := 1 ;
  fi

  Helper100 = Helper[10+Mode] cutafter p ;
  MagicPoint = point length(Helper100) of Helper100 ;

  Helper0 := Helper[Mode] for i=1 upto 3 : -- Helper[Mode+i] endfor
  -- Helper100
  -- (Helper0 cutbefore MagicPoint)
  -- (Helper0 cutafter MagicPoint)
  -- (reverse Helper100)
  -- cycle ;

  clip currentpicture to Helper0 ;

  draw Helper0 withcolor cyan ;
enddef ;
\stopMPinclusions
___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Hans Hagen

Zhichu Chen wrote:


I guess I should use as few variables as possible, I suppose
no one would name their paths Helper ;)


Helper sounds ok, but ...


  pair Oringin ; Oringin := center p ;


... Oringin kind of funny


  Helper1 := llcorner currentpicture -- lrcorner currentpicture ;


shorter:

Helper1 := leftboundary currentpicture ;



-
  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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Zhichu Chen
On Wed, Jun 24, 2009 at 7:29 PM, Hans Hagenpra...@wxs.nl wrote:
 Zhichu Chen wrote:

 I guess I should use as few variables as possible, I suppose
 no one would name their paths Helper ;)

 Helper sounds ok, but ...

  pair Oringin ; Oringin := center p ;

 ... Oringin kind of funny
I'll change that.

  Helper1 := llcorner currentpicture -- lrcorner currentpicture ;

 shorter:

 Helper1 := leftboundary currentpicture ;
Can't find in mpman.pdf. Maybe it's in metafun.



 -
                                          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
 ___




-- 
Best Regards
Chen


  Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
 No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
 tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
   | www.sinap.ac.cn

___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Nicola
In article 
769ba7780906240342s4939ac2foe7bfd783ad2e8...@mail.gmail.com,
 Zhichu Chen zhichu.c...@gmail.com wrote:
 
 Well, my example is too simple. Actually, I was trying to draw a
 treble clef

If your goal is to draw a path with pens of varying width (kind of 
calligraphic strokes),'penpos' and 'penstroke' may be your friends 
(defined in plain.mp). This is what I've come out with by about 15 
minutes of trial and error (disclaimer: this is my first attempt at 
using these macros beyond trying to draw a sans-serif 'l' - I'm not a 
designer at all):

   fill unitsquare scaled 12cm shifted (-6cm,-6cm) withcolor .625red;
   b = 2pt; % Default pen width
   w = 30mm; % Width of treble clef
   h = 100mm; % Height of treble clef
   % Specify breadth and angle of pen at keypoints:
   penpos 1 (0.5b, 30);
   penpos 1.5 (b, 15);
   penpos 2 (3b, 0);
   penpos 3 (5b, -90);
   penpos 4 (3b, -180);
   penpos 5 (b, 90);
   penpos 6 (5b,0);
   penpos 6.5 (4b, -30);
   penpos 7 (.5b, 0);
   penpos 8 (5b, 90);
   penpos 9 (3b, -180);
   penpos 10 (b, -180);
   % Fix x coords of keypoints
   x1=0;
   x1.5=1/2[x1,x2];
   x5=x1=x3=x8;
   x10=1/2[x9,x1];
   x7=1/2[x3,x4];
   x4-x6=w;
   x1=1/2[x2,x4];
   x3-x2=x2-x6;
   x9=1/2[x1,x2];
   x6.5=1/2[x5,x6];
   % Fix y coords of keypoints
   y1=0;
   y1.5=y1;
   y6=y2=y4=1/2[y3,y1];
   y3-y1=y1-y5=1/10h;
   y5-y10=2(y3-y1);
   y8-y7=y3-y1;
   y9=y7;
   y8-y3=y3-y10;
   y6.5=1/2[y6,y7];
   
   drawoptions (withcolor background);
   % Draw (an incomplete and ugly) treble clef
   penstroke z1e .. z1.5e .. z2e .. z3e .. z4e .. z5e .. z6e .. z6.5e .. 
z7e .. z8e .. z9e .. z10e;
   drawoptions(withcolor black);
   labels.lft(1,1.5,2,3,4,5,6,6.5,7,8,9,10);

You must take special care never to cross the left and right edges of 
the pen. See The METAFONTbook for details and examples.

Regards,
Nicola

___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Zhichu Chen
Hi Nicola,

Thank you very much for your example and the idea. It's amazing,
I thought it's just a metafont thing and metapost just can't do that.

Thank you for your information again.

On Wed, Jun 24, 2009 at 10:12 PM, Nicolanvitacolo...@gmail.com wrote:
 In article
 769ba7780906240342s4939ac2foe7bfd783ad2e8...@mail.gmail.com,
  Zhichu Chen zhichu.c...@gmail.com wrote:

 Well, my example is too simple. Actually, I was trying to draw a
 treble clef

 If your goal is to draw a path with pens of varying width (kind of
 calligraphic strokes),'penpos' and 'penstroke' may be your friends
 (defined in plain.mp). This is what I've come out with by about 15
 minutes of trial and error (disclaimer: this is my first attempt at
 using these macros beyond trying to draw a sans-serif 'l' - I'm not a
 designer at all):

   fill unitsquare scaled 12cm shifted (-6cm,-6cm) withcolor .625red;
   b = 2pt; % Default pen width
   w = 30mm; % Width of treble clef
   h = 100mm; % Height of treble clef
   % Specify breadth and angle of pen at keypoints:
   penpos 1 (0.5b, 30);
   penpos 1.5 (b, 15);
   penpos 2 (3b, 0);
   penpos 3 (5b, -90);
   penpos 4 (3b, -180);
   penpos 5 (b, 90);
   penpos 6 (5b,0);
   penpos 6.5 (4b, -30);
   penpos 7 (.5b, 0);
   penpos 8 (5b, 90);
   penpos 9 (3b, -180);
   penpos 10 (b, -180);
   % Fix x coords of keypoints
   x1=0;
   x1.5=1/2[x1,x2];
   x5=x1=x3=x8;
   x10=1/2[x9,x1];
   x7=1/2[x3,x4];
   x4-x6=w;
   x1=1/2[x2,x4];
   x3-x2=x2-x6;
   x9=1/2[x1,x2];
   x6.5=1/2[x5,x6];
   % Fix y coords of keypoints
   y1=0;
   y1.5=y1;
   y6=y2=y4=1/2[y3,y1];
   y3-y1=y1-y5=1/10h;
   y5-y10=2(y3-y1);
   y8-y7=y3-y1;
   y9=y7;
   y8-y3=y3-y10;
   y6.5=1/2[y6,y7];

   drawoptions (withcolor background);
   % Draw (an incomplete and ugly) treble clef
   penstroke z1e .. z1.5e .. z2e .. z3e .. z4e .. z5e .. z6e .. z6.5e ..
 z7e .. z8e .. z9e .. z10e;
   drawoptions(withcolor black);
   labels.lft(1,1.5,2,3,4,5,6,6.5,7,8,9,10);

 You must take special care never to cross the left and right edges of
 the pen. See The METAFONTbook for details and examples.

 Regards,
 Nicola

 ___
 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
 ___




-- 
Best Regards
Chen


  Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
 No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
 tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
   | www.sinap.ac.cn

___
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
___


Re: [NTG-context] How to unfill a picture?

2009-06-24 Thread Lutz Haseloff
Hi Zichu,

an other approach (mkiv + lilypond font):

\definefont[music][name:emmentaler20 at 72pt]
\starttext
\music\char57770
\stoptext

:-)

Greetings Lutz

2009/6/24 Zhichu Chen zhichu.c...@gmail.com

 Hi Nicola,

 Thank you very much for your example and the idea. It's amazing,
 I thought it's just a metafont thing and metapost just can't do that.

 Thank you for your information again.

 On Wed, Jun 24, 2009 at 10:12 PM, Nicolanvitacolo...@gmail.com wrote:
  In article
  769ba7780906240342s4939ac2foe7bfd783ad2e8...@mail.gmail.com,
   Zhichu Chen zhichu.c...@gmail.com wrote:
 
  Well, my example is too simple. Actually, I was trying to draw a
  treble clef
 
  If your goal is to draw a path with pens of varying width (kind of
  calligraphic strokes),'penpos' and 'penstroke' may be your friends
  (defined in plain.mp). This is what I've come out with by about 15
  minutes of trial and error (disclaimer: this is my first attempt at
  using these macros beyond trying to draw a sans-serif 'l' - I'm not a
  designer at all):
 
fill unitsquare scaled 12cm shifted (-6cm,-6cm) withcolor .625red;
b = 2pt; % Default pen width
w = 30mm; % Width of treble clef
h = 100mm; % Height of treble clef
% Specify breadth and angle of pen at keypoints:
penpos 1 (0.5b, 30);
penpos 1.5 (b, 15);
penpos 2 (3b, 0);
penpos 3 (5b, -90);
penpos 4 (3b, -180);
penpos 5 (b, 90);
penpos 6 (5b,0);
penpos 6.5 (4b, -30);
penpos 7 (.5b, 0);
penpos 8 (5b, 90);
penpos 9 (3b, -180);
penpos 10 (b, -180);
% Fix x coords of keypoints
x1=0;
x1.5=1/2[x1,x2];
x5=x1=x3=x8;
x10=1/2[x9,x1];
x7=1/2[x3,x4];
x4-x6=w;
x1=1/2[x2,x4];
x3-x2=x2-x6;
x9=1/2[x1,x2];
x6.5=1/2[x5,x6];
% Fix y coords of keypoints
y1=0;
y1.5=y1;
y6=y2=y4=1/2[y3,y1];
y3-y1=y1-y5=1/10h;
y5-y10=2(y3-y1);
y8-y7=y3-y1;
y9=y7;
y8-y3=y3-y10;
y6.5=1/2[y6,y7];
 
drawoptions (withcolor background);
% Draw (an incomplete and ugly) treble clef
penstroke z1e .. z1.5e .. z2e .. z3e .. z4e .. z5e .. z6e .. z6.5e ..
  z7e .. z8e .. z9e .. z10e;
drawoptions(withcolor black);
labels.lft(1,1.5,2,3,4,5,6,6.5,7,8,9,10);
 
  You must take special care never to cross the left and right edges of
  the pen. See The METAFONTbook for details and examples.
 
  Regards,
  Nicola
 
 
 ___
  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
 
 ___
 



 --
 Best Regards
 Chen
 

  Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
 No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
 tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
   | www.sinap.ac.cn
 

 ___
 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

 ___

___
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
___


[NTG-context] How to unfill a picture?

2009-06-23 Thread Zhichu Chen
Hi, I got a problem in metapost. If I want to draw a ring, and
use the code:
fill fullcircle scaled 2cm ;
unfill fullcircle scaled 1cm ;
The inner part is not transparent, it has the color of background
variable which is white by default.

This case is a minimal example, I actually wanna draw something
more complex, like the glyph Q and I know the inner path and
outer path. How can I fill the ring without jeopardizing the area inside
the inner path?

-- 
Best Regards
Chen


  Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
 No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
 tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
   | www.sinap.ac.cn

___
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
___