func_graphics_max2d_grabimage.rst 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. .. _func_graphics_max2d_grabimage:
  2. =========
  3. GrabImage
  4. =========
  5. GrabImage -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. GrabImage( image:TImage,x,y,frame=0 )
  10. Grab an image from the back buffer
  11. Copies pixels from the back buffer to an image frame.
  12. Only images created with the DYNAMICIMAGE flag can be grabbed.
  13. Parameters
  14. ==========
  15. Return Values
  16. =============
  17. Nothing.
  18. Examples
  19. ========
  20. .. code-block:: blitzmax
  21. ' grabimage.bmx
  22. ' draws a small graphic then uses grabimage to make an image
  23. ' as mask color and cls color both default to black a mask is
  24. ' created for the grabbed where any pixels unset on the backbuffer
  25. ' become transparent in the grabbed image
  26. Graphics 800,600,0'640,480,32
  27. Cls
  28. DrawLine 0,0,32,32
  29. DrawLine 32,0,0,32
  30. DrawOval 0,0,32,32
  31. Local image=CreateImage(640,480,1,DYNAMICIMAGE|MASKEDIMAGE)
  32. GrabImage image,0,0
  33. Cls
  34. For i=1 To 100
  35. DrawImage image,Rnd(640),Rnd(480)
  36. Next
  37. Flip
  38. GrabImage image,0,0
  39. Cls
  40. For i=1 To 100
  41. DrawImage image,Rnd(640),Rnd(480)
  42. Next
  43. Flip
  44. WaitKey
  45. See Also
  46. ========