Archived

This topic is now archived and is closed to further replies.

bosjoh

Filling an area.

Recommended Posts

CJ    122
Alright....I don't know if I fully understand what you want, but we'll see about that. I think that you already have a region somewhere (closed ofcourse) that needs to be filled. The best thing to do, and what you probably have, is to use the coordinates of that region.

Alright....the x are your mousecoordinates, i think. Well......Just check that value against the values of every polygon (regions in this example) you have. if the x lays inside the boundaries of your region. Then you save the number of this polygon / region. You stay checking, because there might be another region which could be around the x, and which is smaller than the other.
Alright....then you know which polygon you have to fill. (if two polygons intersect, use a function which makes a polygon of it's own which lays around the x).
And you already know how to fill a polygon i s'pose. Just seek the heighest point, and calculate the slope of the right and left and use that...and so on.

Was that what you meant?

------------------
Dance with me......

Share this post


Link to post
Share on other sites
bosjoh    122
Anyone has a good routine how to fill a region for example:
|\
| \
| \
-\x|
| |
---
I will put my pointer at x and then the area must be filled (like windows paint does when you're filling a region).

Share this post


Link to post
Share on other sites
bosjoh    122
Ah, if I understand it well I should first search for the top of the region and then check around each pixel that has been drawn (by the filling function) if it has hit its boundaries. If not write another pixel.

(I don't completely understand the last message).

Share this post


Link to post
Share on other sites