DrawBlockRect.htm 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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>DrawBlockRect image,x,y,rect_x,rect_y,rect_width,rect_height,[frame]</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. image = variable holding the image handle <br />
  13. x = x location on the screen to draw the image <br />
  14. y = y location on the screen to draw the image <br />
  15. rect_x = starting x location within the image to draw <br />
  16. rect_y = starting y location within the image to draw <br />
  17. rect_width = the height of the area to draw <br />
  18. rect_height = the width of the area to draw <br />
  19. frame = optional frame number of image to draw
  20. </td>
  21. </tr>
  22. </table>
  23. <h1>Description</h1>
  24. <table>
  25. <tr>
  26. <td>
  27. This command will let you draw a rectangular PORTION of an image to the designated location on the screen. The transparent/masked portions of the original image will be ignored and drawn with the image. <br />
  28. <br />
  29. This is handy if you are doing something like revealing part of a screen when the player uncovers something (think QIX). You could load the 'picture' into an image, then when the player clears a rectangular region, you could paste that portion of the final image onto the playfield. If you want to draw the image portion with transparency or masking, use DrawImageRect instead.
  30. </td>
  31. </tr>
  32. </table>
  33. <h1><a href=../2d_examples/DrawBlockRect.bb>Example</a></h1>
  34. <table>
  35. <tr>
  36. <td>
  37. ; DrawBlockRect Example <br />
  38. <br />
  39. ; Turn on graphics mode <br />
  40. Graphics 640,480,16 <br />
  41. <br />
  42. ; Create new empty graphic to store our circle in <br />
  43. gfxCircle=CreateImage(50,50) <br />
  44. <br />
  45. ; Draw the circle image <br />
  46. ; Set drawing operations to point to our new empty graphic <br />
  47. SetBuffer ImageBuffer(gfxCircle) <br />
  48. Color 255,0,0 <br />
  49. ; Note the extra space between the circle and the edge of the graphic <br />
  50. Oval 10,10,30,30,1 <br />
  51. SetBuffer FrontBuffer() <br />
  52. <br />
  53. ; Set the screen to white so you can see the transparent areas <br />
  54. ClsColor 255,255,255 <br />
  55. Cls <br />
  56. <br />
  57. ; Let's draw portions of the circle randomly <br />
  58. While Not KeyHit(1) <br />
  59. ; We take random sized portions of the circle and put them <br />
  60. ; at a random location ... wash, rinse, and repeat <br />
  61. DrawBlockRect gfxCircle,Rnd(640),Rnd(480),0,0,Rnd(50),Rnd(50),0 <br />
  62. Delay 100 <br />
  63. Wend <br />
  64. </td>
  65. </tr>
  66. </table>
  67. <br>
  68. <a target=_top href=../index.htm>Index</a><br>
  69. <br>
  70. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=DrawBlockRect&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  71. </html>