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 abottom-upDIB, the image buffer starts with thebottomrow 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 thebottom-leftpixel of the image. In GDI, all DIBs are bottom-up. The following diagram shows the physical layout of a bottom-up DIB.
在一個bottom-up位圖中,圖像的緩沖區(qū)從底層行的像素開始,圖像的頂層行是圖像緩沖區(qū)的最后一行。因此,內(nèi)存的第一個字節(jié)是指向圖像左下角的像素。在GDI中,所有的設(shè)備無關(guān)位圖都是bottom-up類型,下圖表示了一個bottom-up位圖的物理排列順序。
In a top-down DIB, the order of the rows is reversed. Thetoprow 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 thetop-leftpixel 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 thebiHeightmember of theBITMAPINFOHEADERstructure. IfbiHeightis positive, the image is bottom-up. IfbiHeightis negative, the image is top-down.
DIBs in YUV formats are always top-down, and the sign of thebiHeightmember is ignored. Decoders should offer YUV formats with positivebiHeight, but they should also accept YUV formats with negativebiHeightand ignore the sign.
Also, any DIB type that uses aFOURCCin thebiCompressionmember, should express itsbiHeightas a positive number no matter what its orientation is, since theFOURCCitself identifies a compression scheme whose image orientation should be understood by any compatible filter.
總結(jié)
以上是生活随笔為你收集整理的Top-Down和Bottom-Up位图的区别的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 405状态码,改变请求方式
- 下一篇: 块级元素(导航,图片,层)的水平和垂直居