HighTechTalks DotNet Forums  

Path union

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss Path union in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Fabio
 
Posts: n/a

Default Path union - 02-11-2007 , 06:27 AM






Hi again

Is it possible to join 2 GraphicsPath into a single one?
I need a union of more pathes without the inner lines, i.e. if I have 2
ellipse that overlaps I'd like to have just the outlines of both (I hope I
was clear )

Thanks.



Reply With Quote
  #2  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Path union - 02-11-2007 , 08:20 AM






You can add one path to another, optionally with the possibility of adding
the new path to the last figure in the old path.

You cannot perform logical operations such as union, exclusion etc on paths.
You can however perform these functions on regions.

It depends if you're interested in the outline of the path or the fill area
how useful this would be.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Fabio" <znt.fabio (AT) virgilio (DOT) it> wrote

Quote:
Hi again

Is it possible to join 2 GraphicsPath into a single one?
I need a union of more pathes without the inner lines, i.e. if I have 2
ellipse that overlaps I'd like to have just the outlines of both (I hope I
was clear )

Thanks.




Reply With Quote
  #3  
Old   
Fabio
 
Posts: n/a

Default Re: Path union - 02-11-2007 , 09:27 AM



"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> ha scritto nel messaggio
news:%


Quote:
It depends if you're interested in the outline of the path or the fill
area how useful this would be.
Yes, I would like only the border to be traced by a pen
Ok, other question: I can join 2 path with Path1.AddPath(Path2, connect).
When I do Path1.Dispose() this will dispose alse the Path2, right?
I don't want to trace each path I add...

Thanks again.




Reply With Quote
  #4  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Path union - 02-11-2007 , 11:07 AM



The connect will simply try to add the path to the figure in the end of the
figure list. It doesn't do much in the way of intelligent merging of the
data. so you won't be able to draw just the outline.

Adding the path only adds the data. Path 2 will still exist and it's still
your responsibility to dispose of the path when you're done with it.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Fabio" <znt.fabio (AT) virgilio (DOT) it> wrote

Quote:
"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> ha scritto nel
messaggio news:%



It depends if you're interested in the outline of the path or the fill
area how useful this would be.

Yes, I would like only the border to be traced by a pen
Ok, other question: I can join 2 path with Path1.AddPath(Path2, connect).
When I do Path1.Dispose() this will dispose alse the Path2, right?
I don't want to trace each path I add...

Thanks again.




Reply With Quote
  #5  
Old   
Fabio
 
Posts: n/a

Default Re: Path union - 02-11-2007 , 11:45 AM



"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> ha scritto nel messaggio

Quote:
The connect will simply try to add the path to the figure in the end of
the figure list. It doesn't do much in the way of intelligent merging of
the data. so you won't be able to draw just the outline.

Adding the path only adds the data. Path 2 will still exist and it's still
your responsibility to dispose of the path when you're done with it.
Ah, ok.
So if I do:

Path1 = new GraphicsPath();
....
temp = new GraphicsPath();
Path1.AddPath(temp, connect);
temp.Dispose();

This is correct.
Right?





Reply With Quote
  #6  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Path union - 02-11-2007 , 12:21 PM



yup...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





Fabio wrote:
Quote:
"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> ha scritto nel messaggio

The connect will simply try to add the path to the figure in the end of
the figure list. It doesn't do much in the way of intelligent merging of
the data. so you won't be able to draw just the outline.

Adding the path only adds the data. Path 2 will still exist and it's still
your responsibility to dispose of the path when you're done with it.

Ah, ok.
So if I do:

Path1 = new GraphicsPath();
...
temp = new GraphicsPath();
Path1.AddPath(temp, connect);
temp.Dispose();

This is correct.
Right?




Reply With Quote
  #7  
Old   
Fabio
 
Posts: n/a

Default Re: Path union - 02-11-2007 , 01:38 PM



"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> ha scritto nel messaggio
news:%

Quote:
You cannot perform logical operations such as union, exclusion etc on
paths. You can however perform these functions on regions.

Ok, I found a little workaround for this: just set the Path.FillMode to
Winding, but you need to fill the path with a non trasparent color to cover
internal bounds





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.