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.

53 lines
1.1 KiB
C

#ifndef IMAGES_H
#define IMAGES_H "v0.1.1"
typedef struct _color {
unsigned char r;
unsigned char g;
unsigned char b;
float alpha;
} Color;
typedef struct _image {
unsigned char** bitmap;
int width;
int height;
} Image;
// basic image manipulation
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_check_coords(Image image, int x, int y);
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);
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, const char* path);
#include "images.c"
#include "bmp-format.c"
#include "color.c"
#include "drawing.c"
#endif