You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
953 B
C
36 lines
953 B
C
#include "images.h"
|
|
|
|
int image_draw_rect(Image image, int x1, int y1, int x2, int y2, Color color) {
|
|
int retval = 1;
|
|
int y;
|
|
for (; x1 < x2; x1++) {
|
|
for (y = y1; y < y2; y++) {
|
|
if (!image_set_px_c(image, x1, y, color)) retval = 0;
|
|
}
|
|
}
|
|
|
|
return retval;
|
|
}
|
|
|
|
int image_draw_circ(Image image, int x, int y, int r, Color color) {
|
|
int retval = 1;
|
|
int i, j, r2 = r * r;
|
|
for (i = -r+1; i < r; i++) {
|
|
for (j = -r+1; j < r; j++) {
|
|
if (i*i + j*j >= r2) continue;
|
|
if (!image_set_px_c(image, x + i, y + j, color)) retval = 0;
|
|
}
|
|
}
|
|
return retval;
|
|
}
|
|
|
|
int image_draw_square(Image image, int x, int y, int size, Color color) {
|
|
int retval = 1;
|
|
int i, j;
|
|
for (i = -size / 2; i <= size / 2; i++) {
|
|
for (j = -size / 2; j <= size / 2; j++) {
|
|
if (!image_set_px_c(image, x + i, y + j, color)) retval = 0;
|
|
}
|
|
}
|
|
return retval;
|
|
} |