Subversion Repositories Kolibri OS

Rev

Rev 8107 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef KOLIBRI_LIBIMG_H
  2. #define KOLIBRI_LIBIMG_H
  3.  
  4. #include <stddef.h>
  5. extern int kolibri_libimg_init(void);
  6.  
  7. //list of format id's
  8. #define LIBIMG_FORMAT_BMP       1
  9. #define LIBIMG_FORMAT_ICO       2
  10. #define LIBIMG_FORMAT_CUR       3
  11. #define LIBIMG_FORMAT_GIF       4
  12. #define LIBIMG_FORMAT_PNG       5
  13. #define LIBIMG_FORMAT_JPEG      6
  14. #define LIBIMG_FORMAT_TGA       7
  15. #define LIBIMG_FORMAT_PCX       8
  16. #define LIBIMG_FORMAT_XCF       9
  17. #define LIBIMG_FORMAT_TIFF      10
  18. #define LIBIMG_FORMAT_PNM       11
  19. #define LIBIMG_FORMAT_WBMP      12
  20. #define LIBIMG_FORMAT_XBM       13
  21. #define LIBIMG_FORMAT_Z80       14
  22.  
  23. #define IMAGE_BPP8i  1  // indexed
  24. #define IMAGE_BPP24  2
  25. #define IMAGE_BPP32  3
  26. #define IMAGE_BPP15  4
  27. #define IMAGE_BPP16  5
  28. #define IMAGE_BPP1   6
  29. #define IMAGE_BPP8g  7  // grayscale
  30. #define IMAGE_BPP2i  8
  31. #define IMAGE_BPP4i  9
  32. #define IMAGE_BPP8a 10
  33.  
  34. //error codes
  35. #define LIBIMG_ERROR_OUT_OF_MEMORY      1
  36. #define LIBIMG_ERROR_FORMAT             2
  37. #define LIBIMG_ERROR_CONDITIONS         3
  38. #define LIBIMG_ERROR_BIT_DEPTH          4
  39. #define LIBIMG_ERROR_ENCODER            5
  40. #define LIBIMG_ERROR_SRC_TYPE           6
  41. #define LIBIMG_ERROR_SCALE              7
  42. #define LIBIMG_ERROR_INTER              8
  43. #define LIBIMG_ERROR_NOT_INPLEMENTED    9
  44. #define LIBIMG_ERROR_INVALID_INPUT      10
  45.  
  46. //encode flags (byte 0x02 of _common option)
  47. #define LIBIMG_ENCODE_STRICT_SPECIFIC   0x01
  48. #define LIBIMG_ENCODE_STRICT_BIT_DEPTH  0x02
  49. #define LIBIMG_ENCODE_DELETE_ALPHA      0x08
  50. #define LIBIMG_ENCODE_FLUSH_ALPHA       0x10
  51.  
  52.  
  53. #define FLIP_VERTICAL   0x01
  54. #define FLIP_HORIZONTAL 0x02
  55.  
  56. #define ROTATE_90_CW    0x01
  57. #define ROTATE_180      0x02
  58. #define ROTATE_270_CW   0x03
  59. #define ROTATE_90_CCW   ROTATE_270_CW
  60. #define ROTATE_270_CCW  ROTATE_90_CW
  61.  
  62. extern void*    (*img_decode __attribute__((__stdcall__)))(void* file_data, uint32_t length, uint32_t options);
  63. extern void*    (*img_encode __attribute__((__stdcall__)))(void* image_data, uint32_t length, uint32_t option);
  64. extern void*    (*img_create __attribute__((__stdcall__)))(uint32_t width, uint32_t height, uint32_t type);
  65. extern void     (*img_to_rgb2 __attribute__((__stdcall__)))(void* image_data, void *rgb_data);
  66. extern void*    (*img_to_rgb __attribute__((__stdcall__)))(void *image_data);
  67. extern uint32_t (*img_flip __attribute__((__stdcall__)))(void* image_data, uint32_t flip);
  68. extern uint32_t (*img_flip_layer __attribute__((__stdcall__)))(void *image_data, uint32_t flip);
  69. extern uint32_t (*img_rotate __attribute__((__stdcall__)))(void* image_data, uint32_t rotate);
  70. extern uint32_t (*img_rotate_layer __attribute__((__stdcall__)))(void* image_data, uint32_t rotate);
  71. extern void     (*img_draw __attribute__((__stdcall__)))(void *image_data, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t xoff,  uint32_t yoff);
  72. extern uint32_t (*img_count __attribute__((__stdcall__)))(void *image_data);
  73. extern uint32_t (*img_destroy __attribute__((__stdcall__)))(void *image_data);
  74. extern uint32_t (*img_destroy_layer __attribute__((__stdcall__)))(void* image_data);
  75.  
  76. #endif /* KOLIBRI_LIBIMG_H */
  77.