| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>ImageXHandle image</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- image = variable holding the image's file handle
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- It is occasionally useful to determine the location of an image's image handle. This command returns the X coordinate. Use ImageYHandle to get the Y coordinate. Please see MidHandle for more information on the image's image handle.
<br />
- Note about the term 'handle'. There are two types of 'handles' we discuss in these documents. One is the location within an image - as discussed in this command. The other is a 'file handle', a variable used to hold an image, sound, or font loaded with a command. See LoadImage for more information about file handles.
- </td>
- </tr>
- </table>
- <h1><a href=../2d_examples/ImageXHandle.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; MidHandle/ImageXHandle()/ImageYHandle()/AutoMidHandle
<br />
-
<br />
- ; Initiate Graphics Mode
<br />
- Graphics 640,480,16
<br />
-
<br />
- ; Set up the image file handle as a global
<br />
- Global gfxBall
<br />
-
<br />
- ; Load the image - you may need to change the location of the file
<br />
- gfxBall=LoadImage ("C:Program FilesBlitz Basicsamplesall.bmp")
<br />
-
<br />
- ; Until the user presses ESC key ...
<br />
- While Not KeyHit(1)
<br />
- Text 0,0,"Default Image Handle for gfxBall... Press ESC ..."
<br />
- Text 0,14,"X handle-" + ImageXHandle(gfxBall) ; Print the location of the image handle x location
<br />
- Text 0,28,"Y handle-" + ImageYHandle(gfxBall) ; Print the location of the image handle y location
<br />
- DrawImage gfxBall,200,200,0 ; draw the image at 200,200
<br />
- Wend
<br />
-
<br />
- ; Clear the screen
<br />
- Cls
<br />
-
<br />
- ; Set the ball's handle to the center of the image
<br />
- MidHandle gfxBall
<br />
-
<br />
- ; Until the user presses ESC key ... show the new information
<br />
- While Not KeyHit(1)
<br />
- Text 0,0,"New Image Handle for gfxBall... Press ESC ..."
<br />
- Text 0,14,"X handle-" + ImageXHandle(gfxBall)
<br />
- Text 0,28,"Y handle-" + ImageYHandle(gfxBall)
<br />
- DrawImage gfxBall,200,200,0
<br />
- Wend
<br />
-
<br />
- ; Makes all images load up with their handles in the center of the image
<br />
- AutoMidHandle True
<br />
- Cls
<br />
-
<br />
- ; Load the image again
<br />
- gfxBall=LoadImage ("C:Program FilesBlitz Basicsamplesall.bmp")
<br />
-
<br />
- ; Until the user presses ESC key ... show the new information
<br />
- While Not KeyHit(1)
<br />
- Text 0,0,"Automatic image handle of gfxBall... Press ESC ..."
<br />
- Text 0,14,"X handle-" + ImageXHandle(gfxBall)
<br />
- Text 0,28,"Y handle-" + ImageYHandle(gfxBall)
<br />
- DrawImage gfxBall,200,200,0
<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=ImageXHandle&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|