1. RE: Win32Lib API Floodfill?

cklester wrote:
> 
> 
> posted by: cklester <cklester at yahoo.com>
> 
> Don wrote:
> > 
> > Dont know if this would interest you, but GDI has a flood fill.
> > API: ExtFloodFill
> 
> Yeah, it does interest me 'cuz I was lookin' for that in
> msimg.dll. heh. :)
> 
> -=ck
> "Programming in a state of EUPHORIA."
> http://www.cklester.com/euphoria/

Are you looking to flood to a border of a specified color or flood one 
color to another color?

-- Brian

new topic     » topic index » view message » categorize

2. RE: Win32Lib API Floodfill?

Brian Broker wrote:
> cklester wrote:
> > posted by: cklester <cklester at yahoo.com>
> > Don wrote:
> > > Dont know if this would interest you, but GDI has a flood fill.
> > > API: ExtFloodFill
> > Yeah, it does interest me 'cuz I was lookin' for that in
> > msimg.dll. heh. :)
> 
> Are you looking to flood to a border of a specified color or flood one 
> color to another color?

To a border... It's a black background with an object drawn in pink. I
want to fill the interior of that object (which can be any enclosed
shape, regular or irregular).

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

3. RE: Win32Lib API Floodfill?

cklester wrote:
> 
> 
> posted by: cklester <cklester at yahoo.com>
> 
> Brian Broker wrote:
> > cklester wrote:
> > > posted by: cklester <cklester at yahoo.com>
> > > Don wrote:
> > > > Dont know if this would interest you, but GDI has a flood fill.
> > > > API: ExtFloodFill
> > > Yeah, it does interest me 'cuz I was lookin' for that in
> > > msimg.dll. heh. :)
> > 
> > Are you looking to flood to a border of a specified color or flood one 
> > color to another color?
> 
> To a border... It's a black background with an object drawn in pink. I
> want to fill the interior of that object (which can be any enclosed
> shape, regular or irregular).
> 
> -=ck
> "Programming in a state of EUPHORIA."
> http://www.cklester.com/euphoria/

OK, I've updated my floodfill code and separated it into 2 functions:
floodFillSurface and floodFillBorder.  demo2.exw should help you.

Get it from http://cnw.com/~bkb/Eu/floodfill.zip

-- Brian

new topic     » goto parent     » topic index » view message » categorize

4. RE: Win32Lib API Floodfill?

Brian Broker wrote:
> 
> OK, I've updated my floodfill code and separated it into 2 functions:
> floodFillSurface and floodFillBorder.  demo2.exw should help you.
> 
> Get it from <a
> href="http://cnw.com/~bkb/Eu/floodfill.zip">http://cnw.com/~bkb/Eu/floodfill.zip</a>

That's a beaut, Brian. I'm sure it's going to work. I'll try it out
at home tonight. :)


-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

5. RE: Win32Lib API Floodfill?

> > > Dont know if this would interest you, but GDI has a flood fill.
> > > API: ExtFloodFill
> > 
> > Yeah, it does interest me 'cuz I was lookin' for that in
> > msimg.dll. heh. :)
> > 
> > -=ck
> > "Programming in a state of EUPHORIA."
> > <a
> > href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
> 
> Are you looking to flood to a border of a specified color or flood one 
> color to another color?

Just an FYI.  Im am sure Brians routine will suffice.  If you still need
the API ExtFloodFill from GDI.dll, it will also do both of these by setting
the fuFillType parameter:

FLOODFILLBORDER -
The fill area is bounded by the color specified by the crColor parameter.
This style is identical to the filling performed by the FloodFill function.

FLOODFILLSURFACE -
The fill area is defined by the color that is specified by crColor. Filling
continues outward in all directions as long as the color is encountered. This
style is useful for filling areas with multicolored boundaries.


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

new topic     » goto parent     » topic index » view message » categorize

6. RE: Win32Lib API Floodfill?

Don wrote:
> 
> 
> posted by: Don <eunexus at yahoo.com>
> 
> > > > Dont know if this would interest you, but GDI has a flood fill.
> > > > API: ExtFloodFill
> > > 
> > > Yeah, it does interest me 'cuz I was lookin' for that in
> > > msimg.dll. heh. :)
> > > 
> > > -=ck
> > > "Programming in a state of EUPHORIA."
> > > <a 
> > >
> > > href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
> > > 
> > 
> > Are you looking to flood to a border of a specified color or flood one 
> > color to another color?
> 
> Just an FYI.  Im am sure Brians routine will suffice.  If you still need
> the API ExtFloodFill from GDI.dll, it will also do both of these by 
> setting
> the fuFillType parameter:
> 
> FLOODFILLBORDER -
> The fill area is bounded by the color specified by the crColor 
> parameter.
> This style is identical to the filling performed by the FloodFill 
> function.
> 
> FLOODFILLSURFACE -
> The fill area is defined by the color that is specified by crColor. 
> Filling
> continues outward in all directions as long as the color is encountered. 
> This
> style is useful for filling areas with multicolored boundaries.
> 
> 
> Don Phillips - aka Graebel
>      National Instruments
>      mailto: eunexus @ yahoo.com

Uhmmm... yeah.  That's what it is... a wrapper for ExtFloodFill (for 
Win32Lib).  It's just not exactly the most straightforward thing to wrap 
and get working properly.

-- Brian

new topic     » goto parent     » topic index » view message » categorize

7. RE: Win32Lib API Floodfill?

Brian Broker wrote:
> 
> OK, I've updated my floodfill code and separated it into 2 functions:
> floodFillSurface and floodFillBorder.  demo2.exw should help you.

Brian, should this work on pixmaps? It doesn't seem to be working
for me on those. I can get it to fill a window, though...

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

8. RE: Win32Lib API Floodfill?

cklester wrote:
> 
> Brian, should this work on pixmaps? It doesn't seem to be working
> for me on those. I can get it to fill a window, though...

Update. Here's what I have... a pixmap with two colors on it, either
black or pink. If i click on a pink area, it will fill with black. if
i click on a black area, it will not fill with pink. Why?!?! :)

Here's the relevant code... I don't think it's wrong.

x = pos[1] -- get mouse position
y = pos[2]
c = getPixel(pixMask,x,y) -- check color
if c = Black then
   c = Pink -- paint pink on black
else
   c = Black -- paint black on pink
end if
floodFillSurface(pixMask,x,y,c)
draw_Bitmap()

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

9. RE: Win32Lib API Floodfill?

cklester wrote:
> 
> cklester wrote:
> > 
> > Brian, should this work on pixmaps? It doesn't seem to be working
> > for me on those. I can get it to fill a window, though...
> 
> Update. Here's what I have... a pixmap with two colors on it, either
> black or pink. If i click on a pink area, it will fill with black. if
> i click on a black area, it will not fill with pink. Why?!?! :)
> 
> Here's the relevant code... I don't think it's wrong.
> 
> x = pos[1] -- get mouse position
> y = pos[2]
> c = getPixel(pixMask,x,y) -- check color
> if c = Black then
>    c = Pink -- paint pink on black
> else
>    c = Black -- paint black on pink
> end if
> floodFillSurface(pixMask,x,y,c)
> draw_Bitmap()

I haven't looked at Brian's code but I guess its a wrapper for the 
ExtFloodFill API call. In which case, the 'c' value is not the color
you WANT to flood that area with, but the color which you want to change. 

Try this instead...

 x = pos[1] -- get mouse position
 y = pos[2]
 s = getPixel(pixMask,x,y) -- check color
 if s = Black then
    c = Pink -- paint pink on black
 else
    c = Black -- paint black on pink
 end if
 setPenColor(pixMask, c)
 -- I assume that Brian's code creates a brush using createBrush().
 floodFillSurface(pixMask,x,y,s)
 draw_Bitmap()


Anyhow, I have floodfill working in win32lib now. I'm tidying up
some documentation now and will release it this weekend.

If you were using the new floodFill() routine it would look like ...

 x = pos[1] -- get mouse position
 y = pos[2]
 s = getPixel(pixMask,x,y) -- check color
 if s = Black then
    c = Pink -- paint pink on black
 else
    c = Black -- paint black on pink
 end if
 VOID = floodFill(pixMask,x,y,{s,c}, FLOODFILLSURFACE)
 draw_Bitmap()

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

10. RE: Win32Lib API Floodfill?

Derek Parnell wrote:
> 

> Anyhow, I have floodfill working in win32lib now. I'm tidying up
> some documentation now and will release it this weekend.

Is that 60.2?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

11. RE: Win32Lib API Floodfill?

Derek Parnell wrote:
> I haven't looked at Brian's code but I guess its a wrapper for the 
> ExtFloodFill API call. In which case, the 'c' value is not the color
> you WANT to flood that area with, but the color which you want to change. 

Here's his function:

global procedure floodFillSurface( integer id, integer x, integer y, atom
newColor )
  atom hdc, col
  col = getPixel( id, x, y )
  setPenColor( id, newColor )
  hdc = getDC( id )
  createBrush( id, 1, hdc )
  w32Proc( xExtFloodFill, { hdc, x, y, col, FLOODFILLSURFACE } )
  releaseDC( id )
end procedure

That should work for how I was using it, and it does when I'm
painting on pink, but not when painting on black. Weird!

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

12. RE: Win32Lib API Floodfill?

cklester wrote:
> 
> 
> That should work for how I was using it, and it does when I'm
> painting on pink, but not when painting on black. Weird!
> 

What doesn't work?  Is the black a good solid surface or a pixelated line?

-- Brian
(I suppose it doesn't matter at this point since Derek added it.)

new topic     » goto parent     » topic index » view message » categorize

13. RE: Win32Lib API Floodfill?

Brian Broker wrote:
> 
> cklester wrote:
> > 
> > That should work for how I was using it, and it does when I'm
> > painting on pink, but not when painting on black. Weird!
> > 
> 
> What doesn't work?  Is the black a good solid surface or a pixelated line?

It's just for this one program. I ran a few tests using a new program
and it fills just fine. DA-UM it's fast, though. :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu