Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
3.4 KiB

  1. /****************************************************************************
  2. * *
  3. * FILE : SHOWDIB.H *
  4. * *
  5. * DESCRIPTION : Header/include file for ShowDIB example. *
  6. * *
  7. ****************************************************************************/
  8. /* Macro to restrict a given value to an upper or lower boundary value */
  9. #define BOUND(x,min,max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x)))
  10. /* Macro to swap two values */
  11. #define SWAP(x,y) ((x)^=(y)^=(x)^=(y))
  12. /* Macro to find the minimum of two values */
  13. #define MIN(x,y) (((x) <= (y)) : x ? y)
  14. /* Macros to display/remove hourglass cursor for lengthy operations */
  15. #define StartWait() hcurSave = SetCursor(LoadCursor(NULL,IDC_WAIT))
  16. #define EndWait() SetCursor(hcurSave)
  17. #define MINBAND 50 /* Minimum band size used by the program */
  18. #define BANDINCREMENT 20 /* Decrement for band size while trying */
  19. /* to determine optimum band size. */
  20. /* macro to determine if resource is a DIB */
  21. #define ISDIB(bft) ((bft) == BFT_BITMAP)
  22. /* Macro to align given value to the closest DWORD (unsigned long ) */
  23. #define ALIGNULONG(i) ((i+3)/4*4)
  24. /* Macro to determine to round off the given value to the closest byte */
  25. #define WIDTHBYTES(i) ((i+31)/32*4)
  26. #define PALVERSION 0x300
  27. #define MAXPALETTE 256 /* max. # supported palette entries */
  28. /***************** GLOBAL VARIABLES *************************/
  29. extern char achFileName[128]; /* File pathname */
  30. extern DWORD dwOffset; /* Current position if DIB file pointer */
  31. extern RECT rcClip; /* Current clip rectangle. */
  32. extern BOOL fPalColors; /* TRUE if the current DIB's color table */
  33. /* contains palette indexes not rgb values */
  34. extern BOOL bDIBToDevice; /* Use SetDIBitsToDevice() to BLT data. */
  35. extern BOOL bLegitDraw; /* We have a valid bitmap to draw */
  36. extern WORD wTransparent; /* Mode of DC */
  37. extern char szAppName[]; /* App. name */
  38. extern HPALETTE hpalCurrent; /* Handle to current palette */
  39. extern HANDLE hdibCurrent; /* Handle to current memory DIB */
  40. extern HBITMAP hbmCurrent; /* Handle to current memory BITMAP */
  41. extern HANDLE hbiCurrent; /* Handle to current bitmap info struct */
  42. extern DWORD dwStyle; /* Style bits of the App. window */
  43. /***********************************************************/
  44. /* Declarations of functions used in dib.c module */
  45. /***********************************************************/
  46. WORD PaletteSize (VOID FAR * pv);
  47. WORD DibNumColors (VOID FAR * pv);
  48. HANDLE DibFromBitmap (HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal);
  49. HBITMAP BitmapFromDib (HANDLE hdib, HPALETTE hpal);