www.pudn.com > imgproc.zip > IMAGE.H


//**************************************************************** 
//  Image process tool box 
//     by Yang Yudong 
// 
// File : image.h 
// Description:  image basic defination and manipulation routines header file 
// Create Date:  1993. 10. 27 
// Modification(date/where):   1995. 11. 14  enhanced imagedes   
// Modification(date/where):   1996.  9. 25  reformatted as standard 
// 
//**************************************************************** 
 
#ifndef _INC_IMAGE 
 
#ifndef max 
#define max(a,b) ((a)>(b)?(a):(b)) 
#define min(a,b) ((a)>(b)?(b):(a)) 
#endif 
 
#ifndef WORD 
typedef unsigned short int WORD; 
#endif 
#ifndef BYTE 
typedef unsigned char  BYTE; 
#endif 
#ifndef DWORD 
typedef unsigned long  DWORD; 
#endif 
#ifndef LONG 
typedef long  LONG; 
#endif 
#ifndef SHORT 
typedef short int SHORT; 
#endif 
 
 
#ifndef BOOL 
#undef  FALSE 
#undef  TRUE 
typedef enum {FALSE=0, TRUE=0x0fff} BOOL; 
#endif 
#ifndef ImageType 
typedef enum {TrueColor=0x0fff, Color256, Grey, Gray=Grey}  ImageType; 
#endif 
#ifndef RGB 
typedef struct {BYTE r,g,b;}   RGB; 
// defination of image descripter 
typedef  struct { 
 BOOL       alloc;      // flag used to indicate if memory has been allocated 
 BOOL       load;       // flag used to indicate if it has been loaded 
 ImageType  imagetype;  // flag used to indicate image type 
 int        xsize;      // xsize of image 
 int        ysize;      // ysize of image 
 BYTE  *    r;          // red/grey/color256  image buffer pointer 
 BYTE  *    g;          // green image buffer pointer 
 BYTE  *    b;          // blue  image buffer pointer 
 RGB   *    pal;        // palette pointer defination. Only used with color256 image 
} imagedes; 
 
typedef struct { 
  int xstart, ystart; 
  int xend, yend; 
} rects; 
 
#endif 
 
typedef enum {     // This defines the interpolation type of interpolation routines 
  Interp_normal,   // or bilinear interpolation (medium speed) 
  Interp_fast,     // or near neighbor interpolation (palette image can only do this) (fastest speed) 
  Interp_fine      // or bicubic interpolation (slowest speed) 
 } Interp; 
   
 
 
// imgalloc.c 
BOOL AllocPicture(imagedes *picture, int xsize, int ysize, ImageType imagetype); 
void FreePicture(imagedes *picture); 
 
// imgc24_8.c 
BOOL img_color24to8(imagedes* des, imagedes src, int num_of_color, int min_index); 
// imgc2g.c 
BOOL img_color2grey(imagedes *img); 
// img_c24.c 
BOOL img_to_color24(imagedes *img); 
 
// imgcopy.c 
BOOL img_newcopy(imagedes *des, imagedes src); 
BOOL img_copyblock(imagedes *des, imagedes src, int xs, int ys, int x, int y); 
BOOL img_copybilt(imagedes *des, imagedes src, 
		  int xs, int ys, int x, int y, int dx, int dy, BYTE fills); 
 
extern void __busy(int percent); 
#define _INC_IMAGE 
#endif