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
    RECT 構造体への参照。コピー先の四角形を識別します。

  • xSrc
    コピー元四角形の左上隅の x 座標 (論理単位)。

  • ySrc
    転送元四角形の左上隅の y 座標 (論理単位)。

  • nSrcWidth
    コピー元四角形の幅 (論理単位)。

  • nSrcHeight
    コピー元四角形の高さ (論理単位)。

  • rectSrc
    RECT 構造体への参照。コピー元の四角形を識別します。

戻り値

正常終了した場合は TRUE を返します。それ以外の場合は FALSE を返します。

解説

TransparentBlt は、転送元ビットマップの 1 ピクセルあたりのビット数が 4 ビットまたは 8 ビットの場合にサポートされます。 1 ピクセルあたりのビット数が 32 ビットのビットマップで透過色を指定するには、CImage::AlphaBlend を使用します。

このメソッドは、Microsoft Windows 2000 および Microsoft 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;
}

必要条件

**ヘッダー:**atlimage.h

参照

参照

CImage クラス

CImage::StretchBlt

CImage::MaskBlt

CImage::BitBlt

その他の技術情報

CImage のメンバー