Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: View/sniff HTTP packets from browser to Web server Pin
nguyenvhn15-Aug-06 17:36
nguyenvhn15-Aug-06 17:36 
GeneralRe: View/sniff HTTP packets from browser to Web server Pin
Robert Palma Jr.17-Aug-06 6:10
Robert Palma Jr.17-Aug-06 6:10 
QuestionDatabase problem Pin
ivanris15-Aug-06 10:49
ivanris15-Aug-06 10:49 
AnswerRe: Database problem Pin
David Crow16-Aug-06 3:41
David Crow16-Aug-06 3:41 
GeneralRe: Database problem Pin
ivanris17-Aug-06 8:57
ivanris17-Aug-06 8:57 
GeneralRe: Database problem Pin
David Crow17-Aug-06 9:10
David Crow17-Aug-06 9:10 
QuestionHelp me to create a DC function: FillRgn() for Win98 Pin
includeh1015-Aug-06 6:45
includeh1015-Aug-06 6:45 
AnswerRe: Help me to create a DC function: FillRgn() for Win98 Pin
Chris Losinger15-Aug-06 9:58
professionalChris Losinger15-Aug-06 9:58 
the standard brute-force flood-fill algorithm is:

floodfill(x, y)
{
  if (pixel(x,y)==searchColor) 
  {
     paint(x,y,fillColor)

     floodfill(x+1, y+1)
     floodfill(x+1, y-1)
     floodfill(x-1, y+1)
     floodfill(x-1, y-1)
  }
}


(even better, use a stack to eliminate the recursion - just push the 4 points onto the stack instead of doing the recursion, then loop and pop)

a patterned fill would replace paint(...) with a function to copy a pixel from the brush to the output pixelout = pixelBrush(x % brushW, y % brushH).

the fact that your brush could contain 'targetColor' complicates things, however - the standard algorithm would loop forever if you painted the output pixel the same color as the search color. one way to handle this would be to make a copy of your source image and do the standard floodfill on it, in memory, while also doing the patterned fill on the original image:

if (pixel(x,y)==searchColor) 
{
paint(x,y,fillColor)
patternpaint_output_image(x,y)
...
}


if memory is an issue, you could use a monochrome/grayscale 'mask' image for the copy - set all searchColor pixels set to 0 and all others to 1. then do the standard floodfill on that image, while also putting brush pixels on your output image.

and, for speed, you'll need to do this on the actual pixels (with a DIB), and not using DC functions.



QuestionC++ General Question Pin
NitinPatil15-Aug-06 5:56
NitinPatil15-Aug-06 5:56 
AnswerRe: C++ General Question Pin
Steve S15-Aug-06 6:11
Steve S15-Aug-06 6:11 
AnswerRe: C++ General Question Pin
led mike15-Aug-06 7:25
led mike15-Aug-06 7:25 
AnswerRe: C++ General Question Pin
Zac Howland15-Aug-06 9:30
Zac Howland15-Aug-06 9:30 
AnswerRe: C++ General Question Pin
Rilhas15-Aug-06 12:21
Rilhas15-Aug-06 12:21 
Questionhow i can send text to external program Pin
shortwave15-Aug-06 5:07
shortwave15-Aug-06 5:07 
QuestionRe: how i can send text to external program Pin
David Crow15-Aug-06 5:15
David Crow15-Aug-06 5:15 
AnswerRe: how i can send text to external program Pin
ms.linuz15-Aug-06 17:27
ms.linuz15-Aug-06 17:27 
AnswerRe: how i can send text to external program Pin
ensger16-Aug-06 2:45
ensger16-Aug-06 2:45 
GeneralRe: how i can send text to external program Pin
Hamid_RT16-Aug-06 5:07
Hamid_RT16-Aug-06 5:07 
QuestionRe: how i can send text to external program Pin
Hamid_RT16-Aug-06 5:07
Hamid_RT16-Aug-06 5:07 
AnswerRe: how i can send text to external program Pin
shortwave19-Aug-06 3:08
shortwave19-Aug-06 3:08 
QuestionHas a DLL been renamed? Pin
D G McKay15-Aug-06 4:50
D G McKay15-Aug-06 4:50 
QuestionDestroying window with popup menu Pin
Johniteq15-Aug-06 4:27
Johniteq15-Aug-06 4:27 
AnswerRe: Destroying window with popup menu Pin
Maximilien15-Aug-06 4:59
Maximilien15-Aug-06 4:59 
GeneralRe: Destroying window with popup menu Pin
Johniteq16-Aug-06 1:37
Johniteq16-Aug-06 1:37 
AnswerRe: Destroying window with popup menu Pin
Michael Dunn15-Aug-06 13:12
sitebuilderMichael Dunn15-Aug-06 13:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.