buglibgraph - Bugs: bug #12082, FloodFill goes into infinite...

 
 

bug #12082: FloodFill goes into infinite recursion

Submitted by:  None
Submitted on:  Mon 21 Feb 2005 10:49:29 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Faraz Shahbazker <farazs>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 21 Feb 2005 10:49:29 PM UTC, original submission:

/* Flood Fill Algo */
/* 4 point Implementaiton */

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>

flood(seed_x, seed_y, foreground_col,background_col) {

if(getpixel(seed_x, seed_y) != background_col &&
getpixel(seed_x, seed_y) != foreground_col)
{
putpixel(seed_x, seed_y, foreground_col);
flood(seed_x + 1, seed_y, foreground_col, background_col);
flood(seed_x - 1, seed_y, foreground_col, background_col);
flood(seed_x, seed_y + 1, foreground_col, background_col);
flood(seed_x, seed_y - 1, foreground_col, background_col);
flood(seed_x + 1, seed_y + 1, foreground_col, background_col);
flood(seed_x - 1, seed_y - 1, foreground_col, background_col);
flood(seed_x + 1, seed_y - 1, foreground_col, background_col);
flood(seed_x - 1, seed_y + 1, foreground_col, background_col);
}
return 0;
}
main() {
int gd,gm;

detectgraph(&gd,&gm);
initgraph(&gd,&gm,"");

rectangle(50,50,100,100);
flood(55,55,4,15);
getch();
closegraph();
return 0;
}

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Wed 05 Apr 2006 07:03:41 PM UTCfarazsStatusNone=>Fixed
  Open/ClosedOpen=>Closed
Mon 12 Dec 2005 11:13:59 AM UTCfarazsAssigned toNone=>farazs

Back to the top


Powered by Savane 3.1-cleanup1