|
*** useful
Takes a point on the polygon and returns the color and alpha values of the relevant pixel
This function is very useful in conjunction with STATE_engine_is_movement_possible(), STATE_engine_2D_point_to_3D()
For example, to receive the color of the pixel where the user point the mouse on
Parameters:
XYZ_on_polygon [in]:
a point on the polygon.
This point can be obtained by STATE_engine_is_movement_possible(), STATE_engine_2D_point_to_3D()
or other way.
XYZ_on_polygon[0] the x coord
XYZ_on_polygon[1] the y coord
XYZ_on_polygon[2] the z coord
bitmap_index [in]:
0 or 1. 0 for the primary bitmap. 1 for the secondary bitmap
rgba [out]:
The color of the pixel in the given location
rgba[0]==red
rgba[1]==green
rgba[2]==blue
rgba[3]==alpha
Example:
int x=10, y=20; for example the mouse cursor location
double XYZ[3];
DWORD selected_object_handle;
DWORD selected_polygon_handle;
int return_code=STATE_engine_2D_point_to_3D(x,y,XYZ, &selected_object_handle, &selected_polygon_handle);
if(return_code!=OK)
return;
BYTE rgba[4];
STATE_polygon_get_bitmap_pixel_rgba(selected_polygon_handle, XYZ, 0, rgba);
|