home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / Rop.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  3.6 KB  |  96 lines

  1. #pragma once
  2.  
  3. //-----------------------------------------------------------------------------------//
  4. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  5. //                             ISBN  0-13-086985-6                                   //
  6. //                                                                                   //
  7. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  8. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  9. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  10. //                                                                                   //
  11. //  FileName   : rop.h                                                                 //
  12. //  Description: Raster operation, MaskBlt, PlgBlt, TransparentBlt                   //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. bool inline RopNeedsNoDestination(int Rop)
  17. {
  18.     return ((Rop & 0xAA) >> 1) == (Rop & 0x55);
  19. }
  20.  
  21. bool inline RopNeedsNoSource(int Rop)
  22. {
  23.     return ((Rop & 0xCC) >> 2) == (Rop & 0x33);
  24. }
  25.  
  26. bool inline RopNeedsNoPattern(int Rop)
  27. {
  28.     return ((Rop & 0xF0) >> 4) == (Rop & 0x0F);
  29. }
  30.  
  31. inline bool D_independent(DWORD rop)
  32. {
  33.     return ((0xAA & rop)>>1)== (0x55 & rop);
  34. }
  35.  
  36. inline bool S_independent(DWORD rop)
  37. {
  38.     return ((0xCC & rop)>>2)== (0x33 & rop);
  39. }
  40.  
  41. class KImage;
  42.  
  43. DWORD GetRopCode(BYTE index);
  44.  
  45. // ChennelSplit using CDIB class
  46. void ChannelSplit(KImage & dib, HDC hDC);
  47.  
  48. // Create a grayscale image (DIBSection) from one of the RGB channels in a DIB
  49. // Mask should be RGB(255, 0, 0), RGB(0, 255, 0), or RGB(0, 0, 255)
  50. HBITMAP ChannelSplit(const BITMAPINFO * pBMI, const void * pBits, COLORREF Mask, HDC hMemDC);
  51.  
  52. // Gradually display a DIB on a destination surface in 4 steps
  53. void FadeIn(HDC hDC, int x, int y, int w, int h, const BITMAPINFO * pBMI, const void * pBits);
  54.  
  55. // dx, dy, dw, dh defines a destination rectangle
  56. // sw, sh is the dimension of source rectangle
  57. // sx, sy is the starting point winthin the source bitmap, which will be tiled to sw x sh in size
  58. BOOL StretchTile(HDC      hDC, int dx, int dy, int dw, int dh, 
  59.                  HBITMAP hSrc, int sx, int sy, int sw, int sh, 
  60.                  DWORD rop);
  61.  
  62. BOOL G_PlgBlt(HDC hdcDest, const POINT * pPoint, 
  63.             HDC hdcSrc, int nXSrc, int nYSrc, int nWidth, int nHeight, 
  64.             HBITMAP hbmMask, int xMask, int yMask);
  65.  
  66. BOOL AffineBlt(HDC hdcDest, const POINT * pPoint, 
  67.                HDC hdcSrc, int nXSrc, int nYSrc, int nWidth, int nHeight, DWORD rop);
  68.  
  69.  
  70. BOOL AffineTile(HDC hdcDest, const POINT * pPoint, 
  71.                 HBITMAP hSrc, int xMask, int yMask, int nWidth, int nHeight, DWORD rop);
  72.  
  73. BOOL C_PlgBlt(HDC hdcDest, const POINT * pPoint, 
  74.             HDC hdcSrc, int nXSrc, int nYSrc, int nWidth, int nHeight, 
  75.             HBITMAP hbmMask, int xMask, int yMask);
  76.  
  77.  
  78. void DrawCube(HDC hDC, int x, int y, int dh, int dx, int dy, HDC hMemDC, int w, int h, HBITMAP hMask, bool bSimulate);
  79.  
  80. void MaskCube(HDC hDC, int size, int x, int y, int w, int h, HBITMAP hBmp, HDC hMemDC, bool mask, bool bSimulate);
  81.  
  82.  
  83.  
  84. BOOL G_MaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
  85.              HDC hdcSrc,  int nXSrc,  int nYSrc, 
  86.              HBITMAP hbmMask, int xMask, int yMask,
  87.              DWORD dwRop);
  88.  
  89. // Use TransparentBlt to draw Icon
  90. void TransparentBltDrawIcon(HDC hDC, int x, int y, HICON hIcon);
  91.  
  92. // big pattern brush
  93. void MaskBitmapNT(HDC hDC, int x, int y, int width, int height, HBITMAP hMask, HDC hMemDC);
  94.  
  95. void MaskBltDrawIcon(HDC hDC, int x, int y, HICON hIcon);
  96.