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.

38 lines
948 B
C

5 years ago
#include <stdlib.h>
#include <stdio.h>
#include "images/images.h"
int main(int argc, char* argv[]) {
Image img;
image_new(512,512, &img);
5 years ago
Color* green = color_new(0,255,0);
Color* purple = color_new(125,17,249);
image_draw_rect(&img, 255, 0, 512, 255, green);
image_draw_rect(&img, 0, 255, 255, 512, purple);
5 years ago
for (int i = 0; i < 255; i++) {
for (int j = 0; j < 255; j++) {
image_set_px(&img, i, j, i, 0, 0);
}
}
for (int i = 0; i <= 256; i++) {
for (int j = 0; j <= 256; j++) {
image_set_px(&img, i + 255, j + 255, j, j, 255);
5 years ago
}
}
printf("Writing file to /home/anton/projects/mona/chaos/test.bmp\n");
if (!image_save(&img, "/home/anton/projects/mona/chaos/test.bmp")) {
printf("Error writing file!\n");
} else {
printf("Wrote file successfully\n");
}
image_destroy(&img);
free(green);
free(purple);
5 years ago
}