void * ui_create_cursor(uint32 x, uint32 y, int width, int height, uint8 * andmask, uint8 * xormask) { int i; int j; char am[32 * 4]; char xm[32 * 4]; if (width != 32 || height != 32) { return 0; } memset(am, 0, 32 * 4); memset(xm, 0, 32 * 4); for (i = 0; i < 32; i++) { for (j = 0; j < 32; j++) { if (bs_is_pixel_on((char *)andmask, j, i, 32, 1)) { bs_set_pixel_on(am, j, 31 - i, 32, 1, 1); } if (bs_is_pixel_on((char *)xormask, j, i, 32, 24)) { bs_set_pixel_on(xm, j, 31 - i, 32, 1, 1); } } } return (void *) mi_create_cursor(x, y, width, height, (unsigned char *)am, (unsigned char *)xm); }
void * ui_create_glyph(int width, int height, uint8 * data) { int i; int j; char * glyph_data; struct bitmap * the_glyph; glyph_data = (char *) xmalloc(width * height); memset(glyph_data, 0, width * height); the_glyph = (struct bitmap *) xmalloc(sizeof(struct bitmap)); memset(the_glyph, 0, sizeof(struct bitmap)); the_glyph->width = width; the_glyph->height = height; the_glyph->data = (uint8 *)glyph_data; for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { if (bs_is_pixel_on((char *)data, j, i, width, 1)) { bs_set_pixel_on(glyph_data, j, i, width, 8, 255); } } } return the_glyph; }