Merge pull request #394 from alex8b/alphablend

Added alpha blending
master
Jim 2014-11-15 02:18:36 -08:00
commit b68c6f4228
6 changed files with 17 additions and 6 deletions

View File

@ -277,7 +277,9 @@ INT_PTR CALLBACK ConfigureDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPA
BOOL bCaptureMouse = data->GetInt(TEXT("captureMouse"), 1);
BOOL bStretchImage = data->GetInt(TEXT("stretchImage"));
BOOL bAlphaBlend = data->GetInt(TEXT("alphaBlend"));
SendMessage(GetDlgItem(hwnd, IDC_STRETCHTOSCREEN), BM_SETCHECK, bStretchImage ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hwnd, IDC_ALPHABLEND), BM_SETCHECK, bAlphaBlend ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hwnd, IDC_IGNOREASPECT), BM_SETCHECK, data->GetInt(TEXT("ignoreAspect")) ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hwnd, IDC_CAPTUREMOUSE), BM_SETCHECK, bCaptureMouse ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hwnd, IDC_INVERTMOUSEONCLICK), BM_SETCHECK, data->GetInt(TEXT("invertMouse")) ? BST_CHECKED : BST_UNCHECKED, 0);
@ -407,6 +409,7 @@ INT_PTR CALLBACK ConfigureDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPA
data->SetString(TEXT("executable"), info->windowData[windowID].strExecutable);
data->SetInt(TEXT("stretchImage"), SendMessage(GetDlgItem(hwnd, IDC_STRETCHTOSCREEN), BM_GETCHECK, 0, 0) == BST_CHECKED);
data->SetInt(TEXT("alphaBlend"), SendMessage(GetDlgItem(hwnd, IDC_ALPHABLEND), BM_GETCHECK, 0, 0) == BST_CHECKED);
data->SetInt(TEXT("ignoreAspect"), SendMessage(GetDlgItem(hwnd, IDC_IGNOREASPECT), BM_GETCHECK, 0, 0) == BST_CHECKED);
data->SetInt(TEXT("captureMouse"), SendMessage(GetDlgItem(hwnd, IDC_CAPTUREMOUSE), BM_GETCHECK, 0, 0) == BST_CHECKED);
data->SetInt(TEXT("invertMouse"), SendMessage(GetDlgItem(hwnd, IDC_INVERTMOUSEONCLICK), BM_GETCHECK, 0, 0) == BST_CHECKED);

View File

@ -74,10 +74,12 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,106,318,10
CONTROL "Sources.GameCaptureSource.UseSafeHook",IDC_USESAFEHOOK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,118,318,10
RTEXT "Gamma",IDC_STATIC,7,142,111,8
CONTROL "",IDC_GAMMA,"msctls_trackbar32",TBS_BOTH | WS_TABSTOP,122,134,227,26
LTEXT ".numbers!",IDC_GAMMAVAL,354,142,66,8
EDITTEXT IDC_INFO,7,165,403,110,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
CONTROL "Sources.GameCaptureSource.AlphaBlend",IDC_ALPHABLEND,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,130,308,10
RTEXT "Gamma",IDC_STATIC,7,150,111,8
CONTROL "",IDC_GAMMA,"msctls_trackbar32",TBS_BOTH | WS_TABSTOP,122,142,227,26
LTEXT ".numbers!",IDC_GAMMAVAL,354,150,66,8
EDITTEXT IDC_INFO,7,173,403,102,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
DEFPUSHBUTTON "OK",IDOK,431,261,50,14
PUSHBUTTON "Cancel",IDCANCEL,486,261,50,14
END

View File

@ -302,6 +302,7 @@ void GraphicsCaptureSource::BeginScene()
bUseDWMCapture = (scmpi(strWindowClass, TEXT("Dwm")) == 0);
bStretch = data->GetInt(TEXT("stretchImage")) != 0;
bAlphaBlend = data->GetInt(TEXT("alphaBlend")) != 0;
bIgnoreAspect = data->GetInt(TEXT("ignoreAspect")) != 0;
bCaptureMouse = data->GetInt(TEXT("captureMouse"), 1) != 0;
@ -949,7 +950,10 @@ void GraphicsCaptureSource::Render(const Vect2 &pos, const Vect2 &size)
Vect2 center = totalSize*0.5f;
BlendFunction(GS_BLEND_ONE, GS_BLEND_ZERO);
if(!bAlphaBlend)
BlendFunction(GS_BLEND_ONE, GS_BLEND_ZERO);
else
BlendFunction(GS_BLEND_SRCALPHA, GS_BLEND_INVSRCALPHA);
if(bStretch)
{

View File

@ -41,7 +41,7 @@ class GraphicsCaptureSource : public ImageSource
HWND hwndTarget, hwndCapture, hwndNextTarget;
HANDLE hTargetProcess;
bool bCapturing, bErrorAcquiring, bFlip, bStretch, bIgnoreAspect, bCaptureMouse;
bool bCapturing, bErrorAcquiring, bFlip, bStretch, bAlphaBlend, bIgnoreAspect, bCaptureMouse;
UINT captureWaitCount;
DWORD targetProcessID;
DWORD targetThreadID;

View File

@ -18,6 +18,7 @@
#define IDC_CLEARHOTKEY 1010
#define IDC_INVERTMOUSEONCLICK2 1010
#define IDC_USESAFEHOOK 1010
#define IDC_ALPHABLEND 1011
#define IDC_GAMMA 1035
#define IDC_STARTSTREAMHOTKEY 1097
#define IDC_HOTKEY 1097

View File

@ -398,6 +398,7 @@ Sources.GameCaptureSource.PluginName="Game Capture Plugin"
Sources.GameCaptureSource.RequiresAdmin="These applications require administrator access to capture (start OBS as administrator to capture):"
Sources.GameCaptureSource.SelectApplication="Select Application"
Sources.GameCaptureSource.StretchToScreen="Stretch image to screen"
Sources.GameCaptureSource.AlphaBlend="Enable alpha blending"
Sources.GameCaptureSource.UseHotkey="Use Hotkey"
Sources.GameCaptureSource.UseSafeHook="Anti-cheat compatibility hooking (use only if necessary)"