Qbasicnews.com

Full Version: paint program, need help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
If you don't have a folder called FreeBASIC, download it here, and install it.

After installing it, run FBIDE and do what Aga said. Everything should work fine after that. Wink

Quote:Click view>settings>Compiler>"...", then find your fb compiler..
thanks for the link, now here is a quick question, you know how in MS Paint you can fill and any adjacent pixels of the same color are also filled, how would i go about doing that, using x% and y% as the coordiantes and colour% as the color
you've asked quite a biggie there, there are lots of different ways

heres a post i remember

http://forum.qbasicnews.com/viewtopic.php?t=10992

this one has a way using PAINT

http://forum.qbasicnews.com/viewtopic.ph...light=fill

but do a search for others, cause there are more hidden on the forum
well thnx for the help, i dont understand anything on the 1st link and the 2nd one is a link to a topic i am already checking, my problem is more of filling a area when it's boundries aren't all the same color
Ya.

You use POINT and PSET with traditional QB commands. You do a recursive or iterative search starting from the initial point until you hit a color that isn't the color you're filling.
So the answer is QB (nor FB, afaik) does not have a native paint function that does as MSPaint does.
which would be done how???
Can you explain how this works? You'll never get anywhere, if you don't slow down and think.

Code:
Declare Sub FloodFill(X, Y, Col)


Screen 13,,,1
Randomize Timer

Circle(160,100),50,31

For i=1 To 10
    tAng!=Rnd*6.282
    Tx=160+30*Sin(tAng!)
    Ty=100+30*Cos(tAng!)
    Circle(Tx,Ty),10,2+Int(rnd*14)
Next

FloodFill 160,100,1

Sleep


Sub FloodFill(X,Y,Col)
    If Point(X,Y)>0 Then Exit Sub
    Pset(X,Y),Col
    FloodFill(X-1,Y,Col)
    FloodFill(X+1,Y,Col)
    FloodFill(X,Y-1,Col)
    FloodFill(X,Y+1,Col)
End Sub
can you explain how that works, because it doesnt for me and i dont get it
Try it in FreeBASIC. I don't remember what the stack size is for QB, but I'm sure that will kill it. :lol:
Pages: 1 2 3 4 5 6