CImage::TransparentBlt

複製來源裝置內容的點陣圖加入至目前的裝置內容。

BOOL TransparentBlt(
   HDC hDestDC,
   int xDest,
   int yDest,
   int nDestWidth,
   int nDestHeight,
   UINT crTransparent = CLR_INVALID 
) const throw( );
BOOL TransparentBlt(
   HDC hDestDC,
   const RECT& rectDest,
   UINT crTransparent = CLR_INVALID 
) const throw( );
BOOL TransparentBlt(
   HDC hDestDC,
   int xDest,
   int yDest,
   int nDestWidth,
   int nDestHeight,
   int xSrc,
   int ySrc,
   int nSrcWidth,
   int nSrcHeight,
   UINT crTransparent = CLR_INVALID 
) const throw( );
BOOL TransparentBlt(
   HDC hDestDC,
   const RECT& rectDest,
   const RECT& rectSrc,
   UINT crTransparent = CLR_INVALID 
) const throw( );

參數

  • hDestDC
    為目的裝置內容的控制代碼。

  • xDest
    X 座標,以邏輯單位,目的端矩形的左上角。

  • yDest
    Y 座標,以邏輯單位,目的端矩形的左上角。

  • nDestWidth
    的寬度,以邏輯單位,目的矩形。

  • nDestHeight
    的高度,以邏輯單位,目的矩形。

  • crTransparent
    在將的來源點陣圖的透明色彩。 根據預設, CLR_INVALID,指出目前設定的色彩,應該使用影像的透明色彩。

  • rectDest
    的長度 結構的參考,識別目的。

  • xSrc
    X 座標,以邏輯單位,來源矩形的左上角。

  • ySrc
    Y 座標,以邏輯單位,來源矩形的左上角。

  • nSrcWidth
    的寬度,以邏輯單位,來源矩形。

  • nSrcHeight
    的高度,以邏輯單位,來源矩形。

  • rectSrc
    RECT 結構的參考,可識別來源。

傳回值

,如果失敗則為,

備註

TransparentBlt 適用於 4 位元和每像素 8 位元來源點陣圖支援每像素。 使用指定 CImage::AlphaBlend 具有透明度的每像素 32 位元點陣圖。

這個方法適用於 Microsoft Windows 2000、Windows 98 和更新系統。 如需詳細資訊請參閱在 Windows SDK 的 TransparentBlt與舊版作業系統的 CImage 限制

範例

// Performs a transparent blit from the source image to the destination 
// image using the images' current transparency settings
BOOL TransparentBlt(CImage* pSrcImage, CImage* pDstImage, int xDest, int yDest,
   int nDestWidth, int nDestHeight)
{
   HDC hDstDC = NULL;
   BOOL bResult;

   if(pSrcImage == NULL || pDstImage == NULL)
   {
      // Invalid parameter
      return FALSE;
   }

   // Obtain a DC to the destination image
   hDstDC = pDstImage->GetDC();

   // Perform the blit
   bResult = pSrcImage->TransparentBlt(hDstDC, xDest, yDest, nDestWidth, nDestHeight);

   // Release the destination DC
   pDstImage->ReleaseDC();

   return bResult;
}

需求

Header: atlimage.h

請參閱

參考

CImage 類別

CImage::StretchBlt

CImage::MaskBlt

CImage::BitBlt