Problem shrinking with StretchBlt()

771 views Asked by At

I have some code that paints my own rectangular buttons based on a source bitmap.

Most of the time the destination buttons are bigger than my source bitmap image and StretchBlt works fine. However, when the destination is smaller than the source image, StretchBlt refuses to fill the entire destination area.

I know StretchBlt isn't great on quality when it comes to scaling down images but I'm not too concerned about that. I just don't want missing pixels.

Here a link with the source image at the top and destination at the bottom:

link text Note, I am actually shrinking parts of the source image into the destination. I am not shrinking the entire image down. So for example, I copy the corners size for size with BitBlt() then I stretch (squash) the horizontal pixel data between the corners from the source image into the destination DC.

There is no fault with my source and destination coordinates. If I change from SRCCOPY to WHITENESS, the entire area fills with white as you'd expect. There is no grey bar where pixels haven't copied as you see in the Broken.bmp image above.

Has anyone had this problem before, and if so, can somebody please suggest a solution?

Cheers

1

There are 1 answers

0
SparkyNZ On BEST ANSWER

I've solved the problem. There's nothing wrong with StretchBlt(). The problem was that the bitmap I'd created and associated with my working DC's was too small to accomodate the image so it was truncating it. Oops.