Leptonica 1.68
C Image Processing Library

bmp.h

Go to the documentation of this file.
00001 /*====================================================================*
00002  -  Copyright (C) 2001 Leptonica.  All rights reserved.
00003  -  This software is distributed in the hope that it will be
00004  -  useful, but with NO WARRANTY OF ANY KIND.
00005  -  No author or distributor accepts responsibility to anyone for the
00006  -  consequences of using this software, or for whether it serves any
00007  -  particular purpose or works at all, unless he or she says so in
00008  -  writing.  Everyone is granted permission to copy, modify and
00009  -  redistribute this source code, for commercial or non-commercial
00010  -  purposes, with the following restrictions: (1) the origin of this
00011  -  source code must not be misrepresented; (2) modified versions must
00012  -  be plainly marked as such; and (3) this notice may not be removed
00013  -  or altered from any source or modified source distribution.
00014  *====================================================================*/
00015 
00016 #ifndef  LEPTONICA_BMP_H
00017 #define  LEPTONICA_BMP_H
00018 
00019 /*
00020  * This file is here to describe the fields in the header of
00021  * the BMP file.  These fields are not used directly in Leptonica.
00022  * The only thing we use are the sizes of these two headers.
00023  * Furthermore, because of potential namespace conflicts with
00024  * the typedefs and defined sizes, we have changed the names
00025  * to protect anyone who may also need to use the original definitions.
00026  * Thanks to J. D. Bryan for pointing out the potential problems when
00027  * developing on Win32 compatible systems.
00028  */
00029 
00030 /*-------------------------------------------------------------*
00031  *                       BMP file header                       *
00032  *-------------------------------------------------------------*/
00033 struct BMP_FileHeader
00034 {
00035     l_int16        bfType;                /* file type; must be "BM" */
00036     l_int16        bfSize;                /* length of the file;
00037                                    sizeof(BMP_FileHeader) +
00038                                    sizeof(BMP_InfoHeader) +
00039                                    size of color table +
00040                                    size of DIB bits */
00041     l_int16        bfFill1;        /* remainder of the bfSize field */
00042     l_int16        bfReserved1;        /* don't care (set to 0)*/
00043     l_int16        bfReserved2;        /* don't care (set to 0)*/
00044     l_int16        bfOffBits;        /* offset from beginning of file */
00045     l_int16        bfFill2;        /* remainder of the bfOffBits field */
00046 };
00047 typedef struct BMP_FileHeader  BMP_FH;
00048 
00049 #define BMP_FHBYTES  sizeof(BMP_FH)
00050 
00051 
00052 /*-------------------------------------------------------------*
00053  *                       BMP info header                       *
00054  *-------------------------------------------------------------*/
00055 struct BMP_InfoHeader
00056 {
00057     l_int32        biSize;                  /* size of the BMP_InfoHeader struct */
00058     l_int32        biWidth;         /* bitmap width in pixels */
00059     l_int32        biHeight;         /* bitmap height in pixels */
00060     l_int16        biPlanes;         /* number of bitmap planes */
00061     l_int16        biBitCount;         /* number of bits per pixel */
00062     l_int32        biCompression;         /* compression format (0 == uncompressed) */
00063     l_int32        biSizeImage;         /* size of image in bytes */
00064     l_int32        biXPelsPerMeter; /* pixels per meter in x direction */
00065     l_int32        biYPelsPerMeter; /* pixels per meter in y direction */
00066     l_int32        biClrUsed;          /* number of colors used */
00067     l_int32        biClrImportant;         /* number of important colors used */
00068 };
00069 typedef struct BMP_InfoHeader  BMP_IH;
00070 
00071 #define BMP_IHBYTES  sizeof(BMP_IH)
00072 
00073  
00074 #endif  /* LEPTONICA_BMP_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines