Guest_imported
New member
- Jan 1, 1970
- 0
Hi,
I am in trouble with visualc++ performance in displaying large images at 30 frames per second with stretch.
In Borland C, I use a memory dc to boost performance. I make the stretch operation to the memory DC via
StretchDIBits and after that I used a simple BitBlt to display the resized image. Unfortunately, MCF
and Win32 don't give me the same facilities to make the operation via a memory DC. I have tried to do a similar
process with Win32 StretchDIBits, but it resulted in a black screen, so something went wrong.
My first approach was to draw the image direct to the screen via a StretchBlt. Here it goes the code,
where DIB is my Borland C DIB class emulation:
CClientDC gdc(this);
CDC *tempDC= new CDC;
tempDC->CreateCompatibleDC(&gdc);
//...//
HBITMAP hbm;
hbm = Dib->GetBitmap();
tempDC->SelectObject(hbm);
bltRet = gdc.StretchBlt( offsetx, offsety, width * 2, height * 2,tempDC, 0, 0,width, height, SRCCOPY);
This works fine but is too slow. To boost the speed I have tried to perform a stretch
to a memory DC, and after that transfer the resized frame to the Screen DC. The code follows bellow:
CClientDC gdc(this);
CDC *tempDC= new CDC();
tempDC->CreateCompatibleDC(&gdc);
//now I have a memorydc and its Cbitmap
CDC *memoryDC = new CDC();
CBitmap *bitmap = new CBitmap();
bitmap->CreateCompatibleBitmap(gdc, width * 2, height * 2);
memoryDC->SelectObject(bitmap);
//...//
HBITMAP hbm;
hbm = Dib->GetBitmap();
tempDC->SelectObject(hbm);
memoryDC.StretchBlt( offsetx, offsety, width * 2, height * 2, tempDC, 0, 0,width, height, SRCCOPY);
gdc.BitBlt(offsetx, offsety, width* 2, height * 2,memoryDC, 0, 0, SRCCOPY);
This returned black screens only. Why???
Thanks in advance
Bernardo
I am in trouble with visualc++ performance in displaying large images at 30 frames per second with stretch.
In Borland C, I use a memory dc to boost performance. I make the stretch operation to the memory DC via
StretchDIBits and after that I used a simple BitBlt to display the resized image. Unfortunately, MCF
and Win32 don't give me the same facilities to make the operation via a memory DC. I have tried to do a similar
process with Win32 StretchDIBits, but it resulted in a black screen, so something went wrong.
My first approach was to draw the image direct to the screen via a StretchBlt. Here it goes the code,
where DIB is my Borland C DIB class emulation:
CClientDC gdc(this);
CDC *tempDC= new CDC;
tempDC->CreateCompatibleDC(&gdc);
//...//
HBITMAP hbm;
hbm = Dib->GetBitmap();
tempDC->SelectObject(hbm);
bltRet = gdc.StretchBlt( offsetx, offsety, width * 2, height * 2,tempDC, 0, 0,width, height, SRCCOPY);
This works fine but is too slow. To boost the speed I have tried to perform a stretch
to a memory DC, and after that transfer the resized frame to the Screen DC. The code follows bellow:
CClientDC gdc(this);
CDC *tempDC= new CDC();
tempDC->CreateCompatibleDC(&gdc);
//now I have a memorydc and its Cbitmap
CDC *memoryDC = new CDC();
CBitmap *bitmap = new CBitmap();
bitmap->CreateCompatibleBitmap(gdc, width * 2, height * 2);
memoryDC->SelectObject(bitmap);
//...//
HBITMAP hbm;
hbm = Dib->GetBitmap();
tempDC->SelectObject(hbm);
memoryDC.StretchBlt( offsetx, offsety, width * 2, height * 2, tempDC, 0, 0,width, height, SRCCOPY);
gdc.BitBlt(offsetx, offsety, width* 2, height * 2,memoryDC, 0, 0, SRCCOPY);
This returned black screens only. Why???
Thanks in advance
Bernardo