img.h 484 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef IMG_H
  2. #define IMG_H
  3. #include <png.h>
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. typedef struct pix {
  7. int r;
  8. int g;
  9. int b;
  10. int a;
  11. }pix;
  12. typedef struct pix_row {
  13. int lenght;
  14. pix* p;
  15. }pix_row;
  16. typedef struct image {
  17. png_structp png_ptr;
  18. png_infop info_ptr;
  19. int width;
  20. int height;
  21. FILE *fp;
  22. } image;
  23. image initialize_png(char* title, char* filename, int width, int height);
  24. void write_image(image * img, pix_row * img_array);
  25. void finish_image(image * img);
  26. #endif