我现在已将一个BITMAP文件的头信息和图像信息存在两个数组中BITHEAD和BITIMAGE,请问如何用这数组中的数据将图像显示出来。

解决方案 »

  1.   

    int StretchDIBits(
      HDC hdc,                // handle to device context
      int XDest,              // x-coordinate of upper-left corner of dest. rectangle
      int YDest,              // y-coordinate of upper-left corner of dest. rectangle
      int nDestWidth,         // width of destination rectangle
      int nDestHeight,        // height of destination rectangle
      int XSrc,               // x-coordinate of upper-left corner of source rectangle
      int YSrc,               // y-coordinate of upper-left corner of source rectangle
      int nSrcWidth,          // width of source rectangle
      int nSrcHeight,         // height of source rectangle
      CONST VOID *lpBits,            // address of bitmap bits
      CONST BITMAPINFO *lpBitsInfo,  // address of bitmap data
      UINT iUsage,                   // usage flags
      DWORD dwRop                    // raster operation code
    );
     
    Parameters
    hdc 
    Handle to the destination device context. 
    XDest 
    Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    YDest 
    Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    nDestWidth 
    Specifies the width, in logical units, of the destination rectangle. 
    nDestHeight 
    Specifies the height, in logical units, of the destination rectangle. 
    XSrc 
    Specifies the x-coordinate, in pixels, of the source rectangle in the DIB. 
    YSrc 
    Specifies the y-coordinate, in pixels, of the source rectangle in the DIB. 
    nSrcWidth 
    Specifies the width, in pixels, of the source rectangle in the DIB. 
    nSrcHeight 
    Specifies the height, in pixels, of the source rectangle in the DIB. 
    lpBits 
    Pointer to the DIB bits, which are stored as an array of bytes. For more information, see the following Res section. 
    lpBitsInfo 
    Pointer to a BITMAPINFO structure that contains information about the DIB. 
    iUsage 
    Specifies whether the bmiColors member of the BITMAPINFO structure was provided and, if so, whether bmiColors contains explicit red, green, blue (RGB) values or indexes. The iUsage parameter must be one of the following values. Value Meaning 
    DIB_PAL_COLORS The array contains 16-bit indexes into the logical palette of the source device context. 
    DIB_RGB_COLORS The color table contains literal RGB values.  
    For more information, see the following Res section. dwRop 
    Specifies how the source pixels, the destination device context's current brush, and the destination pixels are to be combined to form the new image. For more information, see the following Res section.