Groups | Blog | Home
all groups > dotnet drawing api > december 2003 >

dotnet drawing api : Wrap a GraphicsPath around a square draw area


Crirus
12/29/2003 10:49:59 AM
Hello

I have a square area to draw on...
I have a GraphicsPath that define the region of clipping so the draw occur
only on that region
The region is one or more circles
The problem I'm facing with is drawing a wraped region...
I can have one circle falling outside one side of the drawing surface
What I need is adding a new drawing area on the opposite side(s) of the
drawing surface so the impresion should be like the circle get out on a side
and reenter the other

Can this be done somehow?

Thanks,
Crirus


JHornick NO[at]SPAM online.microsoft.com
12/29/2003 6:17:19 PM
Hi,

Do the math. Intersect two circles with your rectangular region - one
circle on one side of the region, centered so that part of it is off that
side, and the other circle on the other side of the region, appropriately
centered so that the "remaining" part of the circle intersects the region.

Thanks,
- John
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.



[quoted text, click to view]
James Westgate (Crainiate)
12/30/2003 11:09:36 AM
Assume you are drawing onto a panel control and wrapping on the xaxis only

1. Create a graphicspath from your cicrcles etc
2. Translate the origin using graphics.TranslateTransform to -panel.width,0
3. Draw the path again
4. Reset the transform

I guess follow the same steps to wrap on the y-axis as well. Let us know if
that works

James

--
Create interactive flowcharts, diagrams and UML models with ERM3 at
http://www.crainiate.net


[quoted text, click to view]

Crirus
12/30/2003 12:04:57 PM
Yeah but I dont have any ideea wich circle fall off...I can have many of
them randomly displaced
I need an algorithm to do that dinamicaly


[quoted text, click to view]

Crirus
12/30/2003 12:13:07 PM
I have an ideea.. test each circle (location - radius) to see if is less
than 0 or bigger than width and translate the center apropiately and add the
translated circle to the path ..

:)


[quoted text, click to view]

Crirus
12/30/2003 2:16:54 PM
It may work but when I have some circles only inside the draw area, that
extra draw is redundant... it is not in visible area..so I think the best
way is to test each circle (origin+radius) if fall off the margins and if it
does, I just need to add the circle translated a with and/or height of
drawing surface... so the missing part will be added on hte opposite visible
part


[quoted text, click to view]

Crirus
12/30/2003 2:19:27 PM
I whould like to have such flag in NET that can wrap a region around drawing
area :)

[quoted text, click to view]

AddThis Social Bookmark Button