Top-Down vs. Bottom-Up DIBs

If you are new to graphics programming, you might expect that a bitmap would be arranged in memory so that the top row of the image appeared at the start of the buffer, followed by the next row, and so forth. However, this is not necessarily the case. In Windows, device-independent bitmaps (DIBs) can be placed in memory in two different orientations, bottom-up and top-down.

In a bottom-up DIB, the image buffer starts with the bottom row of pixels, followed by the next row up, and so forth. The top row of the image is the last row in the buffer. Therefore, the first byte in memory is the bottom-left pixel of the image. In GDI, all DIBs are bottom-up. The following diagram shows the physical layout of a bottom-up DIB.

在一个bottom-up位图中,图像的缓冲区从底层行的像素开始,图像的顶层行是图像缓冲区的最后一行。因此,内存的第一个字节是指向图像左下角的像素。在GDI中,所有的设备无关位图都是bottom-up类型,下图表示了一个bottom-up位图的物理排列顺序。

In a top-down DIB, the order of the rows is reversed. The top row of the image is the first row in memory, followed by the next row down. The bottom row of the image is the last row in the buffer. With a top-down DIB, the first byte in memory is the top-left pixel of the image. DirectDraw uses top-down DIBs. The following diagram shows the physical layout of a top-down DIB:

在一个top-down位图中,行的顺序是相反的。

For RGB DIBs, the image orientation is indicated by the biHeight member of the BITMAPINFOHEADER structure. If biHeight is positive, the image is bottom-up. IfbiHeight is negative, the image is top-down.

DIBs in YUV formats are always top-down, and the sign of the biHeight member is ignored. Decoders should offer YUV formats with positive biHeight, but they should also accept YUV formats with negative biHeight and ignore the sign.

Also, any DIB type that uses a FOURCC in the biCompression member, should express its biHeight as a positive number no matter what its orientation is, since theFOURCC itself identifies a compression scheme whose image orientation should be understood by any compatible filter.

Top-Down和Bottom-Up位图的区别的更多相关文章

  1. linux系统/proc/stat信息与top的cup信息的联系及区别

    一. /proc 目录 Linux系统上的/proc目录是一种文件系统,即proc文件系统,与其它常见的文件系统不同的是,/proc文件系统是一个伪文件系统,它只存在内存当中,而不占用外存空间.它以文 ...

  2. Altium Designer16 如何分别导出TOP层和BOTTOM层

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明. 作者:struct_mooc 博客地址:https://www.cnblogs.com/stru ...

  3. back to top & back to bottom

    back to top & back to bottom infinite auto load more & infinite scroll & load more https ...

  4. menu({postion:{my:"left top"},at:"right bottom"})里的my与at会冲突吗

    my(默认值:"center")类型:String描述:定义被定位元素上对准目标元素的位置:"horizontal vertical" 对齐方式.一个单一的值, ...

  5. 每天CSS学习之top/left/right/bottom

    top:值域是数值或百分比,正负都可以.该值表示 距离顶部有多少像素.例如top:10px:即距离顶部10个像素. left/right/bottom与top如出一辙,只是方向不一样而已. 这些属性一 ...

  6. select top 1 和select top 1 with ties * from SC 的区别

    select top1 : * FROM SC ORDER BY score DESC 运行结果如下: sc表数据查询select top 1 S# C# Score 001 03 120 WITH ...

  7. css top,right,bottom,left设置为0有什么用?它和width:100%和height:100%有什么区别?

     壹 ❀ 引 当我们使用position属性时,总免不了与top,left,right,bottom四个属性打交道,那么这四个属性都设置为0时有什么用,与宽高设置100%又有什么区别?本文对此展开讨论 ...

  8. (四)学习CSS之position、bottom、left、right和top属性

    参考:http://www.w3school.com.cn/cssref/pr_class_position.asp position 属性规定元素的定位类型. 这个属性定义建立元素布局所用的定位机制 ...

  9. css 样式中 margin padding和top类定位的区别

    1 margin margin 是外边距的意思,是边框到外部另一元素之间的距离,允许使用负值 语法结构: margin:5px auto;                  意思上下为5,左右平均居中 ...

随机推荐

  1. Power Strings--KMP

    https://cn.vjudge.net/problem/POJ-2406 上面是比赛链接. 题目意思很明确,问最多是多少个子串连接而成的? 这个需要用到KMP,很好的理解KMP的Next数组.Ne ...

  2. oracle下 启动subversion命令 及 oracle相关服务启动备忘

    linux shell下  svnserve - d -r + 目录   例如:svnserve -d -r /svn 启动 svn服务. 访问svn://192.168.0.120/kjcg 测试. ...

  3. Java字符串理解

    1. 字符串基本知识 用java.lang.String类的对象表示字符串 字符串类型不是基本类型, 而是引用类型(类似于数组和对象) Java基于Unicode字符集 2. 字符串创建 public ...

  4. 【Hadoop】MapReduce笔记(三):MapReduce的Shuffle和Sort阶段详解

    一.MapReduce 总体架构 整体的Shuffle过程包含以下几个部分:Map端Shuffle.Sort阶段.Reduce端Shuffle.即是说:Shuffle 过程横跨 map 和 reduc ...

  5. 14.oauth2与open id connect 对比

    微博的授权机制 openIdConnect

  6. UVa 1658 Admiral (最小费用流)

    题意:给定一个图,求1-n的两条不相交的路线,并且权值和最小. 析:最小费用流,把每个结点都拆成两个点,中间连一条容量为1的边,然后一个作为入点,另一个是出点.最后跑两次最小费用流就行了. 代码如下: ...

  7. 剑指offer面试题:输入某二叉树的前序遍历和中序遍历,输出后序遍历

    二叉树的先序,中序,后序如何遍历,不在此多说了.直接看题目描述吧(题目摘自九度oj剑指offer面试题6): 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树.假设输入的前序遍历和中序遍历的结 ...

  8. html上传多图并预览

    涉及知识:base64处理图片,ajax,js,thinkphp 效果图: 代码实现: html: <!DOCTYPE html> <html> <head> &l ...

  9. BZOJ3289【莫队算法+树状数组+离散化】

    思路: 区间逆序数即是交换次数. 逆序数,可以用树状数组吧. 怎么处理区间变换的时候求逆序数啊.. 这里分成左边的增/删,右边的增/删 因为是按时序插入, 所以左边增,增一个数,计算:ans+=sun ...

  10. Unity3D教程:无缝地形场景切换的解决方法

    http://www.unitymanual.com/6718.html 当我们开发一个大型项目的时候-会遇到这样的问题(地形场景的切换)这个只是字面意思-并不是重场景1的100  100 100坐标 ...