Link to home
Start Free TrialLog in
Avatar of scrapdog
scrapdogFlag for United States of America

asked on

How FrameRgn works

var
   Rects  :array of TRect;
   Points :array of TPoint;

Rects is an array of rectangles that is filled indirectly by GetRegionData (and stored in the same order as they were found in the RGNDATA structure).

Points is an ordered array of points I will use to draw an outline of the region.  (This array will be identical to the array of points you would pass into CreatePolyPolygonRgn, if you were to create the region that way)

I can't use FrameRgn for two reasons:

1.  FrameRgn really isn't very powerful.  I want to draw marching ants and FrameRgn apparently only draws solid lines.
2.  I am not using the region for the purposes of directly drawing to a device context.

I would like to know the algorithm FrameRgn uses to draw the outline of a region, so I can convert Rects to Points.
Avatar of inthe
inthe

hi scrapdog,
dunno about FrameRgn but i have an example of marching ants if its any help (it doesnt use FrameRgn etc).
Avatar of scrapdog

ASKER

No thanks, got that one figured out. =)
But if your marching ants code takes it's input from a Windows region, that would be very helpful...
nope ,just passes x,y of mouse to lineDDA()
all other examples i have are from tomes which dont look like they help here.

so just listening..
ASKER CERTIFIED SOLUTION
Avatar of FengYuan
FengYuan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In #6, intersecting two lines will create four line segments...how do I know which line segments to discard (i.e., which of these segments are inside the region)?
I think you should only consider tw vertical lines or two horizontal lines intersect with each other.

In these cases, at most two new lines can be generated.
OK, thanks for the info.  I'll try it out.
Excellent.  It worked.  I thought everyone was stumped on this one.