pixel_to_bmap(BMAP* bmap,var x,var y,var pixel);
Writes a pixel at xy position into the given bmap.
Parameters:
| bmap |
target bmap, must be locked. |
| x,y |
the pixel position within the bmap,
0..width-1 resp. 0..height-1. |
| pixel |
the pixel to be written. |
Speed:
Medium
Remarks
- !! For speed reasons this function is not safeguarded. Exceeding the bmap size
(for instance also by redefining d3d_texlimit)
will cause
an
engine
crash.
- Only normal 16, 24, or 32 bit bmaps can be written into. Compressed DDS
bmaps, or bmaps used as render
target can not be modified.
- The bmap must be locked. The pixel format must
match the bmap format. Otherwise it has to be converted by pixel_for_vec.
- For updating the mipmaps on mipmapped bmaps, use the bmap_to_mipmap function.
If the bmap did not contain mipmaps, call bmap_to_mipmap before
drawing to it in order to create a mipmap chain, and call bmap_to_mipmap a
second time after unlocking for copying the modified image into the mipmaps.
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_vec(temp,100,format);
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_for_bmap, pixel_for_vec, bmap_to_mipmap
► latest
version online