work in progress - support for bitmaps and BitBlt

This commit is contained in:
Amy Bowersox
2019-12-10 17:09:16 -07:00
parent 59c8dcc638
commit b390886277
8 changed files with 278 additions and 9 deletions

25
src/bitmap.c Executable file
View 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));
}