|
2 registered members (Grant, Quad),
3,610
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: bmap_blit with rotation and alpha parameter
[Re: MMike]
#321549
04/30/10 07:11
04/30/10 07:11
|
Joined: Jul 2001
Posts: 6,904
HeelX
OP
Senior Expert
|
OP
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
Uh... I had to dig a little bit and here is a simple example, I hope this helps! Remember to make sure that due to rotation the panel could exceed the bitmap boundaries and that the coordinates of the panel are used as offset parameter in the bitmap domain. IMPORTANT: I think bmap_save can only save solid textures, so no alpha pass is saved. If you write your own TGA code for instance (see the WIKI for an example), you can save bitmaps also with alpha transparency.
// Create a render target in which the engine renders the strign/panel/whatever
BMAP* targetBmap = bmap_createblack(width, height, 32);
// Create a panel to be rendered
PANEL* myPanel = ...;
set(panel, VISIBLE);
panel->angle = 45;
// Set previously created bitmap as render target for the panel
panel->target_map = targetBmap;
// The engine now renders the panel into the bitmap rather than on the screen
wait(1);
// Create a new bitmap with the same dimensions and colordepth as the targetBmap
BMAP* saveableBmap = bmap_createblack(targetBmap->width, targetBmap->height, 32);
// Copy the contents from the rendertarget into the new bitmap
bmap_blit(saveableBmap, targetBmap, NULL, NULL);
// Save as solid bitmap
bmap_save(saveableBmap, "panel.dds")
Last edited by HeelX; 04/30/10 07:12.
|
|
|
|