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

Example (lite-C):

// draw a one-line border around a bmap
void bmap_drawborder(BMAP* bmap,COLOR* color,var alpha)
{
var pixel = pixel_for_vec(color,alpha,bmap_lock(bmap,0));
var width = bmap_width(bmap);
var height = bmap_height(bmap);
var i;
for (i=0; i<width; i++) {
pixel_to_bmap(bmap,i,0,pixel);
pixel_to_bmap(bmap,i,height-1,pixel);
}
for (i=0; i<height; i++)
{
pixel_to_bmap(bmap,0,i,pixel);
pixel_to_bmap(bmap,width-1,i,pixel);
}
bmap_unlock(bmap);
}

See also:

bmap_unlock, bmap_lock, pixel_for_bmap, pixel_for_vec, bmap_to_mipmap

► latest version online