Filling an area.

Started by
1 comment, last by bosjoh 24 years, 7 months ago
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......

Advertisement
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).
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).

This topic is closed to new replies.

Advertisement