Re: [NTG-context] metapost fill between outlines
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.500000) ..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.250000) 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.750000) 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
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.
On Mon, Feb 21, 2011 at 10:09, 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?
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
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
participants (3)
-
Hongwen Qiu
-
Mojca Miklavec
-
Reviczky, Adam