Bmp.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*************************************************************************
  2. file created on: 2002/08/30 19:33
  3. filename: Bmp.h
  4. author: Andreas Hartl<andy@runicsoft.com>
  5. visit http://www.runicsoft.com for updates and more information
  6. purpose: functions to load raw bmp data,
  7. to save raw bmp data,
  8. to convert RGB data to raw bmp data,
  9. to convert raw bmp data to RGB data
  10. and to use the WinAPI to select
  11. a bitmap into a device context
  12. The code in this file is subject to the RunicSoft source code licence
  13. ( http://www.runicsoft.com/sourcelicence.txt )
  14. **************************************************************************/
  15. typedef struct tagBITMAPFILEHEADER
  16. {
  17. WORD bfType __attribute__ ((packed));
  18. DWORD bfSize __attribute__ ((packed));
  19. WORD bfReserved1 __attribute__ ((packed));
  20. WORD bfReserved2 __attribute__ ((packed));
  21. DWORD bfOffBits __attribute__ ((packed));
  22. } BITMAPFILEHEADER;
  23. typedef struct tagBITMAPINFOHEADER
  24. {
  25. DWORD biSize;
  26. DWORD biWidth;
  27. DWORD biHeight;
  28. WORD biPlanes;
  29. WORD biBitCount;
  30. DWORD biCompression;
  31. DWORD biSizeImage;
  32. DWORD biXPelsPerMeter;
  33. DWORD biYPelsPerMeter;
  34. DWORD biClrUsed;
  35. DWORD biClrImportant;
  36. } BITMAPINFOHEADER;
  37. #define BI_RGB 0
  38. byte *ConvertRGBToBMPBuffer(byte * Buffer, int width, int height,
  39. int *newsize);
  40. byte *ConvertBMPToRGBBuffer(byte * Buffer, int width, int height);
  41. int SaveBMP(FILE * file, byte * Buffer, int width, int height,
  42. int paddedsize);
  43. byte *LoadBMP(KFILE * file, int *width, int *height, int *size);