Hi,
I'm trying to retrieve the preview of a view using the function AcDbViewTableRecord::getThumbnail. I get a BITMAPINFO object and I'm trying to create a HBITMAP from it :
BITMAPINFO * pBitmapInfo = NULL; if((es = pRecord->getThumbnail(pBitmapInfo)) == Acad::eOk) { void * pBuffer = NULL; HBITMAP hBitmap; if((hBitmap = CreateDIBSection(NULL, pBitmapInfo, DIB_RGB_COLORS, &pBuffer, NULL, 0)) != NULL) { ... } delete pBitmapInfo; }
The problem is that the result is an image of 128x85 pixels all black.Maybe it's more a problem using Windows methods? Does anybody have an example?
Best regards,
Jonathan
You know, it's much easier in .NET - could you consider that?
Hi,
Thank you for your suggestion, but I use only C++. I've finally found a solution : it's possible to loop on bmiColors array of the BITMAPINFO to retrieve the pixels values. I use Qt Framework, and with the code below I was able to create my QImage :
QImage image(pBitmapInfo->bmiHeader.biWidth, pBitmapInfo->bmiHeader.biHeight, QImage::Format_ARGB32_Premultiplied); for(int i=0; i<pBitmapInfo->bmiHeader.biWidth * pBitmapInfo->bmiHeader.biHeight; ++i) { image.setPixel(i % pBitmapInfo->bmiHeader.biWidth, i / pBitmapInfo->bmiHeader.biWidth, qRgb(pBitmapInfo->bmiColors[i].rgbRed, pBitmapInfo->bmiColors[i].rgbGreen, pBitmapInfo->bmiColors[i].rgbBlue)); }
Maybe it's not the best solution, so I keep this topic unresolved.
Regards,
Jonathan