views:

139

answers:

1

I am using gdi c++, StretchDIBits function sometimes failed if I draw large Images such as 7000*5000. It draw nothing. GetLastError() says no enough system resource. Can anyone explain why StretchDIBits need resource even The DC is prepared successfully.

+1  A: 

It may be that StretchDIBits expands the source image into a temporary bitmap of the same dimensions as the destination bitmap, and then copies the temporary into the destination as the final step. So even if you have enough memory to create the destination bitmap (140 MB) before the StretchDIBits call, your system doesn't have the additional 140 MB to allocate to the temporary bitmap.

MusiGenesis
i'm going to disagree. There's no way his machine doesn't have 280MB of free memory. Even if there isn't that much free RAM, there is certainly 280MB of page-file space. He would get an error about "The system is running low on virtual memory."
Ian Boyd