Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct bmap32 {
- struct rect f;
- int32_t rows[32];
- };
- typedef struct bmap32 bmap32;
- void draw_32(struct widget *w, bmap32 *m) {
- for (int x = 0; x < m->f.size.x && x + m->f.start.x < w->frame.size.x; ++x) {
- for (int y = 0; y < m->f.size.y && y + m->f.start.y < w->frame.size.y; ++y) {
- set_pixel(w, x + m->f.start.x, y + m->f.start.y, (m->rows[y] & (0x1 << (31 - x))) ? 0xff : 0x00);
- }
- }
- }
- // To use:
- draw_32(w, &(bmap32){
- { .start = { 2, 6}, .size = { 5, 3 } },
- .rows = {
- 0b0010000000000000 << 16,
- 0b0111000000000000 << 16,
- 0b1111100000000000 << 16,
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment