Files
BlitzNext/_release/help/commands/2d_commands/UnlockBuffer.htm
T
2014-12-08 12:43:20 +13:00

74 lines
2.2 KiB
HTML

<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>UnlockBuffer 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, and WritePixelFast. 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 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=LockBuffer.htm>LockBuffer</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/UnlockBuffer.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=UnlockBuffer&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
</html>