1 /*************************************************
3 * EasyBMP Cross-Platform Windows Bitmap Library *
5 * Author: Paul Macklin *
6 * email: macklin01@users.sourceforge.net *
7 * support: http://easybmp.sourceforge.net *
9 * file: EasyBMP_DataStructures.h *
10 * date added: 05-02-2005 *
11 * date modified: 12-01-2006 *
14 * License: BSD (revised/modified) *
15 * Copyright: 2005-6 by the EasyBMP Project *
17 * description: Defines basic data structures for *
20 *************************************************/
22 #ifndef _EasyBMP_Custom_Math_Functions_
23 #define _EasyBMP_Custom_Math_Functions_
24 inline double Square( double number )
25 { return number*number; }
27 inline int IntSquare( int number )
28 { return number*number; }
31 int IntPow( int base, int exponent );
33 #ifndef _EasyBMP_Defined_WINGDI
34 #define _EasyBMP_Defined_WINGDI
35 typedef unsigned char ebmpBYTE;
36 typedef unsigned short ebmpWORD;
37 typedef unsigned int ebmpDWORD;
40 #ifndef _EasyBMP_DataStructures_h_
41 #define _EasyBMP_DataStructures_h_
43 inline bool IsBigEndian()
46 if((*(char *)& word) != 0x01 )
51 inline ebmpWORD FlipWORD( ebmpWORD in )
52 { return ( (in >> 8) | (in << 8) ); }
54 inline ebmpDWORD FlipDWORD( ebmpDWORD in )
56 return ( ((in&0xFF000000)>>24) | ((in&0x000000FF)<<24) |
57 ((in&0x00FF0000)>>8 ) | ((in&0x0000FF00)<<8 ) );
60 // it's easier to use a struct than a class
61 // because we can read/write all four of the bytes
62 // at once (as we can count on them being continuous
65 typedef struct RGBApixel {
82 void SwitchEndianess( void );
92 ebmpDWORD biCompression;
93 ebmpDWORD biSizeImage;
94 ebmpDWORD biXPelsPerMeter;
95 ebmpDWORD biYPelsPerMeter;
97 ebmpDWORD biClrImportant;
100 void display( void );
101 void SwitchEndianess( void );