/ocr/ocrservice/jni/hydrogen/include/leptonica/bmp.h

http://eyes-free.googlecode.com/ · C++ Header · 74 lines · 31 code · 9 blank · 34 comment · 0 complexity · eb1ad37dd1d00b30106b8d257073bc02 MD5 · raw file

  1. /*====================================================================*
  2. - Copyright (C) 2001 Leptonica. All rights reserved.
  3. - This software is distributed in the hope that it will be
  4. - useful, but with NO WARRANTY OF ANY KIND.
  5. - No author or distributor accepts responsibility to anyone for the
  6. - consequences of using this software, or for whether it serves any
  7. - particular purpose or works at all, unless he or she says so in
  8. - writing. Everyone is granted permission to copy, modify and
  9. - redistribute this source code, for commercial or non-commercial
  10. - purposes, with the following restrictions: (1) the origin of this
  11. - source code must not be misrepresented; (2) modified versions must
  12. - be plainly marked as such; and (3) this notice may not be removed
  13. - or altered from any source or modified source distribution.
  14. *====================================================================*/
  15. #ifndef LEPTONICA_BMP_H
  16. #define LEPTONICA_BMP_H
  17. /*
  18. * This file is here to describe the fields in the header of
  19. * the BMP file. These fields are not used directly in Leptonica.
  20. * The only thing we use are the sizes of these two headers.
  21. * Furthermore, because of potential namespace conflicts with
  22. * the typedefs and defined sizes, we have changed the names
  23. * to protect anyone who may also need to use the original definitions.
  24. * Thanks to J. D. Bryan for pointing out the potential problems when
  25. * developing on Win32 compatible systems.
  26. */
  27. /*-------------------------------------------------------------*
  28. * BMP file header *
  29. *-------------------------------------------------------------*/
  30. struct BMP_FileHeader
  31. {
  32. l_int16 bfType; /* file type; must be "BM" */
  33. l_int16 bfSize; /* length of the file;
  34. sizeof(BMP_FileHeader) +
  35. sizeof(BMP_InfoHeader) +
  36. size of color table +
  37. size of DIB bits */
  38. l_int16 bfFill1; /* remainder of the bfSize field */
  39. l_int16 bfReserved1; /* don't care (set to 0)*/
  40. l_int16 bfReserved2; /* don't care (set to 0)*/
  41. l_int16 bfOffBits; /* offset from beginning of file */
  42. l_int16 bfFill2; /* remainder of the bfOffBits field */
  43. };
  44. typedef struct BMP_FileHeader BMP_FH;
  45. #define BMP_FHBYTES sizeof(BMP_FH)
  46. /*-------------------------------------------------------------*
  47. * BMP info header *
  48. *-------------------------------------------------------------*/
  49. struct BMP_InfoHeader
  50. {
  51. l_int32 biSize; /* size of the BMP_InfoHeader struct */
  52. l_int32 biWidth; /* bitmap width in pixels */
  53. l_int32 biHeight; /* bitmap height in pixels */
  54. l_int16 biPlanes; /* number of bitmap planes */
  55. l_int16 biBitCount; /* number of bits per pixel */
  56. l_int32 biCompression; /* compression format (0 == uncompressed) */
  57. l_int32 biSizeImage; /* size of image in bytes */
  58. l_int32 biXPelsPerMeter; /* pixels per meter in x direction */
  59. l_int32 biYPelsPerMeter; /* pixels per meter in y direction */
  60. l_int32 biClrUsed; /* number of colors used */
  61. l_int32 biClrImportant; /* number of important colors used */
  62. };
  63. typedef struct BMP_InfoHeader BMP_IH;
  64. #define BMP_IHBYTES sizeof(BMP_IH)
  65. #endif /* LEPTONICA_BMP_H */