![]() |
【转帖】how save thumbnail bitmap
how save thumbnail bitmap
how save thumbnail bitmap hello! what i have to do to generate and save preview image to dwg file. i set the forth parameter in writefile to true, but thumbnail didn抰 appear. [code] m_db->writefile(&filebuffer, nfiletype, m_nversion, true, m_ndxfdecprec); </pre><hr></blockquote> or i have to generate image myself and set it by method setthumbnailbitmap first? best regards, ivan obraztsov to save preview to file you need to specify corresponding parameter in writefile. but it's not enough. if you want to reuse "old" preview from original file: oddbdatabaseptr pdb = hostappservices->createdatabase(false); pdb->setretainoriginalbitmap(true); // to load original bitmap while loading file pdatabase->readfile(pfilebuff, bpartial); or use oddbgetpreviewbitmap(odstreambuf* pfilebuff, odthumbnailimage* ppreview) to get preview from file. oddbdatabase::setthumbnailbitmap(const void* pbmpdata, oduint32 ndatalength) to set preview. if you want to save preview in new file. if you have it already in your application you can use oddbdatabase::setthumbnailbitmap(const void* pbmpdata, oduint32 ndatalength) dd can generate preview itself (time consuming operation) but it needs bitmap device implementation. your oddbsystemservices inheritor must override oddbsystemservices::gsbitmapdevice() function returning a device to be used for preview generating. see odamfcapp sample. its gsbitmapdevice() returns pointer to bitmap device implementation. exsystemservices::gsbitmapdevice() returns null and preview is not generated. the size of bitmap preview generated by dd can be specified by oddbhostappservices::setpreview_width() and oddbhostappservices::setpreview_height() default is (180 x 85) [ june 11, 2003: message edited by: sergey slezkin ]</p> sergey slezkin this is interesting. i have my own graphics library for taking a dc and putting it into a rgb buffer and then into a bmp buffer. can i use this with this system you mentioned. also, you mention about getting a thumbnail from a file, well i had this code for the legacy viewkit: code: char *pszbuffer = null; unsigned short unumbytes; unumbytes = adbmpsizefromfile((char*)lpszfilename); pszbuffer = (char *)malloc(unumbytes); if(pszbuffer == null) return false; adextractbmpfromfiletobuffer((char *)lpszfilename, pszbuffer, &unumbytes); bool bresult = true; if (!m_dib.readfrombuffer(pszbuffer, unumbytes)) bresult = false; so how can i convert this segment of code into using the new dwgdirect toolkit? thanks. andrew truckle oddbgetpreviewbitmap() usage is illustrated in odamfcapp. see cpreviewdib class. sergey slezkin i have had a look at the file dialogue class and will use it (the dll). but can you tell me if it supports palettes and thus will show a bitmap ok on a 256 pc. |
所有的时间均为北京时间。 现在的时间是 02:55 AM. |