Qbasicnews.com
paint program, need help - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: paint program, need help (/thread-8495.html)

Pages: 1 2 3 4 5 6


paint program, need help - Dr_Davenstein - 12-09-2005

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..



paint program, need help - axipher - 12-09-2005

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


paint program, need help - yetifoot - 12-09-2005

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.php?t=10956&highlight=fill

but do a search for others, cause there are more hidden on the forum


paint program, need help - axipher - 12-09-2005

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


paint program, need help - Agamemnus - 12-09-2005

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.


paint program, need help - Agamemnus - 12-09-2005

So the answer is QB (nor FB, afaik) does not have a native paint function that does as MSPaint does.


paint program, need help - axipher - 12-09-2005

which would be done how???


paint program, need help - Dr_Davenstein - 12-09-2005

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



paint program, need help - axipher - 12-09-2005

can you explain how that works, because it doesnt for me and i dont get it


paint program, need help - Dr_Davenstein - 12-09-2005

Try it in FreeBASIC. I don't remember what the stack size is for QB, but I'm sure that will kill it. :lol: