home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SAMPLES / SHOWGDI / DIB.H_ / DIB.H
Encoding:
C/C++ Source or Header  |  1993-02-08  |  3.2 KB  |  89 lines

  1. /****************************************************************************
  2.  DIB.h
  3.  
  4.  The DIB module handles loading and management of DIBs from files.
  5.  
  6. ****************************************************************************/
  7.  
  8.  
  9. /****************************************************************************
  10.    Constants
  11. ****************************************************************************/
  12.  
  13. /* Bit values for the DIB attributes flag (fFileOptions),
  14.    also used as control IDs for the radiobuttons for DIB bitcount 
  15.    in the File/Open dialog */
  16. #define F_1BPP        DLGOPEN_1BPP
  17. #define F_4BPP        DLGOPEN_4BPP
  18. #define F_8BPP        DLGOPEN_8BPP
  19. #define F_24BPP       DLGOPEN_24BPP
  20.  
  21. /* Bit values for the DIB attributes flag (fFileOptions), 
  22.    also used as control IDs for the radiobuttons for DIB compression type 
  23.    in the File/Open dialog */
  24. #define F_RLE4        DLGOPEN_RLE4
  25. #define F_RLE8        DLGOPEN_RLE8
  26. #define F_RGB         DLGOPEN_RGB
  27.  
  28. /* flags for _lseek */
  29. #define  SEEK_CUR  1
  30. #define  SEEK_END  2
  31. #define  SEEK_SET  0
  32.  
  33. /* Number of bytes to be read during each read operation. */
  34. #define MAXREAD  32768   
  35.  
  36. /* Header signatutes for various resources */
  37. #define BFT_ICON   0x4349   /* 'IC' */
  38. #define BFT_BITMAP 0x4d42   /* 'BM' */
  39. #define BFT_CURSOR 0x5450   /* 'PT' */
  40.  
  41. /* Macro to determine if resource is a DIB */
  42. #define ISDIB(bft) ((bft) == BFT_BITMAP)
  43.  
  44. /* Macro to align given value to the closest DWORD (unsigned long ) */
  45. #define ALIGNULONG(i)    (((i) + 3) / 4 * 4)
  46.  
  47. /* Macro to determine to round off the given value to the closest byte */
  48. #define WIDTHBYTES(i)    (((i) + 31) / 32 * 4)
  49.  
  50. #define PALVERSION       0x300
  51. #define MAXPALETTE       256      /* max # supported palette entries */
  52.  
  53.  
  54. /****************************************************************************
  55.    Globals
  56. ****************************************************************************/
  57.  
  58. extern HANDLE   curDIB;             /* current DIB */
  59. extern char     curDIBName[128];    /* name of current DIB file */
  60. extern POINT    curDIBSize;         /* size of current DIB */
  61.  
  62.  
  63. /****************************************************************************
  64.    Functions
  65. ****************************************************************************/
  66.  
  67. int OpenNewCurDIB( HWND parent );
  68.  
  69. HANDLE OpenDIB( LPSTR szFile );
  70. BOOL WriteDIB( LPSTR szFile,HANDLE hdib );
  71. WORD PaletteSize( VOID FAR * pv );
  72. WORD DibNumColors( VOID FAR * pv );
  73. HPALETTE CreateDibPalette( HANDLE hdib );
  74. HPALETTE CreateBIPalette( LPBITMAPINFOHEADER lpbi );
  75. HANDLE DibFromBitmap( HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal );
  76. HANDLE BitmapFromDib( HANDLE hdib, HPALETTE hpal );
  77. BOOL DibBlt( HDC hdc, int x0, int y0, HANDLE hdib, int x1, int y1, 
  78.              int dx, int dy, int startScan, int numScans );
  79. BOOL StretchDibBlt( HDC hdc, int x0, int y0, int dx, int dy, 
  80.                     HANDLE hdib, int x1, int y1, int dx1, int dy1, LONG rop );
  81. BOOL DibInfo( HANDLE hdib,LPBITMAPINFOHEADER lpbi );
  82. HANDLE ReadDibBitmapInfo( int fh );
  83. BOOL DrawBitmap( HDC hdc, int x, int y, HBITMAP hbm, DWORD rop );
  84.  
  85. DWORD PASCAL lread( int fh, VOID FAR *pv, DWORD ul );
  86. DWORD PASCAL lwrite( int fh, VOID FAR *pv, DWORD ul );
  87.  
  88.  
  89.