View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Filling an area.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1bosjoh  Members

Posted 05 September 1999 - 07:37 PM

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

### #2CJ  Members

Posted 05 September 1999 - 10:13 AM

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

### #3bosjoh  Members

Posted 05 September 1999 - 07:37 PM

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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.