UnlockBuffer.htm 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>UnlockBuffer buffer</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. buffer = any valid screen/image buffer (optional)
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. 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 />
  21. <br />
  22. The buffer parameter isn't required. If omitted, the default buffer set with SetBuffer will be used. <br />
  23. <br />
  24. See the other commands for more information.
  25. <br>
  26. <br>
  27. 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>.
  28. </td>
  29. </tr>
  30. </table>
  31. <h1><a href=../2d_examples/UnlockBuffer.bb>Example</a></h1>
  32. <table>
  33. <tr>
  34. <td>
  35. ; High Speed Graphics Commands <br />
  36. <br />
  37. Graphics 640,480,16 <br />
  38. <br />
  39. ; Draw a bunch of stuff on the screen <br />
  40. For t= 1 To 1000 <br />
  41. Color Rnd(255),Rnd(255),Rnd(255) <br />
  42. Rect Rnd(640),Rnd(480),Rnd(150),Rnd(150),Rnd(1) <br />
  43. Next <br />
  44. <br />
  45. Delay 3000 <br />
  46. <br />
  47. ; Copy the top half of the screen over the bottom half <br />
  48. ; using fast pixels and locked buffers <br />
  49. For x = 1 To 640 <br />
  50. For y = 1 To 240 <br />
  51. LockBuffer FrontBuffer() <br />
  52. WritePixelFast x,y+241,ReadPixelFast(x,y) <br />
  53. UnlockBuffer FrontBuffer() <br />
  54. Next <br />
  55. Next <br />
  56. <br />
  57. Delay 3000 <br />
  58. <br />
  59. ; Draw the left half of the screen over the right half <br />
  60. ; using the slower direct pixel access <br />
  61. For x = 1 To 320 <br />
  62. For y = 1 To 480 <br />
  63. WritePixel x+320,y,ReadPixel(x,y) <br />
  64. Next <br />
  65. Next
  66. </td>
  67. </tr>
  68. </table>
  69. <br>
  70. <a target=_top href=../index.htm>Index</a><br>
  71. <br>
  72. 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>
  73. </html>