home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Multimedia Jumpstart 1.1a / CD_ROM.BIN / develpmt / source / rleapp / dib.h < prev    next >
Text File  |  1992-09-12  |  3KB  |  70 lines

  1. /*----------------------------------------------------------------------------*\
  2. |   Routines for dealing with Device independent bitmaps                       |
  3. \*----------------------------------------------------------------------------*/
  4.  
  5. HANDLE      OpenDIB(LPSTR szFile);
  6. BOOL        WriteDIB(LPSTR szFile,HANDLE hdib);
  7. WORD        PaletteSize(VOID FAR * pv);
  8. WORD        DibNumColors(VOID FAR * pv);
  9. HPALETTE    CreateDibPalette(HANDLE hdib);
  10. HPALETTE    CreateBIPalette(LPBITMAPINFOHEADER lpbi);
  11. HPALETTE    CreateColorPalette(void);
  12. HPALETTE    CreateSystemPalette(void);
  13. HANDLE      DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal, WORD wUsage);
  14. HANDLE      DibFromDib(HANDLE hdib, DWORD biStyle, WORD biBits, HPALETTE hpal, WORD wUsage);
  15. HANDLE      BitmapFromDib(HANDLE hdib, HPALETTE hpal, WORD wUsage);
  16. BOOL        SetDibUsage(HANDLE hdib, HPALETTE hpal,WORD wUsage);
  17. BOOL        DibInfo(HANDLE hdib,LPBITMAPINFOHEADER lpbi);
  18. BOOL        ReadDibBitmapInfo(int fh, LPBITMAPINFOHEADER lpbi);
  19. BOOL        SetPalFlags(HPALETTE hpal, int iIndex, int cntEntries, WORD wFlags);
  20. BOOL        PalEq(HPALETTE hpal1, HPALETTE hpal2);
  21. BOOL        MapDib(HANDLE hdib, HPALETTE hpal);
  22. HANDLE      ResizeDib(HANDLE hdib, int dx, int dy);
  23.  
  24. BOOL        DrawBitmap(HDC hdc, int x, int y, HBITMAP hbm, DWORD rop);
  25. VOID        DrawDib(HDC hdc, int x, int y, HANDLE hdib, HPALETTE hpal, WORD wUsage);
  26. BOOL        StretchBitmap(HDC hdc, int x, int y, int dx, int dy, HBITMAP hbm, int x0, int y0, int dx0, int dy0, DWORD rop);
  27.  
  28. BOOL        DibBlt(HDC hdc, int x0, int y0, int dx, int dy, HANDLE hdib, int x1, int y1, LONG rop, WORD wUsage);
  29. BOOL        StretchDibBlt(HDC hdc, int x, int y, int dx, int dy, HANDLE hdib, int x0, int y0, int dx0, int dy0, LONG rop, WORD wUsage);
  30.  
  31. LPVOID      DibLock(HANDLE hdib,int x, int y);
  32. VOID        DibUnlock(HANDLE hdib);
  33. LPVOID      DibXY(LPBITMAPINFOHEADER lpbi,int x, int y);
  34. HANDLE      CreateDib(int bits, int dx, int dy);
  35. HANDLE      CopyDib (HANDLE hdib);
  36.  
  37. #define BFT_ICON   0x4349   /* 'IC' */
  38. #define BFT_BITMAP 0x4d42   /* 'BM' */
  39. #define BFT_CURSOR 0x5450   /* 'PT' */
  40.  
  41. #define ISDIB(bft) ((bft) == BFT_BITMAP)
  42. #define ALIGNULONG(i)     ((i+3)&(~3))                  /* ULONG aligned ! */
  43. #define WIDTHBYTES(i)     ((unsigned)((i+31)&(~31))/8)  /* ULONG aligned ! */
  44. #define DIBWIDTHBYTES(bi) (int)WIDTHBYTES((int)(bi).biWidth * (int)(bi).biBitCount)
  45.  
  46. #define DIBSIZE(dibselector) (((LPBITMAPINFOHEADER)GLock(dibselector))->biSizeImage)
  47.  
  48. #define DibPtr(hdib) ((LPBYTE)GLock(hdib) + \
  49.             (int)((LPBITMAPINFOHEADER)GLock(hdib))->biSize + \
  50.             (int)((LPBITMAPINFOHEADER)GLock(hdib))->biClrUsed * sizeof(RGBQUAD) )
  51.  
  52. #define PALVERSION      0x300
  53. #define MAXPALETTE      256
  54.  
  55. typedef struct {
  56.       DWORD       biSize;
  57.       DWORD       biWidth;
  58.       DWORD       biHeight;
  59.       WORD       biPlanes;
  60.       WORD       biBitCount;
  61.     DWORD       biCompression;
  62.     DWORD       biSizeImage;
  63.     DWORD       biXPelsPerMeter;
  64.     DWORD       biYPelsPerMeter;
  65.     DWORD       biClrUsed;
  66.         DWORD      biClrImportant;
  67.  
  68.         RGBQUAD    argb[MAXPALETTE];
  69. } DIB8, FAR *LPDIB8;
  70.