| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>DrawImageRect image,x,y,rect_x,rect_y,rect_width,rect_height,[frame]</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- image = variable holding the image handle
<br />
- x = x location on the screen to draw the image
<br />
- y = y location on the screen to draw the image
<br />
- rect_x = starting x location within the image to draw
<br />
- rect_y = starting y location within the image to draw
<br />
- rect_width = the height of the area to draw
<br />
- rect_height = the width of the area to draw
<br />
- frame = optional frame number of image to draw
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- 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 drawn transparent, just as you normally would draw an image.
<br />
-
<br />
- 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 no transparency or mask, use DrawBlockRect instead.
- </td>
- </tr>
- </table>
- <h1><a href=../2d_examples/DrawImageRect.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; DrawImageRect Example
<br />
-
<br />
- ; Turn on graphics mode
<br />
- Graphics 640,480,16
<br />
-
<br />
- ; Create new empty graphic to store our circle in
<br />
- gfxCircle=CreateImage(50,50)
<br />
-
<br />
- ; Draw the circle image
<br />
- ; Set drawing operations to point to our new empty graphic
<br />
- SetBuffer ImageBuffer(gfxCircle)
<br />
- Color 255,0,0
<br />
- ; Note the extra space between the circle and the edge of the graphic
<br />
- Oval 10,10,30,30,1
<br />
- SetBuffer FrontBuffer()
<br />
-
<br />
-
<br />
- ; Let's draw portions of the circle randomly
<br />
- While Not KeyHit(1)
<br />
- ; We take random sized portions of the circle and put them
<br />
- ; at a random location ... wash, rinse, and repeat
<br />
- DrawImageRect gfxCircle,Rnd(640),Rnd(480),0,0,Rnd(50),Rnd(50),0
<br />
- Delay 100
<br />
- Wend
<br />
- </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=DrawImageRect&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|