几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】how to save preview in new file (http://www.dimcax.com/hust/showthread.php?t=16765)

yang686526 2009-05-06 03:12 PM

【转帖】how to save preview in new file
 
how to save preview in new file?
how to save preview in new file?
hi everyone,
i want to save preview in new file and i already have it in my application. in the "old days" we used to call adaddbmpfrombuffer(ad_db_handle handle,void *buffer,unsigned short size) to do that.
should i call oddbdatabase::setthumbnailbitmap(const void* pbmpdata, oduint32 ndatalength) to do the same thing? i tried it but the program crashes.
should pbmpdata be in the same format as it is in odt? what is the meaning of ndatalength?
thanks.

crash is caused by dd bug. fix will be available in next release. i can e-mail the fix to clients having source code.
pbmpdata should point to bitmapinfoheader structure followed by other dib stuff. unlike odt there parameter points to bitmapfileheader.
nlength is the length of data.
sample code:
// if preview bitmap is already available it can be specified to avoid wasting
// time on generating it by dd
const odchar* pbmpfilename = "preview.bmp";
if(: dsystemservices()->accessfile(pbmpfilename, oda::kfileread))
{
odrdfilebuf bmpfile(pbmpfilename);
odarray<oduint8> buf;
buf.resize(bmpfile.length());
oduint8 * pdata = buf.asarrayptr();
bmpfile.getbytes(pdata, buf.length());
// get length taking care about big-endian
oduint32 length = pdata[2] + (pdata[3] << 8);
pdata += 14; // skip bitmapfileheader
pdb->setthumbnailbitmap(pdata, length);
}
sergey slezkin

is this bug fixed in 1.07 beta? my program crash on this operation too.
best regards,
ivan obraztsov

dd 1.07 does not contain the fix.
sergey slezkin


所有的时间均为北京时间。 现在的时间是 09:21 AM.