How do I fill a freeform object with a color

Non-platform specific questions.

How do I fill a freeform object with a color

Postby Just4Fun » Tue Aug 16, 2005 2:10 am

Could someone point me in the right direction regarding the following problem?

Let's say I have an outline of a map of South America.

When a user clicks on , hmm, let' say, Brazil, I would like this country to be filled with a solid color. The problem is, the map area isn't a nice square. Is it possible to fill shaped areas in Game Editor without using animations? TIA :?:
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Fuzzy » Tue Aug 16, 2005 3:45 am

Maybe make three layers of the country and make each one Red Green, and Blue? Then mess with the transparencies.
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Just4Fun » Thu Aug 18, 2005 2:53 am

Maybe make three layers of the country and make each one Red Green, and Blue? Then mess with the transparencies.


Thanks ThreeFingersPete but...
I would like to do these fills using script. I think it would use the setpixel() function along with x,y, but I'm not sure how to approach it. Any ideas?
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Fuzzy » Fri Aug 19, 2005 4:07 am

so you are doing some sort of risk type game? each country needs a color corrosponding to a certain player/AI?
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Just4Fun » Fri Aug 19, 2005 5:19 am

Hi ThreeFingersPete:

are doing some sort of risk type game?


No, I am just curious regarding how to do a non rectangular fill using script... Setting pixel fills can get pretty complicated(at least for my overtaxed brain).

I'd like to figure out the algorithm that would do the job. That way, maybe I could apply it to whatever problem I encountered. When you look at maps, most areas are not rectangular so I thought that using pixels to set the country's color would be a good challenge.

I know it would be a lot easier for me to create animations, but that might slow things down and cause program bloat. I am not a very good programmer, but I really enjoy looking a how to do things and trying to understand...

Thank you for your interest and trying to help... :D
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby jazz_e_bob » Fri Aug 19, 2005 11:10 am

It may be VERY complex.

An interesting challenge.

I can't even think where to begin!

http://www.codeproject.com/gdi/QuickFill.asp

What you want is a "flood fill" algorithm.

There seems to be a few around.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby Just4Fun » Sat Aug 20, 2005 6:23 am

Thank you Jazz,

That is exactly what I was looking for. You are amazing! :shock:
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Crusader » Fri Aug 26, 2005 7:15 pm

ThreeFingerPete wrote:Maybe make three layers of the country and make each one Red Green, and Blue? Then mess with the transparencies.
Visit animationprotector.i8.com
User avatar
Crusader
 
Posts: 49
Joined: Wed Aug 17, 2005 11:15 am
Location: Bulgaria
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest