pixel_for_bmap(
BMAP*, var x, var y);
Reads a pixel from the XY position of the given bmap.
Parameters:
BMAP* |
source bmap pointer, must be locked before. |
x,y |
the pixel position within the bmap,
0..width-1 resp. 0..height-1. |
Returns:
Pixel value at xy position.
Speed:
Fast
Remarks
- !! For speed reasons this function is not safeguarded. Exceeding the BMAP size (also for instance by changing d3d_texlimit)
will generate a crash error.
- Only normal 16, 24, or 32 bit bmaps can be read from.
Accessing compressed
DDS bmaps, or bmaps used
as render
target will
cause an error.
-
Alternatively, texture content can be accessed directly through the bmap.finalbits pointer; details under bmap_lock.
- The pixel can be converted to a color vector by pixel_to_vec.
Example:
// paint a red cross into a bmap
var format; var pixel;
format = bmap_lock(tgablitz,0);
temp.red = 255; temp.green = 0; temp.blue = 0;
pixel = pixel_for_bmap(tgablitz,0,0);
pixel_to_bmap(tgablitz,10,10,pixel);
pixel_to_bmap(tgablitz,10,11,pixel);
pixel_to_bmap(tgablitz,10,12,pixel);
pixel_to_bmap(tgablitz,10,13,pixel);
pixel_to_bmap(tgablitz,10,14,pixel);
pixel_to_bmap(tgablitz,8,12,pixel);
pixel_to_bmap(tgablitz,9,12,pixel);
pixel_to_bmap(tgablitz,11,12,pixel);
pixel_to_bmap(tgablitz,12,12,pixel);
bmap_unlock(tgablitz); // unlock the locked bitmap
See also:
bmap_unlock, bmap_lock,
pixel_to_vec,
pixel_to_bmap ► latest
version online