[so] [WinAPI]Capture Window with Alpha Channel

Daniel Flamaropol raptorclw at gmail.com
Tue Jun 16 01:10:15 EEST 2009


Salut.

Ce vrei sa spui prin "nu reusesc sa salvez si alpha channel" ?. Din ce am
inteles eu, vrei sa faci un print screen la o fereastra.
Unde ar fi alpha channel acolo? De asemenea, ce intelegi prin "ferestre 3D
cu transparenta"?

Presupun ca vrei sa faci o fereastra de Direct3D care sa para transparenta,
la fiecare frame facand un capture la ce se afla
in spatele ei, si randand respectiva textura in Direct3D (pe un quad
eventual). Asta e?

Numai bine,
Dani

2009/6/16 Andrei Cibotaru <andreicibotaru at gmail.com>

> 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
>
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20090616/0cbd3a42/attachment.htm>


More information about the so mailing list