次の方法で共有


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 の構造体への参照。

戻り値

成功した場合は、TRUEFALSE

解説

TransparentBlt は 4 個のビットと 8 ビットの二つのソース ビットマップでサポートされています。 透過性を持つ 32 bpp ビットマップを指定するに CImage::AlphaBlend を使用します。

このメソッドは、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;
}

必要条件

ヘッダー: atlimage.h

参照

関連項目

CImage クラス

CImage::StretchBlt

CImage::MaskBlt

CImage::BitBlt