问题
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:
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.
来源:https://stackoverflow.com/questions/1442162/stretchdibits-failed-sometimes-it-draw-nothing