Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gfx efx

Status
Not open for further replies.

zickbone

Programmer
Joined
May 4, 2000
Messages
1
Location
SE
hi am i a qbasic newbe<br>and i wounder how to do (if you can do) efx on graphics<br>like blur in a line and stuff like that?<br>any other help on fraphics are welcome<br><br>
 
Hi<br>&nbsp;&nbsp;You need to add up the colors of the surrounding pixels and average it out.<br>So you'd do something like <br>PSET(x,y),(POINT(x,y)+POINT(x+1,y)+POINT(x-1,y)+POINT(x,y-1)+POINT(x,y+1))\5<br>for each pixel on the line, after you enter graphics mode.<br><br>If you want to see some cool demo effects, come to <A HREF=" TARGET="_new">
 
hey this code is neat itll make a random image<br>then turn it into a plasma like image enjoy :)<br>&lt;---code starts here---&gt;<br>SCREEN 13<br>FOR x = 1 TO 101<br>FOR y = 1 TO 101<br>PSET (x, y), RND * 255<br>NEXT<br>NEXT<br>DO<br>FOR y = 1 TO 101<br>&nbsp;FOR x = 1 TO 101<br>&nbsp;&nbsp;c = (POINT(x - 1, y) + POINT(x + 1, y) + POINT(x, y - 1) + POINT(x, y + 1) + POINT(x, y) + POINT(x, y) + POINT(x + 1, y + 1) + POINT(x - 1, y + 1) + POINT(x + 1, y - 1) + POINT(x - 1, y - 1)) / 10<br>&nbsp;&nbsp;IF c &lt; 1 THEN c = 1<br>&nbsp;&nbsp;PSET (x, y), c<br>&nbsp;NEXT x<br>NEXT y<br>e = e + 1<br>LOOP UNTIL e = 10<br>&lt;---code ends here---&gt;
 
Eliuker, that's a sweet little piece of code! If anybody hasn't tried it yet, this is the graphic output (at 1/2 scale):<br><img src= might try smoothing the display a little with a couple GET and PUT statements. The output is a little smoother in the early stages.<br><br>Insert these lines at the top:<br>DIM yLn(1600)<br>DIM xLn(1600)<br><br>Insert these after the PSET command:<br>x2 = 101 - x<br>GET (x, 1)-(x, 101), xLn<br>PUT (x2, 1), xLn, PSET<br><br>And insert these after the NEXT x:<br>y2 = 101 - y<br>GET (1, y)-(101, y), yLn<br>PUT (1, y2), yLn, PSET<br><br>This is what it looks like:<br><img src= if you had signed on as a member I could have given you a tipmaster vote.<br> <p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>
 
Oh, PPS:<br>If you place a RANDOMIZE TIMER command after the SCREEN command you will end up with a different image every time.<br><br>I like this discussion. It stimulates growth.<br> <p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top