Can't Display Bitmap of Higher Resolution than CDC area
Posted
by T. Jones
on Stack Overflow
See other posts from Stack Overflow
or by T. Jones
Published on 2010-05-14T09:24:03Z
Indexed on
2010/05/14
9:34 UTC
Read the original article
Hit count: 317
Hi there dear gurus and expert coders.
i am not gonna start with im a newbie and don't know much about image programming but unfortunately those are the facts :(
I am trying to display an image from a bitmap pointer *ImageData which is of resolution 1392x1032. I am trying to draw that at an area of resolution or size 627x474.
However, repeated trying doesnt seem to work. It works when I change the bitmap image I created from *ImageData width and height to resolution or size of around 627x474
I really do not know how to solve this after trying all possible solutions from various forums and google.
pDC is a CDC* and memDC is a CDC initialized in an earlier method Anything uninitialized here was initialized in other methods.
Here is my code dear humble gurus. Do provide me with guidance Yoda and Obi-Wan provided to Luke Skywalker.
void DemoControl::ShowImage( void *ImageData )
{
int Width; //Width of Image From Camera
int Height; //Height of Image From Camera
int m_DisplayWidth = 627 ;//width of rectangle area to display
int m_DisplayHeight = 474;//height of rectangle area to display
GetImageSize( &Width, &Height ) ; //this will return Width = 1392, Height 1032
CBitmap bitmap;
bitmap.CreateBitmap(Width,Height,32,1,ImageData);
CBitmap* pOldBitmap = memDC.SelectObject((CBitmap*)&bitmap);
pDC->BitBlt(22, 24, 627, 474, &memDC, 0, 0, SRCCOPY);
memDC.SelectObject((CBitmap*)pOldBitmap);
ReleaseDC(pDC);
}
© Stack Overflow or respective owner