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.
59 lines
1.4 KiB
C
59 lines
1.4 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 (src/images.c)
|
|
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 (src/color.c)
|
|
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);
|
|
|
|
// drawingn (src/drawing.c)
|
|
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: (src/bmp-format.c)
|
|
int image_save_bmp(Image image, const char* path);
|
|
|
|
|
|
// multithreading enabled: (src/multithreading.c)
|
|
int image_new_shared(int width, int height, Image* img);
|
|
|
|
void image_destroy_shared(Image img);
|
|
|
|
void* create_shared_memory(size_t size);
|
|
|
|
#include "src/images.c"
|
|
#include "src/bmp-format.c"
|
|
#include "src/color.c"
|
|
#include "src/drawing.c"
|
|
#include "src/multithreading.c"
|
|
|
|
#endif |