|
Table of Contents
map_GetPixelDescriptionGet the value of a pixel in a map. Function prototypebool CExtAPI::map_GetPixel(ZMAP hMap, long x, long y, void* pValue); Arguments
Return valueFalse if an error occurred, and true otherwise. CommentsNone. Exampleint nx = theAPI.map_GetWidth(hMap);
int ny = theAPI.map_GetHeight(hMap);
// check the map type before messing with pixels
if(theAPI.map_GetTypeID(hMap)!=MAP_Heightfield)
return false;
float val;
// step through all pixels
for(int j=0; j<ny; j++) {
for(int i=0; i<nx; i++) {
if(!theAPI.map_GetPixel(hMap, i, j, &val)) // get the pixel value
return false;
val+=10.0f; // increment the value by 10
if(!theAPI.map_SetPixel(hMap, i, j, &val)) // set the pixel value again
return false;
}
}
return true;
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
|