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.
Anton Lydike a71e319fb4 refactored to produce correct object file 3 years ago
src refactored to produce correct object file 3 years ago
.gitignore multithreaded mandelbrot fun 5 years ago
README.md added declared methods to readme 5 years ago
test.c refactored to produce correct object file 3 years ago

README.md

images.h - Image manipulation in C

An easy to use image creation tool for C.

Features

  • Save images as .bmp bitmaps
  • Draw Rectangles, squares and circles
  • Colors with transparency
  • draw on individual pixels

Available methods:

// basic image operations
int image_new(int width, int height, Image* image);

int image_set_px(Image image, int x, int y, int r, int g, int b);
int image_set_px_c(Image image, int x, int y, Color color);

int image_destroy(Image image);

// colors
Color color_new(int r, int g, int b);
Color color_new_alpha(int r, int g, int b, float alpha);

Color color_mix(Color c1, Color c2, float ratio);

void print_color(Color c);

// drawing shapes
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);


Might be added later

  • draw lines
  • draw lines on a path
  • complex shapes?

Performance

While perfomance is not through the roof, creating a 4k image with a simple color gradient takes about 1.5s on a mobile ryzen 5 chip. Smaller graphics (like the transparency demo) are drawn and saved within 20ms, so that's okay, I guess...