Jump to content


Photo

Flood Fill Dll


  • Please log in to reply
46 replies to this topic

#1 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 06 May 2007 - 06:20 PM

Info
Game Maker version: 7
File type/size: RAR/113 KB

Description
The DLL flood fills a file at a coordinate with a color. The speed is instant -- that is the same as in, for example, Paint -- even though the sprite has to be saved, flood filled, and then loaded again.

Download

Edited by Daniel-Dane, 18 July 2008 - 01:42 PM.

  • 0

#2 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 06 May 2007 - 06:40 PM

Nice! :P
  • 0

#3 benoit.rouleau

benoit.rouleau

    GMC Member

  • GMC Member
  • 1637 posts
  • Version:GM:Studio

Posted 06 May 2007 - 11:25 PM

Oooooh nice Daniel! Can I use it instead of my external app for Beneton Movie GIF? It's way faster! That's incredible! Good job!!! :P
  • 0

#4 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 07 May 2007 - 01:42 PM

It is? I thought it would be slower. Lol, then all this hard work paid off. Of course you can, it's like 5 lines of code ^_^.
  • 0

#5 coolsmile

coolsmile

    Programmer

  • New Member
  • 1346 posts

Posted 07 May 2007 - 02:12 PM

it's like 5 lines of code ^_^

Nice :lol:
  • 0

#6 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 07 May 2007 - 02:22 PM

Wait, after checking it's more like 10-15 lines (depending on whether you count empty results, begin/end and procedure titles).
  • 0

#7 Potnop

Potnop

    GMC Member

  • GMC Member
  • 3103 posts

Posted 10 May 2007 - 04:45 AM

I'm guessing this can't be used for things other than pixels... Or can it? I'm trying to make my level editor perform a floodfill with the tiles layer when laying tiles.

In the experts forum there's a topic on floodfill algorithms I haven't gotten around to using yet but they describe floodfills being used in things like my idea, and also in games like Minesweeper and stuff, not only gfx. But yours is probably made specifically for sprites...

Edited by Potnop, 10 May 2007 - 04:46 AM.

  • 0
Vegeta! What does the scouter say about his powerlevel?!? It's ovER 9000!!!!!
I ownt read da script, script reads me.


Link To The Super Crew Topic / Link To Colonial Commando Topic
Platform Pathfinding Example Download it here!
Editable Early Version Level Editor(Nice @$$ stuff, check it out) Download it here!

#8 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 10 May 2007 - 06:36 AM

You mean like in alphas? No, mine is just the ordinary Paint flood fill.
  • 0

#9 Potnop

Potnop

    GMC Member

  • GMC Member
  • 3103 posts

Posted 10 May 2007 - 06:38 AM

OK. What's "in alphas" though?
  • 0
Vegeta! What does the scouter say about his powerlevel?!? It's ovER 9000!!!!!
I ownt read da script, script reads me.


Link To The Super Crew Topic / Link To Colonial Commando Topic
Platform Pathfinding Example Download it here!
Editable Early Version Level Editor(Nice @$$ stuff, check it out) Download it here!

#10 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 10 May 2007 - 01:14 PM

When you said pixels I thought you were referring to whether it can flood fill images with alpha also.

But the only thing my DLL does it flood filling a file. If you can save your tile and then load it afterwards you can use this, otherwise, only for sprites (and backgrounds).
  • 0

#11 torigara

torigara

    GMC Member

  • GMC Member
  • 6507 posts

Posted 10 May 2007 - 01:35 PM

The flood fill algorithm is not only for painting, but it has many other applications in games.

For example, imagin a game that the player puts wall objects to enclose his territory. Then you can determine the area of the territory with the flood fill algorithm. Or, you can put water tiles to surround the wall by flood-filling outside the region. Probably that's what Potnop is asking (and if I recall correctly, that was what discussed in the expert forum.)
  • 0

#12 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 10 May 2007 - 01:58 PM

If you want a wall to change color just change its hue.
  • 0

#13 torigara

torigara

    GMC Member

  • GMC Member
  • 6507 posts

Posted 10 May 2007 - 03:34 PM

No, I'm not talking about painting a wall.

Imagine, there is a level editor for a game. The user enclose the field with wall tiles. Then, when the user starts playing the game, the empty region inside the wall is automatically filled with floor tiles, and the outside region is filled with grass tiles.
Posted Image -> Posted Image
The flood fill algorithm can be used for it. Do you get the idea?
  • 0

#14 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 10 May 2007 - 03:36 PM

Yeah, now I do.
  • 0

#15 gamefreak

gamefreak

    GMC Member

  • New Member
  • 345 posts

Posted 15 May 2007 - 04:56 PM

will this work for GM6? i cant upgrade to GM7 for some reason....
  • 0

#16 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 15 May 2007 - 05:55 PM

There is a greater change for it will work on GM6 than GM7. Just try ^_^.
  • 0

#17 Ussyless

Ussyless

    Objective

  • GMC Member
  • 962 posts
  • Version:Unknown

Posted 26 May 2007 - 03:38 PM

Curse you gmk!
  • 0

#18 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 26 May 2007 - 04:19 PM

Right. So let me get this right;
You bumped the topic with the only purpose to curse Game Maker 7. What is wrong with you? There's a .gml file you bloody idiot (in response to your "hidden" words in your sig).
  • 0

#19 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 02 June 2007 - 03:05 AM

I am sorry, but I am a bit confused by your code. Can you make a simpler example? Thanks.
  • 0

#20 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 02 June 2007 - 06:50 AM

Alright, here is it. Control are left click to fill and space to change color.
  • 0

#21 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 02 June 2007 - 12:00 PM

Alright, here is it. Control are left click to fill and space to change color.

<{POST_SNAPBACK}>

I think you put in the wrong file.
  • 0

#22 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 02 June 2007 - 12:23 PM

I did? Sorry, what do you see? I am on Linux right now, so I can't check it out.
  • 0

#23 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 02 June 2007 - 12:32 PM

It was the same paint example as the one on the first page. (In the simple Flood Fill folder)
  • 0

#24 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 02 June 2007 - 12:37 PM

Oh darn, wrong file. I'll fix it ASAP.

EDIT:
Okay, reuploaded the correct file. Remember to clear your cache as it's the same link.

Edited by Daniel-Dane, 02 June 2007 - 12:42 PM.

  • 0

#25 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 02 June 2007 - 12:53 PM

Oh darn, wrong file. I'll fix it ASAP.

EDIT:
Okay, reuploaded the correct file. Remember to clear your cache as it's the same link.

<{POST_SNAPBACK}>

Thanks so much! I really needed this!
  • 0

#26 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 02 June 2007 - 12:54 PM

You are welcome. I hope this was better. :medieval:
  • 0

#27 OldSkoolGamer

OldSkoolGamer

    GMC Member

  • GMC Member
  • 128 posts
  • Version:GM:Studio

Posted 03 June 2007 - 05:02 AM

Any way to use this to flood fill with say a texture ? Kinda like the land in the Worms series of games.
  • 0

#28 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 03 June 2007 - 06:08 PM

Actually, I think using trianglefan with [textured] primitives would be better.
  • 0

#29 iamcheeze

iamcheeze

    GMC Member

  • New Member
  • 449 posts

Posted 10 June 2007 - 07:49 PM

any chance of making a gm6 version? I ran into some trouble uprading to pro... ad the script is uncompatible with globalvar... i'll just request the code again and try to change it myself for now....................


NVM- I think I got it

Edited by iamcheeze, 10 June 2007 - 07:51 PM.

  • 0


_Player_
64Digits - a programming community of lazy and smart people.
Calculus is fun!


#30 Pob

Pob

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM:Studio

Posted 12 June 2007 - 04:06 PM

Cool this was (almost) just what I needed.

I needed to fill on a tile based system, so I write my array out to a bitmap (writing binary to the file), do the fill, then read it back in in binary and update my tiles.

It would be handy if there was a version that would do a fill on a raw file containing 8 bit values, where you pass the dimensions of the data, as that would be a bit quicker. this works fine for what I need as the fill is only done during level changes.
  • 0

#31 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 12 June 2007 - 06:56 PM

So, you want to pass the file (binary code) as an argument and then make the DLL do the work?
  • 0

#32 Pob

Pob

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM:Studio

Posted 12 June 2007 - 07:42 PM

Yeah, exactly as it works now, but with 8 bit raw data.

At the moment I have to write my data out with a BMP header, then 3 bytes per tile, then pad the line out to a multiple of 4, so that it is a valid bitmap for the fill to work on.

Of course if the data is raw, then it would be necessary to pass the height and width to the dll.

It would probably need to be two different dlls - one as is, and a new one for raw 8 bit data, but the core code would be so similar it shouldn't be a big change. And it would be very useful for tile based games and many other things :blink:
  • 0

#33 torigara

torigara

    GMC Member

  • GMC Member
  • 6507 posts

Posted 13 June 2007 - 04:17 AM

If it is an array, it's entirely possible to fill it with GML in a reasonable time.
Array fill example
Edit: link fixed

Edited by torigara, 15 January 2011 - 04:52 PM.

  • 0

#34 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 13 June 2007 - 08:30 AM

Hmm, 8bit, I think that would require a bit more work with Delphi. Never did it at 8bit...
  • 0

#35 Pob

Pob

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM:Studio

Posted 13 June 2007 - 01:50 PM

If it is an array, it's entirely possible to fill it with GML in a reasonable time.
Array fill example

<{POST_SNAPBACK}>

Ooh, thanks. That did the trick. Made my code much simpler, too.

I did look at writing my own fill like that but I couldn't get it working and thought maybe the stack overhead was too much.
  • 0

#36 the_doominator

the_doominator

    Eight Star

  • New Member
  • 925 posts

Posted 13 June 2007 - 03:31 PM

If it is an array, it's entirely possible to fill it with GML in a reasonable time.
Array fill example

<{POST_SNAPBACK}>

whoa! thats almost as fast as the DLL. ;) Good job! ;)
  • 0

#37 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 24 June 2007 - 09:22 AM

Yeah, it's a shame the -- or any for that sake -- DLL can't access the internal resources.
  • 0

#38 Warrainsx00

Warrainsx00

    GMC Member

  • GMC Member
  • 212 posts

Posted 21 July 2007 - 06:29 AM

I used this but got this error when it should come up, I just imported all the stuff and changed it to what I need.

___________________________________________
ERROR in
action number 1
of Create Event
for object ObjCont:

Error in code at line 4:
CurrentTool = TOOL_PENCIL;

at position 16: Unknown variable TOOL_PENCIL
  • 0

#39 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 24 July 2007 - 12:07 PM

Alright, I have added the example together with the file now. TOOL_PENCIL is a constant.
  • 0

#40 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 18 April 2008 - 07:16 PM

i think download link is down...
  • 0

#41 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 18 April 2008 - 08:15 PM

This is a bit old :P
  • 0

#42 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 18 April 2008 - 08:33 PM

ohh, lol, but it looks cool...
  • 0

#43 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 09 May 2008 - 01:23 PM

I would really like to try this!
I am making an image editing program and I want to include this dll...
  • 0

#44 Potnop

Potnop

    GMC Member

  • GMC Member
  • 3103 posts

Posted 10 May 2008 - 10:13 PM

Heh, can someone reupload that array example?

I did a tile floodfill in my level editor for flood filling tiles (not an image) but it's not very stable...
  • 0
Vegeta! What does the scouter say about his powerlevel?!? It's ovER 9000!!!!!
I ownt read da script, script reads me.


Link To The Super Crew Topic / Link To Colonial Commando Topic
Platform Pathfinding Example Download it here!
Editable Early Version Level Editor(Nice @$$ stuff, check it out) Download it here!

#45 Botyto

Botyto

    GMC Member

  • GMC Member
  • 1252 posts

Posted 30 May 2008 - 09:02 PM

Broken link, and how do I use it for making outline function for painting game ??
  • 0

#46 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 18 July 2008 - 01:43 PM

Found the file again. Re-uploaded.
  • 0

#47 ehsan_wwe

ehsan_wwe

    GMC Member

  • GMC Member
  • 45 posts
  • Version:Unknown

Posted 26 June 2013 - 01:52 PM

thank you for healthly link this DLL is too best thank you 


  • 0