zoukankan      html  css  js  c++  java
  • Top-Down和Bottom-Up位图的区别

    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位图的物理排列顺序。

    Bottom-up DIB

    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位图中,行的顺序是相反的。

    Top-down DIB

    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.

  • 相关阅读:
    2013ACM多校联合(1)
    AcDream 1083 完美数 数位DP
    AcDream 1079 郭氏数
    AcDream 1084 同心树 几何
    AcDream 1078 递推数 嵌套循环节+矩阵快速幂
    AcDream 1081 平衡树 Tire树
    ZOJ1455 Schedule Problem 差分约束
    在程序中加载log4net配置,防止其他人看到配置文件
    sqlite错误 The database disk image is malformed database disk image is malformed 可解决
    由于这台计算机没有终端服务器客户端访问许可证,远程会话被中断。请与服务器管理员联系 解决
  • 原文地址:https://www.cnblogs.com/qxzy/p/4026904.html
Copyright © 2011-2022 走看看