|
|
|
|
@ -43,6 +43,14 @@ setpt(Point* p, int x, int y)
|
|
|
|
|
return p; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Point* |
|
|
|
|
divpt(Point* p, int v) |
|
|
|
|
{ |
|
|
|
|
p->x /= v; |
|
|
|
|
p->y /= v; |
|
|
|
|
return p; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* noodle */ |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
@ -152,6 +160,7 @@ handle_mouse(SDL_Event* event, Brush* b)
|
|
|
|
|
case SDL_MOUSEMOTION: |
|
|
|
|
if(b->down) { |
|
|
|
|
setpt(&b->pos, event->motion.x, event->motion.y); |
|
|
|
|
divpt(&b->pos, ZOOM); |
|
|
|
|
pixel(pixels, b->pos, 0xFFFFFF); |
|
|
|
|
setpt(&b->prev, b->pos.x, b->pos.y); |
|
|
|
|
} |
|
|
|
|
@ -198,13 +207,13 @@ paint(uint32_t* dst, int id, int color)
|
|
|
|
|
p.x = px + tx + (id % 8); |
|
|
|
|
p.y = py + ty + ((id % 64) / 8); |
|
|
|
|
if(color == 1) |
|
|
|
|
pixel(dst, p, 0x00FFFF); |
|
|
|
|
pixel(dst, p, 0x72DEC2); |
|
|
|
|
else if(color == 2) |
|
|
|
|
pixel(dst, p, 0xFF0000); |
|
|
|
|
pixel(dst, p, 0xFFFFFF); |
|
|
|
|
else if(color == 3) |
|
|
|
|
pixel(dst, p, 0x00FF00); |
|
|
|
|
pixel(dst, p, 0x333333); |
|
|
|
|
else |
|
|
|
|
pixel(dst, p, 0x0000FF); |
|
|
|
|
pixel(dst, p, 0x000000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int |
|
|
|
|
@ -221,11 +230,11 @@ load(FILE* f)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
id = 0; |
|
|
|
|
for(b = 0; b < (1024 * 4) - 16; b += 16) { |
|
|
|
|
for(b = 0; b < 1024 * 4; b += 16) { |
|
|
|
|
for(i = 0; i < 8; i++) { |
|
|
|
|
for(j = 7; j >= 0; j--) { |
|
|
|
|
ch1 = buffer[b + i]; |
|
|
|
|
ch2 = buffer[b + i + 16]; |
|
|
|
|
ch2 = buffer[b + i + 8]; |
|
|
|
|
color = ((ch1 >> j) & 0x1) + (((ch2 >> j) & 0x1) << 1); |
|
|
|
|
paint(pixels, id, color); |
|
|
|
|
id++; |
|
|
|
|
|