37 lines
2.3 KiB
HTML
37 lines
2.3 KiB
HTML
|
|
<html><head><title>Command: UnlockBuffer </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'> UnlockBuffer buffer </span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Unlocks the buffer previously locked for high speed pixel operations.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>buffer = any valid screen/image buffer (optional)</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>After you use <a href='LockBuffer.htm'>LockBuffer</a> on a buffer, the only graphics commands you can use are the read/write pixel commands <a href='ReadPixel.htm'>ReadPixel</a>, <a href='WritePixel.htm'>WritePixel</a>, <a href='ReadPixelFast.htm'>ReadPixelFast</a>, and <a href='WritePixelFast.htm'>WritePixelFast</a>. You must use this command before using other graphics commands.<br>
|
||
|
|
<br>
|
||
|
|
The buffer parameter isn't required. If omitted, the default buffer set with <a href='SetBuffer.htm'>SetBuffer</a> will be used.<br>
|
||
|
|
<br>
|
||
|
|
See the other commands for more information.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; High Speed Graphics Commands<br>
|
||
|
|
<br>
|
||
|
|
Graphics 640,480,16<br>
|
||
|
|
<br>
|
||
|
|
; Draw a bunch of crap on the screen<br>
|
||
|
|
For t= 1 To 1000<br>
|
||
|
|
Color Rnd(255),Rnd(255),Rnd(255)<br>
|
||
|
|
Rect Rnd(640),Rnd(480),Rnd(150),Rnd(150),Rnd(1)<br>
|
||
|
|
Next<br>
|
||
|
|
<br>
|
||
|
|
Delay 3000<br>
|
||
|
|
<br>
|
||
|
|
; Copy the top half of the screen over the bottom half<br>
|
||
|
|
; using fast pixels and locked buffers<br>
|
||
|
|
For x = 1 To 640<br>
|
||
|
|
For y = 1 To 240<br>
|
||
|
|
LockBuffer FrontBuffer()<br>
|
||
|
|
WritePixelFast x,y+241,ReadPixelFast(x,y)<br>
|
||
|
|
UnlockBuffer FrontBuffer()<br>
|
||
|
|
Next<br>
|
||
|
|
Next<br>
|
||
|
|
<br>
|
||
|
|
Delay 3000<br>
|
||
|
|
<br>
|
||
|
|
; Draw the left half of the screen over the right half<br>
|
||
|
|
; using the slower direct pixel access<br>
|
||
|
|
For x = 1 To 320<br>
|
||
|
|
For y = 1 To 480<br>
|
||
|
|
WritePixel x+320,y,ReadPixel(x,y)<br>
|
||
|
|
Next<br>
|
||
|
|
Next<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
|
||
|
|
</html>
|