floodfill function that can fill certain area of bufferedimage

does anyone know a function that would fill a colour in a BufferedImage like in ms paint the paint bucket. If not function that already does this in Java does anyone no what would do to go about writing one. Just a function that fills colour when given x,y co-ords that would be gotten from mouse click. Just has to work basicly the same as paint bucket in ms paint but in java applet. I've seen some examples on web but can't seem to get to work. I just want function in format of something like floodFill(int x, int y, Color oldColour, Color newColour). please help!!
mac1416Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mac1416Author Commented:
how do i use that to fill a certain area of a picture. I want to be able to use it with any image or drawing user has drawn. How would i write a function that when the user clicks a certain point on the image it fills everything around it that is the same colour as the point clicked and if not doesnt fill that pixel.
0
mac1416Author Commented:
how whould I get the shape of the area to be filled so i could use public abstract void fill(Shape s)? if thats possible.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

CEHJCommented:
>>How would i write a function that when the user clicks a certain point on the image it fills everything around it that is the same colour as the point clicked and

Not sure off-hand. I've never seen that functionality in a graphics program btw.

>>how whould I get the shape of the area to be filled

You'd have to define that shape in some way. In graphics packages, this is normally done with selection.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mac1416Author Commented:
it's ok i've finnally written a function that does what i want. thanks for help anyway.
0
CEHJCommented:
Well done. Thanks ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.