Menu

How to convert BITMAPINFO to FIBITMAP?

Help
2016-06-13
2016-07-20
  • Sander Bouwhuis

    Sander Bouwhuis - 2016-06-13

    I get a BITMAPINFO from a Twain source and would like to get a FIBITMAP.

    How can I convert the BITMAPINFO?

     
  • Sander Bouwhuis

    Sander Bouwhuis - 2016-07-20

    I found the solution, I needed to globally lock the memory:

    // ...
    
    // Transfer the image
    if(pDsmEntryFunc(&m_twIdentityApp, &m_twIdentityDS, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &hDib) == TWRC_XFERDONE)
    {
      BITMAPINFO *pBitmapInfo;
    
      // Get the image data
      pBitmapInfo = (BITMAPINFO *)GlobalLock(hDib);
    
      // Store the image
      if(!(bResult = pPic->CreatePictureFromBitmapInfo(pBitmapInfo)))
        OutputDebugMessage(m_pWstrDebugLog, L"CTwain (line %i) : FAILED -> pPic->CreatePictureFromBitmapInfo(pBitmapInfo)\n", __LINE__);
    
      // Free the resources
      GlobalUnlock(hDib);
    }
    else
      OutputDebugMessage(m_pWstrDebugLog, L"TWAIN : DAT_IMAGENATIVEXFER != TWRC_XFERDONE\n");
    
    // ...
    
     

    Last edit: Sander Bouwhuis 2016-07-20

Log in to post a comment.