Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

bmp.h

00001 /***************************************************************************
00002                           bmp.h  -  description
00003                              -------------------
00004     begin                : Fri Jun 27 2003
00005     copyright            : (C) 2003 by Jacques Gasselin de Richebourg
00006     email                : jacquesgasselin@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *
00024  *                                                                         *
00025  ***************************************************************************/
00026 
00027 #ifndef BITMAP_H
00028 #define BITMAP_H
00029 
00030 #ifdef __cplusplus
00031 extern "C"
00032 {
00033 #endif
00034 
00038 typedef short word_t;
00039 typedef unsigned dword_t;
00040 
00041 typedef struct 
00042 {
00043    word_t   fileType;     /* specifies file type must be BM (4D42h) */
00044    dword_t  fileSize;     /* file size in bytes (54) */
00045    word_t   res1;         /* must be 0 */
00046    word_t   res2;         /* must be 0 */
00047    dword_t  imageOffset;  /* offset in bytes from the header to the data (40) */
00048 } BitmapFileHeader ;
00049 
00060 typedef struct 
00061 {
00062    dword_t  infoSize;     /* information header size in bytes (40) */
00063    dword_t  imageWidth;   /* width of the bitmap in pixels (0) */
00064    dword_t  imageHeight;  /* height of the bitmap in pixels (0) */
00065    word_t   colourPlanes; /* must be 1 */
00066    word_t   bitCount;     /* bits per pixel, 1, 4, 8, 16, (24), 32 */
00067    dword_t  compression;  /* compression type (0) */
00068    dword_t  imageSize;    /* size of image in bytes (0) */
00069    dword_t  pixelsX;      /* number of pixels in x per meter (2834) */
00070    dword_t  pixelsY;      /* number of pixels in y per meter (2834) */
00071    dword_t  numColours;   /* number of colours used in the image (0) */
00072    dword_t  numImportant; /* number of important colours (0) */
00073    char*   paletteData; /* the palette data that may follow */
00074 } BitmapInfoHeader;
00075 
00076 
00081 typedef struct 
00082 {
00083    BitmapFileHeader  fileHeader;
00084    BitmapInfoHeader  infoHeader;
00085    unsigned char*    imageData;
00086 } BitmapFileStructure;
00087 
00088 
00094 typedef struct 
00095 {
00096    BitmapFileStructure fileStructure;
00097    char* fileName;
00098 } BitmapFile;
00099 
00104 void initBitmapFile(BitmapFile*);
00105 void saveBitmapFile(BitmapFile*);
00106 void loadBitmapFile(BitmapFile*);
00107 void deleteBitmapFile(BitmapFile*);
00108 
00109 void setBitmapFileName(BitmapFile*, const char*);
00110 
00115 dword_t getBitmapWidth(BitmapFile*);
00116 dword_t getBitmapHeight(BitmapFile*);
00117 word_t getBitmapBpp(BitmapFile*);
00118 dword_t getBitmapImageSize(BitmapFile*);
00119 
00120 void setBitmapWidth(BitmapFile*, dword_t);
00121 void setBitmapHeight(BitmapFile*, dword_t);
00122 void setBitmapBpp(BitmapFile*, word_t);
00123 
00124 void setBitmapDimensions(BitmapFile*, dword_t w, dword_t h, word_t bpp);
00125 
00130 dword_t getBitmapPaletteSize(BitmapFile*);
00131 const char* getBitmapPalette(BitmapFile*);
00132 
00133 void setBitmapPaletteSize(BitmapFile*, dword_t);
00134 
00135 void setBitmapPalette(BitmapFile*, const char* );
00136 
00137 
00142 const unsigned char* getBitmapImageData(BitmapFile*);
00143 void setBitmapImageData(BitmapFile*, const unsigned char*);
00144 
00145 #ifdef __cplusplus
00146 }
00147 #endif
00148 
00149 #endif

Generated on Wed Feb 4 23:11:33 2004 by doxygen 1.3.3