| 1 | #ifndef _BMG_UTILS_H_ |
| 2 | #define _BMG_UTILS_H_ |
| 3 | /* |
| 4 | some handy utilities used in several units |
| 5 | |
| 6 | Copyright 2001 |
| 7 | M. Scott Heiman |
| 8 | All Rights Reserved |
| 9 | */ |
| 10 | |
| 11 | #include "BMGImage.h" |
| 12 | #include "../osal_preproc.h" |
| 13 | |
| 14 | /* the following 3 functions are used to access the background color |
| 15 | // and the background image */ |
| 16 | void InitBackground(void); |
| 17 | |
| 18 | unsigned char *GetBackgroundColor(void); |
| 19 | |
| 20 | struct BMGImageStruct *GetBackgroundImage(void); |
| 21 | |
| 22 | /* creates a 24 bpp image from a 16 bpp image */ |
| 23 | BMGError Convert16to24( struct BMGImageStruct *img ); |
| 24 | |
| 25 | /* converts an array of 1-bit scanlines to 8-bit scanlines */ |
| 26 | void Convert1to8( struct BMGImageStruct img, |
| 27 | unsigned char *out ); |
| 28 | |
| 29 | /* converts an array of 4-bit scanlines to 8-bit scanlines */ |
| 30 | void Convert4to8( struct BMGImageStruct img, |
| 31 | unsigned char *out ); |
| 32 | |
| 33 | unsigned char AlphaComp( unsigned char fg, |
| 34 | unsigned char alpha, |
| 35 | unsigned char bg ); |
| 36 | |
| 37 | unsigned char InverseAlphaComp( unsigned char fg, |
| 38 | unsigned char alpha, |
| 39 | unsigned char bg ); |
| 40 | |
| 41 | BITMAPINFO InternalCreateBMI( unsigned int dwWidth, /* width */ |
| 42 | unsigned int dwHeight, /* height */ |
| 43 | unsigned short wBitCount, /* bit count */ |
| 44 | int compression ); /* compression type */ |
| 45 | |
| 46 | void SetLastBMGError( BMGError err ); |
| 47 | |
| 48 | /* the following 4 functions are for dealing with file formats |
| 49 | that store data in big endian format */ |
| 50 | short SwapShort( short in ); |
| 51 | unsigned short SwapUShort( unsigned short in ); |
| 52 | int SwapLong( int in ); |
| 53 | unsigned int SwapULong( unsigned int in ); |
| 54 | |
| 55 | #endif |
| 56 | |