ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to retrieve a view thumbnail (AcDbViewTableRecord::getThumbnail)?

2 REPLIES 2
Reply
Message 1 of 3
maisoui
415 Views, 2 Replies

How to retrieve a view thumbnail (AcDbViewTableRecord::getThumbnail)?

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

--
Jonathan
2 REPLIES 2
Message 2 of 3
fenton.webb
in reply to: maisoui

You know, it's much easier in .NET - could you consider that?




Fenton Webb
AutoCAD Engineering
Autodesk

Message 3 of 3
maisoui
in reply to: fenton.webb

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

 

--
Jonathan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost