| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>LockBuffer buffer</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- buffer = any valid screen/image buffer (optional)
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- After you use LockBuffer on a buffer, the only graphics commands you can use are the read/write pixel commands ReadPixel, WritePixel, ReadPixelFast, WritePixelFast, CopyPixelFast, and CopyPixel. You must UnlockBuffer before using other graphics commands or API calls, and you are advised to only keep the buffer locked for as long as it is needed.
<br />
-
<br />
- The buffer parameter isn't required. If omitted, the default buffer set with SetBuffer will be used.
<br />
-
<br />
- See the other commands for more information.
- <br>
- <br>
- See also: <a class=small href=LockedPitch.htm>LockedPitch</a>, <a class=small href=LockedFormat.htm>LockedFormat</a>, <a class=small href=LockedPixels.htm>LockedPixels</a>, <a class=small href=ReadPixelFast.htm>ReadPixelFast</a>, <a class=small href=WritePixelFast.htm>WritePixelFast</a>, <a class=small href=UnlockBuffer.htm>UnlockBuffer</a>.
- </td>
- </tr>
- </table>
- <h1><a href=../2d_examples/LockBuffer.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; High Speed Graphics Commands
<br />
-
<br />
- Graphics 640,480,16
<br />
-
<br />
- ; Draw a bunch of stuff 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
- </td>
- </tr>
- </table>
- <br>
- <a target=_top href=../index.htm>Index</a><br>
- <br>
- Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=LockBuffer&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|