cleaned up

master
Anton Lydike 5 years ago
parent 5e8bab38f0
commit 21ef4f2e6d

@ -25,11 +25,7 @@ int image_check_coords(Image image, int x, int y);
int image_destroy(Image image);
// drawing
int image_draw_rect(Image image, int x1, int y1, int x2, int y2, Color color);
int image_draw_circ(Image image, int x, int y, int r, Color color);
int image_draw_square(Image image, int x, int y, int s, Color color);
// colors
Color color_new(int r, int g, int b);
Color color_new_alpha(int r, int g, int b, float alpha);
@ -38,6 +34,14 @@ void print_color(Color c);
Color color_mix(Color c1, Color c2, float ratio);
// drawing
int image_draw_rect(Image image, int x1, int y1, int x2, int y2, Color color);
int image_draw_circ(Image image, int x, int y, int r, Color color);
int image_draw_square(Image image, int x, int y, int s, Color color);
// bmp format specifics:
int image_save_bmp(Image image, char* path);

@ -46,16 +46,19 @@ void test_transparency() {
}
void test_4k_gradient() {
int width = 1920 * 4,
height = 1080 * 4;
printf("allocating image\n");
Image img;
image_new(1920 * 4,1080 * 4, &img);
image_new(width, height, &img);
printf("writing pixies\n");
for (int i = 0; i < 1920 * 4; i++) {
for (int j = 0; j < 1080 * 4; j++) {
float color = (j / (1080.0f * 4)) * 255;
image_set_px(img, i, j, (int) color, 255, 255);
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int color = ((j / ((float) height)) * 255);
image_set_px(img, i, j, color, 255, 255);
}
}

Loading…
Cancel
Save