Reputation: 1
I am trying to write a component for my program to re-size image frames from a video. The current code is called, which takes the CDC
from the current frame.
void showImageFrame(LPSTR info)
{
BITMAPINFOHEADER * pInfo = (BITMAPINFOHEADER *)info;
CDC* pDC=pWnd=GetDlgItem(IDCFrame)->GetDC();
CRect rect;
pWnd->GetClientRect(&rect);
SetDIBitsToDevice(pDC->GetSafeHdc(), 0, 0, rect.Width(), rect.Height(), 0, 0, 0, pInfo->biHeight, info + *(LPDWORD)info, (LPBITMAPINFO) pInfo, DIB_RGB_COLORS);
pDC->StretchBlt(0,0,200,200,pDC,0,0,rect.Width(),rect.Height(),SRCCOPY);
}
The StretchBlt
does re-size the image displayed at the current frame, but it retains the larger image from the SetDIBitsToDevice
. Is there any way to remove the image of the SetDIBitsToDevice
, or do this in a more efficient way? I am trying to re-size the image to 200x200.
Using the current code above, I get the following output.
Thanks!
https://i.sstatic.net/dWXRZ.png
Upvotes: -1
Views: 548
Reputation: 2822
One quick way. Create a blank (white) image and stretch it over the original image, then StretchBlt your resized image.
Upvotes: 0