CopyPixel.htm 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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>CopyPixel src_x,src_y,src_buffer,dest_x,dest_y,[dest_buffer]</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. src_x - x-coordinate of source pixel to copy from <br />
  13. src_y - y-coordinate of source pixel to copy from <br />
  14. src_buffer - name of buffer to copy from, e.g. ImageBuffer() <br />
  15. dest_x - x-coordinate of destination pixel to copy to <br />
  16. dest_y - y-coordinate of destination pixel to copy to <br />
  17. dest_buffer (optional) - name of buffer to copy to, e.g. BackBuffer()
  18. </td>
  19. </tr>
  20. </table>
  21. <h1>Description</h1>
  22. <table>
  23. <tr>
  24. <td>
  25. You can use this command on a locked buffer for a slight speed-up. See LockBuffer. <br />
  26. <br />
  27. See also: CopyPixelFast.
  28. </td>
  29. </tr>
  30. </table>
  31. <h1><a href=../2d_examples/CopyPixel.bb>Example</a></h1>
  32. <table>
  33. <tr>
  34. <td>
  35. ; CopyPixel/CopyPixelFast Example <br />
  36. ; ------------------------------- <br />
  37. <br />
  38. Graphics 640,480,16 <br />
  39. <br />
  40. Print "Press a key to use CopyPixel to copy the top half of an image to the frontbuffer" <br />
  41. WaitKey() <br />
  42. <br />
  43. ; Load an image - can be anything <br />
  44. pic=LoadImage("media/blitz_pic.bmp") <br />
  45. <br />
  46. ; Use CopyPixel to copy the top half of the image to the frontbuffer <br />
  47. For y=0 To ImageHeight(pic)/2 <br />
  48. For x=0 To ImageWidth(pic) <br />
  49. CopyPixel x,y,ImageBuffer(pic),x,y <br />
  50. Next <br />
  51. Next <br />
  52. <br />
  53. Locate 0,GraphicsHeight()/2 <br />
  54. Print "Press a key to use CopyPixelFast to copy the bottom half of the image" <br />
  55. Print "Once this has finished, you can then press a key to end the program" <br />
  56. <br />
  57. WaitKey() <br />
  58. <br />
  59. ; Lock buffer before using CopyPixelFast <br />
  60. LockBuffer <br />
  61. <br />
  62. ; Use CopyPixelFast to copy the bottom half of the image to the frontbuffer <br />
  63. For y=0 To (ImageHeight(pic)/2)+ImageHeight(pic) <br />
  64. For x=0 To ImageWidth(pic) <br />
  65. CopyPixelFast x,y,ImageBuffer(pic),x,y <br />
  66. Next <br />
  67. Next <br />
  68. <br />
  69. ; Unlock buffer after using CopyPixelFast <br />
  70. UnlockBuffer <br />
  71. <br />
  72. WaitKey()
  73. </td>
  74. </tr>
  75. </table>
  76. <br>
  77. <a target=_top href=../index.htm>Index</a><br>
  78. <br>
  79. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=CopyPixel&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  80. </html>