Hi JR, James Newton has an example of a flood fill here: http://perso.planetb.fr/newton/textureFlood.dir. This uses the undocumented "floodFill" function. As far as I know, recursively setting pixels as you're doing now is always going to be bog slow.
HTH, Tim > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 19 March 2003 4:15 pm > To: [EMAIL PROTECTED] > Subject: <lingo-l> Code optimazation > > > I have this code i wrote for a fill bucket tool used on a > bitmap member. It works fine but its slow. I would like you > all, if you would, to see if theres away i can speed up the > process. This is a behavior attatched to a bitmap. The bitmap > i'm using is 609x426 px. A warning to those who do test this, > it took a little over a minuite to fill 100% of my bitmap. > Also name the bitmap. > -- > global mybrushcolor > on beginsprite me > myBrushColor = rgb(255,0,0) > end > > on mouseup me > fillarea > end > > on fillarea > x = the mouseh-sprite(spritenum).rect.left > y = the mousev-sprite(spritenum).rect.top > myname = sprite(spritenum).member.name > canvaseimage = member(myname).image > -- > mycolor = canvaseimage.getPixel(point(x,y)) > if mycolor = mybrushcolor then exit > -- > t = 0 > b = sprite(spritenum).height > l = 0 > r = sprite(spritenum).width > -- > cursor 4 > -- > colorfillrepeat(x,y,mycolor,t,b,l,r,canvaseimage,myname) > member(myname).image = canvaseimage > -- > cursor -1 > end > > on colorfillrepeat x,y,mycolor,t,b,l,r,canvaseimage,myname > if x < l or x > r then exit > if y < t or y > b then exit > -- > thecolor = canvaseimage.getPixel(point(x,y)) > -- > if thecolor <> mycolor then exit > -- > canvaseimage.setPixel(x,y,mybrushcolor) > -- > colorfillrepeat((x+1),y,mycolor,t,b,l,r,canvaseimage,myname) > colorfillrepeat((x-1),y,mycolor,t,b,l,r,canvaseimage,myname) > colorfillrepeat((x),(y+1),mycolor,t,b,l,r,canvaseimage,myname) > colorfillrepeat((x),(y-1),mycolor,t,b,l,r,canvaseimage,myname) > end > -- > One more note: you can use directors drag and drop canvas > script on the bitmap to set up a defalt paint brush. Use this > to draw various shapes on the bitmap and get the full effect > of the fill bucket script. > > thanks in advance > --jR > [To remove yourself from this list, or to change to digest > mode, go to http://www.penworks.com/lingo-l.cgi To post > messages to the list, email [EMAIL PROTECTED] (Problems, > email [EMAIL PROTECTED]). Lingo-L is for learning and > helping with programming Lingo. Thanks!] > [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
