如何确定DIB是自下而上还是自上而下? [英] How do I determine if a DIB is bottom-up or top-down?

查看:142
本文介绍了如何确定DIB是自下而上还是自上而下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果使用CreateDIBSection()创建DIB,则可以通过将BITMAPINFOHEADER结构的biHeight字段设置为负值或正值来指定是自顶向下还是自底向上.但是,如果我在这样的位图上调用GetObject()来填充DIBSECTION结构,则dsBm.bmHeightdsBmih.biHeight似乎总是正值.

If I create a DIB using CreateDIBSection(), I can specify wether it should be top-down or bottom-up by setting the biHeight field of the BITMAPINFOHEADER struct to a negative or positive value. However, if i call GetObject() on such a bitmap to fill a DIBSECTION structure, then both the dsBm.bmHeight and dsBmih.biHeight seem to be always positive.

当我只有HBITMAP时,是否有办法找出DIB是自上而下还是自下而上?

Is there a way to find out if a DIB is top-down or bottom-up when all I have is the HBITMAP?

推荐答案

我认为,从HBITMAP获得的最好的就是GetDIBits.但是,GetDIBits的问题在于,它还需要HDC,而HBITMAP必须是DDB.

I think the best you're going to be able to get from an HBITMAP is going to be GetDIBits. The problem with GetDIBits however, is that it also requires an HDC and the HBITMAP has to be a DDB.

请参阅: GetDIBits函数

我不是很肯定,但是有可能您会在转换中失去自上而下的感觉.

I'm not positive, but its possible you'll lose any top-downness in the conversion.

这篇关于如何确定DIB是自下而上还是自上而下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆