cbmp.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef CBMP_CBMP_H
  2. #define CBMP_CBMP_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. // Pixel structure
  7. // Not meant to be edited directly
  8. // Please use the API
  9. typedef struct pixel_data
  10. {
  11. unsigned char red;
  12. unsigned char green;
  13. unsigned char blue;
  14. unsigned char alpha;
  15. } pixel;
  16. // BMP structure
  17. // Not meant to be edited directly
  18. // Please use the API
  19. typedef struct BMP_data
  20. {
  21. unsigned int file_byte_number;
  22. unsigned char* file_byte_contents;
  23. unsigned int pixel_array_start;
  24. unsigned int width;
  25. unsigned int height;
  26. unsigned int depth;
  27. pixel* pixels;
  28. } BMP;
  29. // Public function declarations
  30. BMP* bopen(char* file_path);
  31. BMP* b_deep_copy(BMP* to_copy);
  32. int get_width(BMP* bmp);
  33. int get_height(BMP* bmp);
  34. unsigned int get_depth(BMP* bmp);
  35. void get_pixel_rgb(BMP* bmp, int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);
  36. void set_pixel_rgb(BMP* bmp, int x, int y, unsigned char r, unsigned char g, unsigned char b);
  37. void bwrite(BMP* bmp, char* file_name);
  38. void bclose(BMP* bmp);
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif // CBMP_CBMP_H