开发者

how to load the image having negative height

开发者 https://www.devze.com 2023-04-10 17:18 出处:网络
I am working on a Win32 sample application in which I am loading image and displaying then on the screen.

I am working on a Win32 sample application in which I am loading image and displaying then on the screen. To load the image I am using the LoadImage(). This will return the proper result for some of the image. So some of the image it is failing with error 8.

Then I came to know that if the height of the image is –ve then it is getting failed. If the image height is –ve then image is upside down.

Please let me know how to load the image having –ve h开发者_JAVA技巧eight


Microsoft bitmaps are usually stored from bottom to top.

When the height in the bitmap header is negative then it means that the image is stored from top to bottom, and its real height is abs(height specified in the header).

If you use GDI functions they take care of this (they display the image correctly, starting from the bottom if the height is positive or from the top if the height is negative).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号