home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / itool3 / library / syspic.h < prev   
Encoding:
C/C++ Source or Header  |  1993-12-21  |  1.6 KB  |  47 lines

  1. /* This header is made for user defined modules in in which
  2.    Image Tools DLL or Image Tools LIB will be linked.
  3.    It is a short replacement for system.h, file.h and picture.h */
  4.  
  5. #ifndef SYSPIC_H
  6.   #define SYSPIC_H
  7.  
  8. #include <fcntl.h>
  9.  
  10. #define     MAX_FILE_NAME        127
  11.  
  12. #ifdef BORLAND
  13.     #pragma option -a-      /* Assume byte packing throughout */
  14. #endif
  15. /*
  16. #define USHORT                                WORD
  17. #define SHORT                                short
  18. #define ULONG                                DWORD
  19. #define LONG                            long
  20. */
  21. typedef WORD                            huge *LPHWORD;
  22. typedef BYTE                            huge *LPHBYTE;
  23. typedef char                            huge *LPHSTR;
  24.  
  25. #define ERR_CODE     WORD
  26.  
  27. // LIST of error codes of the ERR_CODE type
  28. #define    ERR_OK                0x0000    // there is no error
  29. #define    ERR                    0x8003
  30.  
  31. /* Three usefull macros */
  32. #define ROUND2LONG(x)    (((x & 3) == 0) ? (x) : ((x | 3) + 1))
  33. #define AllocFrame(x)    ((x).hPicture=GlobalAlloc(GPTR, (long)ROUND2LONG((x).iWidth*3)*(x).iHeight))
  34. #define FreeFrame(x)    {if((x).hPalette) DeleteObject((x).hPalette);if((x).hPicture) GlobalFree((x).hPicture);if((x).hBackground) GlobalFree((x).hBackground);}
  35.  
  36. typedef struct {
  37.     WORD        iWidth,        // picture dimensions
  38.                 iHeight;
  39.     HANDLE      hPicture;        // handle of memory allocation for picture bits
  40.     HANDLE      hBackground;    // handle of memory allocation for background bits
  41.                            //    ... for now only '.TGA' picture format
  42.     WORD          iNumBits,      // 8 or 24
  43.                   nPalEntries;   // number of optimized palette entries
  44.     HPALETTE      hPalette;      // handle of windows logic palette
  45. } FRAME, FAR *LPFRAME;
  46. #endif //SYSPIC
  47.