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. java中的几种内部类

    Java中的几种内部类 内部类,听名字就可以知道是什么意思,就是类里面的类.有成员内部类,静态内部类,局部内部类和匿名内部类. 下面说一个每种内部类的的使用. 一.  成员内部类

  2. python之yield和Generator

    首先我们从一个小程序导入,各定一个list,找出其中的素数,我们会这样写 import math def is_Prims(number): if number == 2: return True / ...

  3. https证书自签

         https               http over ssl = https 443/tcp                 ssl: v3                 tls: ...

  4. codevs 1143 纪念品分组

    1143 纪念品分组 2007年NOIP全国联赛普及组  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 白银 Silver 题解       题目描述 Description ...

  5. 一个轻量级AOP的实现(开源)

    事先声明,本项目参考AOP in C#和园内大神张逸的文章,思路神马的都不是自己的! 为了让项目的代码看起来更干净,需要一个AOP! 于是就实现了一个非常简单的,非常轻量级,有多轻量级呢? 实现的AO ...

  6. bzoj2957楼房重建——线段树

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2957 线段树维护原点到楼顶的斜率,可以知道答案就是从原点开始斜率递增的个数: 记录一个mx数 ...

  7. web应用目录结构

    news web(应用的名字)||--静态资源和JSP文件都可以直接放在web应用的目录下,浏览器可以直接访问(html/jsp/css)|--WEB-INF 可以没有,但是最好有,一旦有,则结构需要 ...

  8. bzoj4066

    KD-tree 强制在线就不能愉快的做这道题了. 我们用KD-tree维护平面上的点,这样建出来的树高大概是log,复杂度过得去,但是插入过多会使树深很深,这样就能卡死,那么我们每个10000次插入就 ...

  9. 在xshell中使用Linux语言打开错误提示

    上线项目到服务器后, 有时候有的功能跟本地调试的不一样,这时候就需要设置打开display_errors = On: 首先,cd .. 进入上一级,ll 罗列当前目录,跟home当前目录的有这个usr ...

  10. html+css构成的框架,可自行改造

    运行效果 代码下载地址:http://pan.baidu.com/s/1eSeBh2E