IDIB是由IBitmap派生的一个接口和数据结构。通过IDIB的数据结构成员变量可以定位位图中图像点(pixel)的位置,以及如何解析图像点的颜色值。
通过IDIB结构可以实现对位图数据的直接操作。
struct IDIB {
AEEVTBL(IBitmap) *pvt;
IQueryInterface * pPaletteMap; // cache for computed palette mapping info
byte * pBmp; // pointer to top row
uint32 * pRGB; // palette
NativeColor ncTransparent; // 32-bit native color value
uint16 cx; // number of pixels in width
uint16 cy; // number of pixels in height
int16 nPitch; // offset from one row to the next
uint16 cntRGB; // number of palette entries
uint8 nDepth; // size of pixel in bits
uint8 nColorScheme; // IDIB_COLORSCHEME_...
uint8 reserved[6]; // initialize to 0 when constructing a DIB;
};
获得IDIB示例:
int GetDIB(IBitmap *pib, const AEERect *prc, IDIB **ppdib)
{
int nErr;
nErr = IBITMAP_QueryInterface(pib, AEECLSID_DIB, (void**)ppdib);
if (nErr == SUCCESS) {
// invalidate bitmap
if (prc) {
IBITMAP_Invalidate(pib, prc);
}
} else {
nErr = IBITMAP_QueryInterface(pib, AEECLSID_DIB_20, (void**)ppdib);
}
return nErr;
}
具体的操作,看一下IBitmap和IDIB的接口说明就可以了