![]() |
【转帖】error in export to bmp
error in export to bmp
error in export to bmp i'm trying to export a dwg a bmp but he only managed to get a file with the black screen. he looked the example cmd_bmpout.cpp although neither he managed to find the option to run from odamfcappdll. quote: bool dwgdocument::savebmp() const { odstring spmpt; odgsmoduleptr pgs = :drxdynamiclinker()->loadmodule(l"winopengl_2.05_8.gs", false); odgsdeviceptr pdevice = pgs->createbitmapdevice(); oddbdatabaseptr pdb(pdbdocument_); odgicontextfordbdatabaseptr pctx = odgicontextfordbdatabase::createobject(); pctx->setdatabase(pdb); pdevice = oddbgsmanager::setupactivelayoutviews(pdevice, pctx); //pdevice = oddbgsmanager::setupactivelayoutviews(pdevice, pctx); //odabstractviewpeptr pdeviceview; //odgsviewptr pdv; //odrxobjectptr playoutview; //if (!pdbdocument_->gettilemode()) //{ // paper space // pdv = odgspaperlayouthelperptr(pdevice)->overallview(); // pdeviceview = pdv; // oddblayoutptr playout = pdbdocument_->currentlayoutid().safeopenobject(); // oddbobjectid overallvpid = playout->overallvportid(); // oddbviewportptr pactivevp = overallvpid.safeopenobject(); // playoutview = pactivevp; //} //else //{ // model space // pdv = odgsmodellayouthelperptr(pdevice)->activeview(); // pdeviceview = pdv; // oddbviewporttableptr pvpt = pdbdocument_->getviewporttableid().safeopenobject(); // oddbviewporttablerecordptr pactivevp = pvpt->getactiveviewportid().safeopenobject(); // playoutview = pactivevp; //} //// get extents from current layout //odgeboundblock3d bbox; //odabstractviewpeptr playoutviewpe(playoutview); //playoutviewpe->viewextents(playoutview, bbox); //pdeviceview->zoomextents(pdv, &bbox); int ncolorbits = 32; pdevice->properties()->putat("bitperpixel", odrxvariantvalue(oduint32(ncolorbits))); pdevice->setbackgroundcolor(odrgb(173,174,173)); // acad's color for paper bg, "device background" odcolorref bg = odrgb(255,255,255); // palette background pctx->setpalettebackground(bg); const odcolorref* palette = odcmacadpalette(bg); odgspalette ppalcpy; ppalcpy.insert(ppalcpy.begin(), palette, palette+256); ppalcpy[0] = bg; pdevice->setlogicalpalette(ppalcpy.asarrayptr(), 256); int xsize = 2000; int ysize = 2000; odgsdcrect gsrect(0, xsize, ysize, 0 ); pdevice->onsize(gsrect); pctx->setplotgeneration( 1); //if(pctx->isplotgeneration()) // pdevice->setbackgroundcolor(bg); //else pdevice->setbackgroundcolor(odrgb(255,255,255)); // acad's color for paper bg, "device background" pdevice->update(); savebitmap( odgirasterimageptr(pdevice->properties()->getat("rasterimage")), "d:\prueba.bmp" ); return true; } thx carlos calvo i changed the module "winopengl_2.05_8.gs" by that other "wingdi_2.05_8.gs" and now if i generated correctly. "bmp" why can this be? in the example application odamfcappdll is the same... thx carlos calvo not all devices support 32 bit per pixel bmp format. you get an exception from properties()->putat() ? btw: sources for gs devices are available and you step into putat() in debugger. sergey slezkin |
所有的时间均为北京时间。 现在的时间是 01:57 AM. |