[so] [WinAPI]Capture Window with Alpha Channel
Andrei Cibotaru
andreicibotaru at gmail.com
Tue Jun 16 01:06:30 EEST 2009
Pai nu poti sa ii dai tu din direct3d transparenta?
2009/6/16 Alin Popescu <alinpopescu at live.com>
> Salut!
>
> Nu are legatura cu ce s-a facut pe la so, dar are legatura cu mult prea
> obscurul WinAPI.
> Incerc sa fac o captura de fereastra si sa salvez pixelii intr-o textura de
> Direct3D. In final ferestre 3D cu transparenta :)
>
> Problema mea e ca nu reusesc sa salvez si alpha channel din fereastra.
> Am incercat sa folosesc si GetDIBits, dar fara rezultate.
>
> Poate a mai incercat cineva de pe aici si i-a gasit solutie.
> L-as ruga sa o impartaseasca cu comunitatea de WinAPI devs.
>
> void CaptureWindow(HWND hWnd, LPDIRECT3DTEXTURE9 Tex)
> {
> HDC hdcWindow = GetWindowDC(hWnd);
> HDC hdcMemory = CreateCompatibleDC(hdcWindow);
> HBITMAP hBitmap = CreateCompatibleBitmap(hdcWindow, Width, Height);
> hOld = SelectObject(hdcMemory, hBitmap);
> bool bResult = PrintWindow(hWnd, hdcMemory, 0);
>
> D3DLOCKED_RECT rect;
> Tex->LockRect(0, &rect, NULL, D3DLOCK_DISCARD);
> GetBitmapBits(hBitmap, Width * Height * 4, rect.pBits);
> Tex->UnlockRect(0);}
>
> SelectObject(hdcMemory, hOld);
> DeleteObject(hBitmap);
> DeleteDC(hdcMemory);
> ReleaseDC(hWnd, hdcWindow);
> }
>
> Thanx in advance.
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
--
Cibo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20090616/c9a00863/attachment.htm>
More information about the so
mailing list