Code: Select all
HBITMAP hBitmap = FPCGetFrameBitmap.hBitmap;
BITMAP bmp_info = { 0 };
GetObject(hBitmap, sizeof(bmp_info), &bmp_info);
SIZE bitmapSize;
bitmapSize.cx = bmp_info.bmWidth;
bitmapSize.cy = bmp_info.bmHeight;
DeleteObject(hBitmap);
Code: Select all
HBITMAP hBitmap = FPCGetFrameBitmap.hBitmap;
// start copie
SIZE bitmapSize;
GetBitmapDimensionEx( hBitmap, &bitmapSize );
DeleteObject(hBitmap);
GetBitmapDimensionEx
The GetBitmapDimensionEx function retrieves the dimensions of a compatible bitmap. The retrieved dimensions must have been set by the SetBitmapDimensionEx function.
BOOL GetBitmapDimensionEx(
HBITMAP hBitmap, // handle to bitmap
LPSIZE lpDimension // dimensions
);
Code: Select all
pictdesc.cbSizeofstruct = sizeof(pictdesc);
pictdesc.picType = PICTYPE_BITMAP;
pictdesc.bmp.hbitmap = FPCGetFrameBitmap.hBitmap;
IPicture* pPicture = NULL;
OleCreatePictureIndirect(&pictdesc, IID_IPicture, FALSE, (void**)&pPicture);
Code: Select all
BITMAPINFO bmpInfoHeader;
int octetSize = bmp_info.bmWidthBytes * bmp_info.bmHeight * bmp_info.bmBitsPixel / 8;
BYTE *lpvBytes = new BYTE[ octetSize ];
ZeroMemory( &bmpInfoHeader, sizeof(BITMAPINFO) );
bmpInfoHeader.bmiHeader.biSize = sizeof(BITMAPINFO);
bmpInfoHeader.bmiHeader.biWidth = bmp_info.bmWidth;
bmpInfoHeader.bmiHeader.biHeight = bmp_info.bmHeight;
bmpInfoHeader.bmiHeader.biPlanes = 1;
bmpInfoHeader.bmiHeader.biBitCount = bmp_info.bmBitsPixel;
bmpInfoHeader.bmiHeader.biCompression = BI_RGB;
HDC flashDc = GetDC( g_hwndFlashPlayerControl );
int nbScanLines = GetDIBits( flashDc, hBitmap, 0, bmp_info.bmHeight, lpvBytes, &bmpInfoHeader, DIB_RGB_COLORS );
if ( lpvBytes == NULL ) return FALSE;
if ( nbScanLines = 0 ) return FALSE;
HRESULT hr = S_OK;
if ( g_pTexture9 ) {
D3DLOCKED_RECT lockedRect;
hr = g_pTexture9->LockRect( 0, &lockedRect, NULL, D3DLOCK_DISCARD );
BYTE *texBytes = (BYTE*)lockedRect.pBits;
BYTE *bmpBytes = lpvBytes;
int texPitch = lockedRect.Pitch;
int bmpPitch = bmpInfoHeader.bmiHeader.biWidth * bmpInfoHeader.bmiHeader.biBitCount / 8;
for ( LONG i = 0; i < bmpInfoHeader.bmiHeader.biHeight; i++ ) {
// copie du contenu
DWORD *bmpDWORD = (DWORD*)bmpBytes;
DWORD *texDWORD = (DWORD*)texBytes;
for ( LONG j = 0; j < bmpInfoHeader.bmiHeader.biWidth; j++ )
texDWORD[j] = bmpDWORD[(bmpInfoHeader.bmiHeader.biWidth - 1) - j];
bmpBytes += bmpPitch;
texBytes += texPitch;
}
hr = g_pTexture9->UnlockRect( 0 );
}
DeleteObject(hBitmap);
int res = ReleaseDC( g_hwndFlashPlayerControl, flashDc );
delete[] lpvBytes;
Dexy- wrote:got just a problem of quality...
Dexy- wrote:Okay, it was my fault, creating the 3d device too fast, I was specifing a small render buffer.
So it works 'niquel'
Good framerate, good visual quality, Great lib ! tx
(wan't to see the sample ?)
Nico, (tx again)
Users browsing this forum: No registered users and 11 guests