work in progress - support for bitmaps and BitBlt
This commit is contained in:
25
src/bitmap.c
Executable file
25
src/bitmap.c
Executable file
@@ -0,0 +1,25 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "bitmap.h"
|
||||
|
||||
PBITMAP BMP_Create(INT32 width, INT32 height, const VOID *bits)
|
||||
{
|
||||
PBITMAP rc;
|
||||
UINT32 tot_size = sizeof(BITMAP) + (width * height * sizeof(UINT16));
|
||||
|
||||
rc = (PBITMAP)malloc(tot_size);
|
||||
if (!rc)
|
||||
return NULL;
|
||||
memset(rc, 0, tot_size);
|
||||
_Go_init(&(rc->hdr), BMP_SIG_WORD, tot_size);
|
||||
rc->width = width;
|
||||
rc->height = height;
|
||||
if (bits)
|
||||
memcpy(rc->bits, bits, width * height * sizeof(UINT16));
|
||||
return rc;
|
||||
}
|
||||
|
||||
void BMP_Delete(PBITMAP pbmp)
|
||||
{
|
||||
Go_release(&(pbmp->hdr));
|
||||
}
|
||||
Reference in New Issue
Block a user