GaboonViper
March 9th, 2005, 05:46 AM
I'm trying to use the StretchDIBits function to display a bitmap, but it doesn't work very well. The image is 256x256 big and everything thing is fine if I display the whole bitmap. But when I try to display only part of the image then the function displays a part of the image I didn't want to display.
The following code for example should display the Upper-left part of the image but instead I get the Bottom-left part.
SetStretchBltMode(hdc, HALFTONE);
RECT result = CreateRect(0,0, 128, 128);
if (StretchDIBits(hdc,
result.left, result.top,
result.right - result.left, result.bottom - result.top,
result.left, result.top,
result.right - result.left, result.bottom - result.top,
cData, &bitmapinfo,
DIB_RGB_COLORS, SRCCOPY
)) return true;
else return false;
And if I try to get the Bottom-Right part I get the Upper-right part. I can't figure out why this happens. Any ideas?
The following code for example should display the Upper-left part of the image but instead I get the Bottom-left part.
SetStretchBltMode(hdc, HALFTONE);
RECT result = CreateRect(0,0, 128, 128);
if (StretchDIBits(hdc,
result.left, result.top,
result.right - result.left, result.bottom - result.top,
result.left, result.top,
result.right - result.left, result.bottom - result.top,
cData, &bitmapinfo,
DIB_RGB_COLORS, SRCCOPY
)) return true;
else return false;
And if I try to get the Bottom-Right part I get the Upper-right part. I can't figure out why this happens. Any ideas?