|
|
|
|
Functions
MioScript Reference
|
|
Syntax
| draw.ID.getPixel(X1, Y1, X2, Y2, X3, Y3, X4, Y4, X5, Y5, X6, Y6) |
Parameters
| INT | X1, Y1 | Coordinates of the first pixel to read
| | INT | X2, Y2 | Optional. Coordinates of the second pixel to read
| | INT | X3, Y3 | Optional. Coordinates of the third pixel to read
| | INT | X4, Y4 | Optional. Coordinates of the forth pixel to read
| | INT | X5, Y5 | Optional. Coordinates of the fifth pixel to read
| | INT | X6, Y6 | Optional. Coordinates of the sixth pixel to read |
Return value
Description
This function read the color of a list of pixels.
Up to 6 pixels can be read with one call.
This function can be used to create maps.
Create a bitmap and load an an image with areas drawn with different colors.
When the user click on the application window, check the color of the pixel at the mouse position in the map bitmap.
The color of the pixel in the map bitmap will determine where the user click and which feature to call.
This function is also useful to detect collisions when developing games or animations.
Notice
always use BMP file for your maps to avoid compression of the JPG format.
When you specify more than one coordinate, an array is returned.
|
MioScript Sample Code
// Create and load a map file (can be any BMP file).
// Show the color in the map file depending on
// where the user click.
event.load
...
&myMap = loadImage("map.bmp")
...
event.end
event.mouse:click
&color = draw.&myMap.getPixel(
mouse.main.x(), mouse.main.y()
)
alert("Color: "&color)
event.end
|
|
|
|