bmap_blit (BMAP* bmDest, BMAP* bmSrc, VECTOR* vDestPos, VECTOR* vDestSize);
bmap_blitpart (BMAP* bmDest, BMAP* bmSrc,
VECTOR* vDestPos, VECTOR* vDestSize, VECTOR* vSrcPos, VECTOR* vSrcSize);
Copies the content of a bmap scaled to a certain position in a target bmap.
Parameters:
bmDest |
Target bmap. |
bmSrc |
Source bmap. |
vDestPos |
Target xy position in pixels relative to the upper left corner, or NULL for blitting to the bitmap beginning. |
vDestSize |
Target xy size in pixels for scaling the bitmap, or NULL for no scaling. |
vSrcPos |
Source xy position in pixels relative to the upper left corner, or NULL
for blitting from the bitmap beginning. |
vSrcSize |
Source xy size in pixels for blitting only a part of the bitmap, or NULL for blitting the whole bitmap. |
Speed:
Slow
(depends on scaling and on whether the bitmap is visible or used as a render target)
Remarks
- The bitmaps don't need to be locked.
-
Bitmaps in special formats (except cubic environment maps), compressed
DDS bmaps, or bitmaps used as render target can not be copied into.
- For blitting into existing cubic environment
maps, set x at the destination pixel address (0..5 * size), and y at
0.
-
LC
For blitting into the whole target area regardless of its size, use vector(bmDest.width,bmDest.height,0) for vDestSize.
- Parts of the source bmap that exceed the target area will be clipped
away.
Example:
// create a scaled-down cubemap from the level sky cube
BMAP* bmap_skycube;
function get_skycube()
{
if (NULL == sky_cube_level) {
bmap_skycube = bmap_create("skycube+6.tga"); // create a dummy sky cube when there's none in the level
} else {
bmap_skycube = bmap_createblack(1536,256,24); // create an empty bmap
bmap_blit(bmap_skycube,bmap_for_entity(sky_cube_level,1),vector(0,0,0),vector(256,256,0)); // get the west
bmap_blit(bmap_skycube,bmap_for_entity(sky_cube_level,2),vector(256,0,0),vector(256,256,0)); // get the north
bmap_blit(bmap_skycube,bmap_for_entity(sky_cube_level,3),vector(512,0,0),vector(256,256,0)); // get the east
bmap_blit(bmap_skycube,bmap_for_entity(sky_cube_level,4),vector(768,0,0),vector(256,256,0)); // get the south
bmap_blit(bmap_skycube,bmap_for_entity(sky_cube_level,5),vector(1024,0,0),vector(256,256,0)); // get the ground
bmap_blit(bmap_skycube,bmap_for_entity(sky_cube_level,6),vector(1280,0,0),vector(256,256,0)); // get the sky
}
bmap_to_cubemap(bmap_skycube); // convert to cubemap
}
See also:
bmap_unlock, bmap_lock,
bmap_fill,
bmap_to_cubemap, pixel_for_bmap, pixel_for_vec
► latest
version online