请问我在内存设备环境中生成的位图对象怎样转化成DIB对象,并以BMP或JPG格式储存.

解决方案 »

  1.   

    GetDIBits
    The GetDIBits function retrieves the bits of the specified compatible bitmap and copies them into a buffer as a DIB using the specified format. int GetDIBits(
      HDC hdc,           // handle to DC
      HBITMAP hbmp,      // handle to bitmap
      UINT uStartScan,   // first scan line to set
      UINT cScanLines,   // number of scan lines to copy
      LPVOID lpvBits,    // array for bitmap bits
      LPBITMAPINFO lpbi, // bitmap data buffer
      UINT uUsage        // RGB or palette index
    );
    保存为BMP就直接添加BITMAPFILEHEADER
    保存为JPG就要用GDI+和JPEGLib等