upiwin/src/stockobj.c

47 lines
1.3 KiB
C
Raw Normal View History

#include <stddef.h>
#include <string.h>
#include "wintype.h"
#include "bitmap.h"
/* references to the icon data */
extern uint8_t _binary_i_freehand_bin_start[];
extern uint8_t _binary_i_freehand_bin_end;
extern uint8_t _binary_i_freehand_bin_size;
extern uint8_t _binary_i_line_bin_start[];
extern uint8_t _binary_i_line_bin_end;
extern uint8_t _binary_i_line_bin_size;
extern uint8_t _binary_i_rect_bin_start[];
extern uint8_t _binary_i_rect_bin_end;
extern uint8_t _binary_i_rect_bin_size;
extern uint8_t _binary_i_fillrect_bin_start[];
extern uint8_t _binary_i_fillrect_bin_end;
extern uint8_t _binary_i_fillrect_bin_size;
typedef struct tagSTOCKBITMAPDESC {
PCSTR name;
INT32 width;
INT32 height;
const void *data;
} STOCKBITMAPDESC;
2019-12-11 14:04:24 -07:00
static const STOCKBITMAPDESC stock_bitmaps[] = {
{"freehand", 48, 48, _binary_i_freehand_bin_start },
{"line", 48, 48, _binary_i_line_bin_start },
{"rect", 48, 48, _binary_i_rect_bin_start },
{"fillrect", 48, 48, _binary_i_fillrect_bin_start },
{NULL, 0, 0, NULL }
};
PBITMAP _BMP_GetStock(PCSTR name)
{
INT32 i;
for (i = 0; stock_bitmaps[i].name; ++i)
if (strcmp(name, stock_bitmaps[i].name) == 0)
return BMP_Create(stock_bitmaps[i].width, stock_bitmaps[i].height, stock_bitmaps[i].data);
return NULL;
}