July 27th, 2003, 06:45 PM
I'm currently working on building a graphics editing app. I was shocked at how fast I was able to pick up the basics of gdi+ but I have come to a point now where the documentaion seems runs too thin (unless it's me being a tad daft - which it probably is).
The simple editor I have writen so far allows you to add elipses, text, rectangles etc to the stage. Once they are there you can move them around etc. The problem I have is trying to find a way of creating a new shape that consits only of the filled area of two or more shapes which have been moved on top of one another. The simplest solution would be to draw them and hittest them togther but this is not what i need. I need someway of actually merging the specific coordinates of the outline path of shapes which overlap.
The best example I can give you is that seen in flash. When you draw an elipse for example, then place a rectangle over it at some point - if the elipse and rectangle are the same color they are merged as one filled shape, if not - the next time you move one of the shapes, they are subtracted from one another.
I thought I'd cracked it by using the Region class which has the methods to do exactly what I want but unfortuantely this introduces new problems. My first idea was to try to get a path object back from the Region class after it was merged but I cant get the points of the Graphics Path back after perfrorming a Union operation on two graphics path objects and therfore I cannot draw the new shape using existing methods in the Graphics object. The next idea was to use the Graphics.fillRegion method but this introduced 2 problems - the first being that I still don't have the merged graphics path so I can't redraw the outline of the shape and the second being the fact that there is no antialiasing with this method so the render output is poor.
Any ideas, comments or suggestions would be greatly appreciated,