Notice
Link
- Today
- Total
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- CSS
- springboot
- sql exception
- 스크롤적용
- view 획득
- 말줌임 CSS
- MFC
- 가변영역 스크롤
- 코드로 서버 재실행
- rn
- vc++
- pid 찾아 kill
- MariaDB
- SQL 첫날
- Back 키 클릭 감지
- c언어
- Activity 전체화면
- MySQL
- 피쉬랜드
- ffmpeg
- richedit 색상
- springboot 재가동
- reactnative
- 텍스트컬러
- DB 계정생성
- CentOS
- kill -9
- mybatis exception
- 터치좌표 view
- SQL 마지막날
Archives
개발은 하는건가..
VC++ Bitblt 로만 투명 효과 구현 본문
반응형
BOOL TransparentMyBlt( HDC hdcDest, int nXDest, int nYDest, int nWidth,
int nHeight, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nXSrc, int nYSrc,
COLORREF colorTransparent)
{
CDC dc, memDC, maskDC;//, tempDC;
dc.Attach( hdcDest );
maskDC.CreateCompatibleDC(&dc);
CBitmap maskBitmap;
//add these to store return of SelectObject() calls
CBitmap* pOldMemBmp = NULL;
CBitmap* pOldMaskBmp = NULL;
memDC.CreateCompatibleDC(&dc);
CBitmap bmpImage;
bmpImage.CreateCompatibleBitmap( &dc, nWidth, nHeight );
pOldMemBmp = memDC.SelectObject( &bmpImage );
// Select and realize the palette
/*
if( dc.GetDeviceCaps(RASTERCAPS) & RC_PALETTE && hPal )
{
::SelectPalette( dc, hPal, FALSE );
dc.RealizePalette();
::SelectPalette( memDC, hPal, FALSE );
}
*/
//memDC.BitBlt( 0,0,nWidth, nHeight, hdcSrc, nXOriginSrc, nYOriginSrc, SRCCOPY );
BitBlt(memDC.GetSafeHdc(), 0,0,nWidth, nHeight, hdcSrc, nXOriginSrc, nYOriginSrc, SRCCOPY );
// Create monochrome bitmap for the mask
maskBitmap.CreateBitmap( nWidth, nHeight, 1, 1, NULL );
pOldMaskBmp = maskDC.SelectObject( &maskBitmap );
memDC.SetBkColor( colorTransparent );
// Create the mask from the memory DC
maskDC.BitBlt( 0, 0, nWidth, nHeight, &memDC,
0, 0, SRCCOPY );
// Set the background in memDC to black. Using SRCPAINT with black
// and any other color results in the other color, thus making
// black the transparent color
memDC.SetBkColor(RGB(0,0,0));
memDC.SetTextColor(RGB(255,255,255));
memDC.BitBlt(0, 0, nWidth, nHeight, &maskDC, 0, 0, SRCAND);
// Set the foreground to black. See comment above.
dc.SetBkColor(RGB(255,255,255));
dc.SetTextColor(RGB(0,0,0));
dc.BitBlt(nXDest, nYDest, nWidth, nHeight, &maskDC, 0, 0, SRCAND);
// Combine the foreground with the background
dc.BitBlt(nXDest, nYDest, nWidth, nHeight, &memDC,
0, 0, SRCPAINT);
if (pOldMaskBmp)
maskDC.SelectObject( pOldMaskBmp );
if (pOldMemBmp)
memDC.SelectObject( pOldMemBmp );
dc.Detach();
return TRUE;
}
'C, C++, MFC' 카테고리의 다른 글
VC++ 윈도우가 Resize 될때 다시 그려야할 영역 얻기 (0) | 2018.10.31 |
---|---|
VC++ 윈도우 알파값 적용 (0) | 2018.10.31 |
16Bit Bitmap 에서 RGB 추출 (0) | 2018.10.31 |
VC++ 알파블렌딩 함수 예제 (0) | 2018.10.31 |
[MFC] VC++ 이미지 Raw 데이터를 Bitmap 으로 사용하기 (0) | 2018.10.31 |
Comments