====== tile_GetDataPtr ====== ===== Description ===== Retrieve the raw data pointer for a mosaic tile. ===== Function prototype ===== void* CExtAPI::tile_GetDataPtr(void* hTile); ===== Arguments ===== ^ Name ^ Type ^ Comment ^ | hTile | void* | A handle to a mosaic tile. | ===== Return value ===== A null pointer if: * The tile handle is invalid. * The tile has not been locked for use via [[zeolite:functions:tile_SetLock]] (this is automatic when loading/saving tiles). A valid non-null pointer otherwise. ===== Comments ===== ==== Pixel ordering ==== Pixels are ordered in rows going east-to-west, with rows ordered south to north. To convert from x/y coordinate to memory offset, use the following formula: long offset = (x + TileSize * y) * PixelMemSize; ...where //PixelMemSize// is the size in memory of one pixel (see [[zeolite:functions:map_GetPixelSize]]). To convert from memory offsets to pixel coordinates, use the following formulae: long x = (offset/PixelMemSize)%TileSize; long y = (offset/PixelMemSize)/TileSize; ==== Use map_GetPixel/map_SetPixel where possible ==== It is recommended that, wherever possible, the [[zeolite:functions:tile_GetPixel]]/[[zeolite:functions:tile_SetPixel]] functions are used for accessing tile data, instead of direct memory access with tile_GetDataPtr. Those functions include coordinate checking and memory protection, as well has handling mip-mapping and mosaic tile cache loading/saving and automatically.