mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-29 14:07:58 +03:00
32 lines
739 B
C++
32 lines
739 B
C++
#include "WinUtils.h"
|
|
|
|
using namespace Framework;
|
|
|
|
HBITMAP WinUtils::CreateMask(HBITMAP nBitmap, uint32 nColor)
|
|
{
|
|
BITMAP bm;
|
|
HBITMAP nMask;
|
|
HDC hDC1, hDC2;
|
|
GetObject(nBitmap, sizeof(BITMAP), &bm);
|
|
nMask = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, NULL);
|
|
|
|
hDC1 = CreateCompatibleDC(0);
|
|
hDC2 = CreateCompatibleDC(0);
|
|
|
|
SelectObject(hDC1, nBitmap);
|
|
SelectObject(hDC2, nMask);
|
|
|
|
SetBkColor(hDC1, nColor);
|
|
BitBlt(hDC2, 0, 0, bm.bmWidth, bm.bmHeight, hDC1, 0, 0, SRCCOPY);
|
|
BitBlt(hDC1, 0, 0, bm.bmWidth, bm.bmHeight, hDC2, 0, 0, SRCINVERT);
|
|
|
|
DeleteDC(hDC1);
|
|
DeleteDC(hDC2);
|
|
|
|
return nMask;
|
|
}
|
|
|
|
TCHAR WinUtils::FixSlashes(TCHAR nCharacter)
|
|
{
|
|
return (nCharacter == _T('/')) ? _T('\\') : nCharacter;
|
|
}
|