Strictly speaking, you are probably right - the variable must be const.
I assume you are talking about the native Gdiplus C ++ API. If you study the implementation of this code and the Gdiplus classes, you will find that most of the code is the basic shell of the Gdiplus Flat API functions ( http://msdn.microsoft.com/en-us/library/ms533969(VS.85).aspx ) . This can make it difficult to make the code const-correct ... or (as I have already hinted) that Microsoft, as a rule, is not very modern C ++.
EDIT: Looking at the code for Gdiplus :: Image :: GetWidth () (in GdiPlusBitmap.h), it would be easy for MS to implement many functions with the const modifier. They did this with Image :: GetType (), and the code inside is pretty much identical to Image :: GetWidth (), Image :: GetHeight ().
source share