?
Solved

floodfill function that can fill certain area of bufferedimage

Posted on 2003-03-16
6
Medium Priority
?
430 Views
Last Modified: 2008-02-01
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!!
0
Comment
Question by:mac1416
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 8146433
0
 

Author Comment

by:mac1416
ID: 8148232
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
 

Author Comment

by:mac1416
ID: 8148251
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Accepted Solution

by:
CEHJ earned 80 total points
ID: 8151098
>>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
 

Author Comment

by:mac1416
ID: 8151111
it's ok i've finnally written a function that does what i want. thanks for help anyway.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8874775
Well done. Thanks ;-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question