You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
1.1 KiB

  1. #ifndef __FBG_JPEG_H__
  2. #define __FBG_JPEG_H__
  3. #include <stdint.h>
  4. #include <stdio.h>
  5. struct image_data {
  6. /* image buffer */
  7. uint8_t* data;
  8. /* image width */
  9. unsigned int width;
  10. /* image height */
  11. unsigned int height;
  12. /* image buffer size */
  13. unsigned long size;
  14. };
  15. /**
  16. * 载入一个jpeg文件
  17. * 失败返回NULL
  18. **/
  19. struct image_data* image_load_jpeg_file(char* filename);
  20. /**
  21. * 载入一个png文件
  22. * 失败返回NULL
  23. **/
  24. struct image_data* image_load_png_file(char* filename);
  25. /**
  26. * 根据name的扩展名载入图像文件
  27. * 失败返回NULL
  28. **/
  29. struct image_data* image_load_file(char* filename, char* name);
  30. /**
  31. * load file and resize.
  32. **/
  33. int image_load_file_resize(char* filename, char* name, struct image_data* result);
  34. /**
  35. * write out image to file.
  36. **/
  37. void image_write_jpeg_file(struct image_data* data, char* filename);
  38. /**
  39. * resize image
  40. **/
  41. void image_resize(struct image_data* original, struct image_data* target);
  42. /**
  43. * make image buffer
  44. **/
  45. struct image_data* image_make(int width, int height);
  46. /**
  47. * free image buffer
  48. **/
  49. void image_free(struct image_data* img);
  50. #endif //__FBG_JPEG_H__