ico.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * ICO save/load. ICO is a container for one+ PNG/BMP images.
  3. */
  4. #ifndef __ICO_H__
  5. #define __ICO_H__
  6. #include <stdint.h>
  7. #define ICO_TYPE_ICO 1
  8. #define ICO_TYPE_CURSOR 2
  9. // ICO file header
  10. typedef struct __attribute__((packed)) _ICONDIR_IcoHeader {
  11. uint16_t reserved; // Reserved, always 0
  12. uint16_t type; // 1 for ICO, 2 for CUR
  13. uint16_t image_count; // Number of images in the file
  14. } ICONDIR_IcoHeader;
  15. // ICO image header
  16. typedef struct __attribute__((packed)) _ICONDIRENTRY_IcoHeader {
  17. uint8_t width; // Width of the icon in pixels (0 for 256)
  18. uint8_t height; // Height of the icon in pixels (0 for 256
  19. uint8_t number_of_colors; // Number of colors, not used in our case
  20. uint8_t reserved; // Reserved, always 0
  21. uint16_t color_planes; // Color planes, always 1
  22. uint16_t bpp; // Bits per pixel
  23. uint32_t data_size; // Image data size
  24. uint32_t data_offset; // Image data offset, always 22
  25. } ICONDIRENTRY_IcoHeader;
  26. // defined in icosave.c
  27. int vips_icosave_target_go(VipsImage *in, VipsTarget *target, ImgproxySaveOptions opts);
  28. // defined in icoload.c
  29. VIPS_API
  30. int icoload_source(VipsSource *source, VipsImage **out, ...)
  31. G_GNUC_NULL_TERMINATED;
  32. int vips_icoload_source_go(VipsImgproxySource *source, VipsImage **out, ImgproxyLoadOptions lo);
  33. #endif