int BitmapAdd(int x, int y, int width, int height);
Creates a Bitmap surface.
Return Value
Returns a handle to the Bitmap surface created.
Parameters
x The x coordinate of the Bitmap surface.
y The y coordinate of the Bitmap surface.
width The width of the Bitmap surface.
height The height of the Bitmap surface.
Remarks
BitmapAdd() adds a rectangular surface to the screen where you can manipulate bitmap memory directly. Use BitmapGetBits() to get an unsigned char pointer to the pixels. After modifying the pixels, be sure to call BitmapUpdate() to display changes.
NOTE: Bitmap surfaces are unaffected by calls to WorldSetxy(). If you need your Bitmap surface to move, you will need to do so manually by calling BitmapSetxy().
Availability
Available in DragonFireSDK 1.3 and later.
Example
The example below creates a 100 x 100 Bitmap surface and sets its pixels to white with full alpha.
#include "DragonFireSDK.h" #include <string.h>
int MyBitmap; unsigned char *MyBits;
void AppMain() { MyBitmap = BitmapAdd(0, 0, 100, 100); MyBits = BitmapGetBits(MyBitmap); memset(MyBits, 0xFF, 100*100*4); BitmapUpdate(MyBitmap); }
void AppExit() {
}
void OnTimer() {
} |