Re: [NTG-context] metapost fill between outlines

2011-02-21 Thread Reviczky, Adam
The only letter (g) I have left in the logo has two spaces that I want to cut 
out.
I can't make a single path out of it so that it doesn't go through the entire 
letter, so what to do in this case?

Here's the example:
%%%
\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path gb[],gf[],gc[];

gb1 := (100.023003,46.691399)..controls (100.023003,47.015598) and 
(100.348000,47.203098)..(100.969002,47.203098)
..controls (101.859001,47.203098) and 
(101.859001,46.855499)..(102.371002,46.855499)
..controls (102.695000,46.855499) and 
(102.991997,47.015598)..(102.991997,47.582001)
..controls (102.991997,48.066399) and 
(102.530998,48.230499)..(102.101997,48.230499)
..controls (101.616997,48.230499) and 
(100.996002,48.093800)..(100.348000,47.664101)
..controls (100.188004,47.527302) and 
(99.781197,47.339802)..(99.539101,47.50)
..controls (99.027298,47.851601) and 
(98.570297,48.093800)..(97.355499,48.093800)
..controls (96.144501,48.093800) and 
(94.363297,47.367199)..(93.230499,45.828098)
..controls (92.421898,44.695301) and 
(92.261703,43.886700)..(92.261703,43.078098)
..controls (92.261703,42.269501) and 
(92.585899,41.675800)..(92.828102,41.355499)
..controls (92.878899,41.273399) and 
(92.906197,41.218800)..(92.906197,41.136700)
..controls (92.906197,40.949200) and 
(92.664101,40.812500)..(92.261703,40.707001)
..controls (91.531197,40.464802) and 
(90.320297,39.761700)..(90.320297,38.523399)
..controls (90.320297,37.714802) and 
(90.964798,36.933601)..(91.695297,36.445301)
..controls (91.695297,36.445301) and 
(90.210899,36.042999)..(89.023399,35.394501)
..controls (88.109398,34.882801) and 
(87.082001,34.101601)..(87.082001,32.968800)
..controls (87.082001,31.675800) and 
(88.191399,29.570299)..(92.746101,29.570299)
..controls (95.414101,29.570299) and 
(97.085899,30.539101)..(97.734398,31.269501)
..controls (98.218803,31.835899) and 
(98.296898,32.484402)..(98.296898,32.886700)
..controls (98.296898,34.343800) and 
(96.683601,35.718800)..(94.902298,36.687500)
..controls (93.769501,37.335899) and 
(92.097702,38.117199)..(92.097702,39.277302)
..controls (92.097702,39.574200) and 
(92.179703,39.898399)..(92.503899,40.085899)
..controls (92.718803,40.25) and 
(93.070297,40.328098)..(93.445297,40.328098)
..controls (93.957001,40.328098) and 
(94.605499,40.167999)..(95.066399,40.167999)
..controls (96.519501,40.167999) and 
(98.488297,40.652302)..(99.703102,43.242199)
..controls (100.023003,43.968800) and 
(100.160004,44.695301)..(100.160004,45.316399)
..controls (100.160004,46.125000) and 
(100.023003,46.316399)..(100.023003,46.691399)
--cycle;
drawdot (100.023003,46.691399) withcolor blue withpen pencircle scaled 2pt;

gf2 := (92.960899,30.351601)..controls (89.968803,30.351601) and 
(89.078102,32.078098)..(89.078102,32.941399)
..controls (89.078102,33.75) and 
(89.402298,34.261700)..(90.210899,34.828098)
..controls (90.777298,35.234402) and 
(91.613297,35.636700)..(92.261703,35.878899)
..controls (92.988297,35.558601) and 
(94.093803,34.910198)..(94.445297,34.585899)
..controls (96.062500,33.453098) and 
(96.386703,32.808601)..(96.386703,32.242199)
..controls (96.386703,30.703100) and 
(94.093803,30.351601)..(92.960899,30.351601)
--cycle;
drawdot (92.960899,30.351601) withcolor green withpen pencircle scaled 2pt;

gf1 := (98.867203,46.367199)..controls (98.867203,45.585899) and 
(98.570297,44.535198)..(97.894501,43.402302)
..controls (96.628899,41.355499) and 
(95.628899,40.949200)..(94.769501,40.949200)
..controls (94.039101,40.949200) and 
(93.714798,41.542999)..(93.714798,42.406200)
..controls (93.714798,43.160198) and 
(94.039101,44.132801)..(94.605499,45.019501)
..controls (95.468803,46.394501) and 
(96.683601,47.527302)..(97.761703,47.527302)
..controls (98.488297,47.527302) and 
(98.867203,47.175800)..(98.867203,46.367199)
--cycle;
drawdot (98.867203,46.367199) withcolor yellow withpen pencircle scaled 2pt;

gc1 := gb1 -- gf1 -- cycle;
gc2 := gc1 -- gf2 -- cycle;
fill gc2;
\stopMPcode
}
\stoptext
%%%

How do I get rid of the crossing line?

Adam
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-21 Thread Hongwen Qiu

On 02/21/2011 05:09 PM, Reviczky, Adam wrote:

The only letter (g) I have left in the logo has two spaces that I want to cut 
out.
I can't make a single path out of it so that it doesn't go through the entire 
letter, so what to do in this case?
Can't you construct four outlines instead of three, so that you can 
construct two paths for filling. Hope you understand what I mean.

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-21 Thread Mojca Miklavec
On Mon, Feb 21, 2011 at 10:09, Reviczky, Adam adam.revic...@kcl.ac.uk wrote:
 The only letter (g) I have left in the logo has two spaces that I want to 
 cut out.
 I can't make a single path out of it so that it doesn't go through the entire 
 letter, so what to do in this case?

Just as a thought ... what you currently do with metapost at the
moment is a bit of cheating to overcome lack of a feature in metapost
- there is still an infinitely thin line between segments and a dumb
renderer might display artifacts.

If I wanted to draw a logo (very important graphic that will be used
more often) and if I had control points, I would consider creating a
raw postscript (EPS) graphics (filling with even-odd rule), convert it
to PDF when needed and then use it inside ConTeXt documents (or even
inside metapost graphics) as-is.

You could also manually post-process the graphic generated by metapost
(removing the link between the inner and outer part of letters and
properly fill).

But if the current approach is fine with you ... just use it.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-21 Thread Reviczky, Adam
 Just as a thought ... what you currently do with metapost at the
 moment is a bit of cheating to overcome lack of a feature in metapost
 - there is still an infinitely thin line between segments and a dumb
 renderer might display artifacts.
Yes, I am aware of this, just wanted to hear something from those who know 
metapost better.

 If I wanted to draw a logo (very important graphic that will be used
 more often) and if I had control points, I would consider creating a
 raw postscript (EPS) graphics (filling with even-odd rule), convert it
 to PDF when needed and then use it inside ConTeXt documents (or even
 inside metapost graphics) as-is.
I'm doing something like that already, I was just curious to which extend I 
could use metapost for this.

 You could also manually post-process the graphic generated by metapost
 (removing the link between the inner and outer part of letters and
 properly fill).
 But if the current approach is fine with you ... just use it.
I think I'm happy with this solution. (Also, I was looking at the graphictext 
function, isn't that also doing similar things for filling out letters?)

 Mojca
Thanks for explaining this!

Adam
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-20 Thread Hongwen Qiu

On 02/20/2011 04:25 PM, Reviczky, Adam wrote:

As a workaround I fill out the bigger one with color black and the smaller one 
with color white, but I need to put this on different background colors, so the 
use of this is very limited.

You can fill out the bigger one, than clips the smaller one.
And alternately, you can construct the path of the difference out of the 
two circles, and fill the constructed path.

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-20 Thread Reviczky, Adam
 You can fill out the bigger one, than clips the smaller one.
Can you give me an example with the clip? I can't get it work in a way I want 
to have it.
I've found another thread here: 
http://www.tug.org/pipermail/metapost/2006-September/000650.html
But I fail to see the conclusion there too.

 And alternately, you can construct the path of the difference out of the 
 two circles, and fill the constructed path.
As for the path of the difference, how do you mean that? Example?

Adam
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-20 Thread Hongwen Qiu

On 02/21/2011 03:52 AM, Reviczky, Adam wrote:

As for the path of the difference, how do you mean that? Example?

\startMPpage
path p ;
p := fullcircle scaled 1cm ;
path q ;
q := fullcircle scaled .5cm ;
path r ;
r := p -- reverse q -- cycle ;
drawarrow r withcolor green ;
fill r withcolor red ;
\stopMPpage

This works here.
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-20 Thread Reviczky, Adam
 \startMPpage
 path p ;
 p := fullcircle scaled 1cm ;
 path q ;
 q := fullcircle scaled .5cm ;
 path r ;
 r := p -- reverse q -- cycle ;
 drawarrow r withcolor green ;
 fill r withcolor red ;
 \stopMPpage
 
 This works here.
Based on this I can now cut out the smaller one from a fullcircle, but it still 
fails with two paths having controls (or maybe because of something else).

Here are the examples:
%%%
\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path p[];
p1 := fullcircle scaled 2cm;

p2 := (7.488280,12.293000)..controls (4.933590,12.293000) and 
(1.265620,6.226560)..(1.265620,2.531250)..controls (1.265620,1.562500) and 
(1.695310,0.835938)..(2.722660,0.835938)..controls (5.230470,0.835938) and 
(8.972660,7.035160)..(8.972660,10.296900)..controls (8.972660,11.269500) and 
(8.703120,12.293000)..(7.488280,12.293000)--cycle;

p3 := p1 -- reverse p2 -- cycle;
fill p3 withcolor black;
\stopMPcode
}
\stoptext
%%%
This works.

%%%
\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path p[];
p1 := (6.949220,13.046900)..controls (9.539060,13.046900) and 
(10.023400,10.781200)..(10.023400,8.679690)..controls (10.023400,5.335940) and 
(6.949220,0.00)..(3.234380,0.00)..controls (0.890625,0.00) and 
(0.00,1.886720)..(0.00,3.828120)..controls (0.00,8.492190) and 
(3.316410,13.046900)..(6.949220,13.046900) --cycle;

p2 := (7.488280,12.293000)..controls (4.933590,12.293000) and 
(1.265620,6.226560)..(1.265620,2.531250)..controls (1.265620,1.562500) and 
(1.695310,0.835938)..(2.722660,0.835938)..controls (5.230470,0.835938) and 
(8.972660,7.035160)..(8.972660,10.296900)..controls (8.972660,11.269500) and 
(8.703120,12.293000)..(7.488280,12.293000)--cycle;

p3 := p1 -- reverse p2 -- cycle;
fill p3 withcolor black;
\stopMPcode
}
\stoptext
%%%
This doesn't work.
(It fails already if p1 := (0,0)..(0,20)..(20,20)..cycle; or similar.)
Any hints?

Adam
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-20 Thread Hongwen Qiu

On 02/21/2011 01:12 PM, Reviczky, Adam wrote:

\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path p[];
p1 := (6.949220,13.046900)..controls (9.539060,13.046900) and 
(10.023400,10.781200)..(10.023400,8.679690)..controls (10.023400,5.335940) and 
(6.949220,0.00)..(3.234380,0.00)..controls (0.890625,0.00) and 
(0.00,1.886720)..(0.00,3.828120)..controls (0.00,8.492190) and 
(3.316410,13.046900)..(6.949220,13.046900) --cycle;

p2 := (7.488280,12.293000)..controls (4.933590,12.293000) and 
(1.265620,6.226560)..(1.265620,2.531250)..controls (1.265620,1.562500) and 
(1.695310,0.835938)..(2.722660,0.835938)..controls (5.230470,0.835938) and 
(8.972660,7.035160)..(8.972660,10.296900)..controls (8.972660,11.269500) and 
(8.703120,12.293000)..(7.488280,12.293000)--cycle;

p3 := p1 -- reverse p2 -- cycle;
fill p3 withcolor black;
\stopMPcode
}
\stoptext
%%%
This doesn't work.

\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path p[];
p1 := (6.949220,13.046900)..controls (9.539060,13.046900) and 
(10.023400,10.781200)..(10.023400,8.679690)..controls 
(10.023400,5.335940) and 
(6.949220,0.00)..(3.234380,0.00)..controls (0.890625,0.00) 
and (0.00,1.886720)..(0.00,3.828120)..controls 
(0.00,8.492190) and (3.316410,13.046900)..(6.949220,13.046900) --cycle;


p2 := (7.488280,12.293000)..controls (4.933590,12.293000) and 
(1.265620,6.226560)..(1.265620,2.531250)..controls (1.265620,1.562500) 
and (1.695310,0.835938)..(2.722660,0.835938)..controls 
(5.230470,0.835938) and 
(8.972660,7.035160)..(8.972660,10.296900)..controls (8.972660,11.269500) 
and (8.703120,12.293000)..(7.488280,12.293000)--cycle;


drawarrow p1 withcolor green ;
drawarrow p2 withcolor blue ;
p3 := p1 -- p2 -- cycle;
fill p3 withcolor black;
\stopMPcode
}
\stoptext

Maybe you can know why now, from the above code. The direction of the 
path is important.

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-20 Thread Reviczky, Adam
 Maybe you can know why now, from the above code. The direction of the 
 path is important.
I get it now, thanks for your help!
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-20 Thread Reviczky, Adam
So with this method, I can cut out some fillings of letters in a logo,
but for this example it draws a small line through the letter:

%%%
\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path db[],df[],dc[];

drawoptions (withcolor (0.00,0.329412,0.560784));
db1 := (86.812500,0.519531)--(92.457001,0.519531)--(92.457001,32.386700)
--(86.812500,32.386700)--(86.812500,19.679701)--(86.722702,19.679701)
..controls (85.390602,21.589800) and 
(82.816399,22.718800)..(79.929703,22.718800)
..controls (73.976601,22.718800) and 
(69.800797,17.253901)..(69.800797,11.617200)
..controls (69.800797,4.683590) and 
(73.664101,0.00)..(79.484398,0.00)
..controls (82.949203,0.00) and 
(85.257797,1.820310)..(86.722702,3.640620)
--(86.812500,3.640620)--cycle;

df1 := (81.437500,19.246099)..controls (84.992203,19.246099) and 
(86.812500,15.734400)..(86.812500,11.964800)
..controls (86.812500,7.625000) and 
(85.128899,3.464840)..(81.171898,3.464840)
..controls (77.753899,3.464840) and 
(76.062500,7.542970)..(76.062500,11.746100)
..controls (76.062500,15.953100) and 
(77.621101,19.246099)..(81.437500,19.246099)
--cycle;

draw db1; draw df1;
dc1 := db1 -- df1 -- cycle;
fill dc1;
\stopMPcode
}
\stoptext
%%%

Can this be solved somehow?

Adam
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost fill between outlines

2011-02-20 Thread Hongwen Qiu

On 02/21/2011 02:41 PM, Reviczky, Adam wrote:

but for this example it draws a small line through the letter:

\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path db[],df[],dc[];

drawoptions (withcolor (0.00,0.329412,0.560784));
db1 := (86.812500,0.519531)--(92.457001,0.519531)--(92.457001,32.386700)
--(86.812500,32.386700)--(86.812500,19.679701)--(86.722702,19.679701)
..controls (85.390602,21.589800) and 
(82.816399,22.718800)..(79.929703,22.718800)
..controls (73.976601,22.718800) and 
(69.800797,17.253901)..(69.800797,11.617200)
..controls (69.800797,4.683590) and 
(73.664101,0.00)..(79.484398,0.00)
..controls (82.949203,0.00) and 
(85.257797,1.820310)..(86.722702,3.640620)

--(86.812500,3.640620)--cycle;

df1 := (81.437500,19.246099)..controls (84.992203,19.246099) and 
(86.812500,15.734400)..(86.812500,11.964800)
..controls (86.812500,7.625000) and 
(85.128899,3.464840)..(81.171898,3.464840)
..controls (77.753899,3.464840) and 
(76.062500,7.542970)..(76.062500,11.746100)
..controls (76.062500,15.953100) and 
(77.621101,19.246099)..(81.437500,19.246099)

--cycle;

dc1 := db1 -- df1 -- cycle;
fill dc1;
drawdot (86.812500,0.519531) withcolor blue withpen pencircle scaled 2pt;
drawdot (81.437500, 19.246099) withcolor green withpen pencircle scaled 2pt;
drawarrow db1 withcolor green; drawarrow df1 withcolor blue;
drawarrow dc1 withcolor white;
\stopMPcode
}
\stoptext

The above code is just intend to tell you that you can change the way 
you construct db1 and df1 to achieve your desired results. The actual 
changes necessary to this example are not given.

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___