ImageXHandle.htm 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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>ImageXHandle image</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. image = variable holding the image's file handle
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. 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 />
  21. 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.
  22. </td>
  23. </tr>
  24. </table>
  25. <h1><a href=../2d_examples/ImageXHandle.bb>Example</a></h1>
  26. <table>
  27. <tr>
  28. <td>
  29. ; MidHandle/ImageXHandle()/ImageYHandle()/AutoMidHandle <br />
  30. <br />
  31. ; Initiate Graphics Mode <br />
  32. Graphics 640,480,16 <br />
  33. <br />
  34. ; Set up the image file handle as a global <br />
  35. Global gfxBall <br />
  36. <br />
  37. ; Load the image - you may need to change the location of the file <br />
  38. gfxBall=LoadImage ("C:Program FilesBlitz Basicsamplesall.bmp") <br />
  39. <br />
  40. ; Until the user presses ESC key ... <br />
  41. While Not KeyHit(1) <br />
  42. Text 0,0,"Default Image Handle for gfxBall... Press ESC ..." <br />
  43. Text 0,14,"X handle-" + ImageXHandle(gfxBall) ; Print the location of the image handle x location <br />
  44. Text 0,28,"Y handle-" + ImageYHandle(gfxBall) ; Print the location of the image handle y location <br />
  45. DrawImage gfxBall,200,200,0 ; draw the image at 200,200 <br />
  46. Wend <br />
  47. <br />
  48. ; Clear the screen <br />
  49. Cls <br />
  50. <br />
  51. ; Set the ball's handle to the center of the image <br />
  52. MidHandle gfxBall <br />
  53. <br />
  54. ; Until the user presses ESC key ... show the new information <br />
  55. While Not KeyHit(1) <br />
  56. Text 0,0,"New Image Handle for gfxBall... Press ESC ..." <br />
  57. Text 0,14,"X handle-" + ImageXHandle(gfxBall) <br />
  58. Text 0,28,"Y handle-" + ImageYHandle(gfxBall) <br />
  59. DrawImage gfxBall,200,200,0 <br />
  60. Wend <br />
  61. <br />
  62. ; Makes all images load up with their handles in the center of the image <br />
  63. AutoMidHandle True <br />
  64. Cls <br />
  65. <br />
  66. ; Load the image again <br />
  67. gfxBall=LoadImage ("C:Program FilesBlitz Basicsamplesall.bmp") <br />
  68. <br />
  69. ; Until the user presses ESC key ... show the new information <br />
  70. While Not KeyHit(1) <br />
  71. Text 0,0,"Automatic image handle of gfxBall... Press ESC ..." <br />
  72. Text 0,14,"X handle-" + ImageXHandle(gfxBall) <br />
  73. Text 0,28,"Y handle-" + ImageYHandle(gfxBall) <br />
  74. DrawImage gfxBall,200,200,0 <br />
  75. Wend <br />
  76. </td>
  77. </tr>
  78. </table>
  79. <br>
  80. <a target=_top href=../index.htm>Index</a><br>
  81. <br>
  82. 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>
  83. </html>