svg vectorizing, textfills
svg vectorizing, textfills
now that i have successfully implemented the usage of text fill (dimtfill and dimtfillclr), i'm having some difficulties vectorizing the output to svg. the default implementation works as expected, but i have the need to be able to vectorize the drawing while changing the colors.
in odsvgdevice::setcurrtraits, i implemented a simple case statement, to determine if i should muck with the current color or not.
i do this, so i can convert from a "colored" autocad drawing to a black on white, white on black, color on black, or color on white output svg.
i know i could of also changed out the color pallets, but for the "simple" cases defined above, it seemed more logical to implement it within setcurrtraits.
now the issue i am having is, svg doesn't natively support a background color, so internally i create a rect that is 2 x the size of the viewport, and then i center it upon the viewport. this works, but then when i wish to vectorize a dimension with a back color set to background, it becomes a bit obscure.
i want to "muck" with the color used in the rendering of the rect for the text background, but i need to be able to distinguish it from other solids. initially, i looked at drawcontext()->effectivetraits(), and was looking at the filltype, but that is eliminating the arrow heads as well.
is there a means of determining what entity we are vectorizing at the device (odsvgdevice) level?
is there any way to determine if we are drawing the fill color of the text entity, verses the arrow head of a dimension?
i'm thinking if it is possible, it will be related to the odgiconveyorcontext from drawcontext(), i just can't seem to find out where to go with it.
appreciate all of the help thus far, and i hope someone can give me an idea where to go on this.
last edited by
jacob.hoover@greenheck.com; 28th september 2007 at 02:41 pmfff">.
odgiconveyorcontext::currentdrawable returns current obejct being vectorized.
vladimir
i'm still not able to determine the proper color at this point, mainly due to the fact that at the point i am changing colors the geometry is broken down to it's primitives.
at this point, i'm considering using pen sets. i am wondering if their are any licensing issues i should be aware of? as well, is there a particular method of the system/host services that i can override so i can load the file from a custom storage location?
you should not add this "background" rectangle to dwg, add it to svg instead (like it is done in svg export actually, see svg::rootnode())
what are "pen sets"?
vladimir
pen sets being the ctb files. so in particular i would be looking at the grayscale and monochrome ctb's
i am not adding the background in cad, and i am creating a rect in the svg root node.
specifically, i'm looking for a means to render a dimension with a text fill color set to background. the initial problem is that svg doesn't "natively" support a background color, so when rendering the blocks are coming out differently than the artificial background color i imposed.
*ps* sorry for the lack of autocad terminology, but i have limited experience with cad.
last edited by
jacob.hoover@greenheck.com; 9th october 2007 at 02:49 pmfff">.
i've made it a bit further... but i am still stuck...
so far, i have added the plot setting validator and plot style service module/app loaded. from that, i can create a file pointing to a ctb file, and then i call odgicontextfordbdatabase::loadplotstyletable .
what would the next step be to tell the app to use this style in the rendering process?
you may look at svgexportcommand::execute() in exports\svgexport\source\svgexport.cpp
where od2dexportloadplotstyletable() is called. look inside the call to see details.
vladimir
i'm still spinning my wheels here..
is there a restriction on vectorizing model space to svg that it will not use plot styles?
code:
oddbblocktablerecordptr playoutblock = _pdb->getactivelayoutbtrid().safeopenobject();
oddblayoutptr playout = playoutblock->getlayoutid().safeopenobject(oddb::kforwrite);
playout->setplotplotstyles(true);
_asserte(playout->plotplotstyles());
playout->setshowplotstyles(true);
_asserte(playout->showplotstyles());
odstreambufptr pfilebuf;
odstring sfilename = _t("c:\\monochrome.ctb");
odstring sstylename = _t("monochrome.ctb");
_services.accessfile(sfilename, oda::kfileread); // sfilename is the ctb file
pfilebuf = _services.createfile(sfilename);
odpsplotstyleservicesptr ppss = odrxdynamiclinker()->loadapp(odps_plotstyle_services_appname);
odpsplotstyletableptr pmyplotstyle = ppss->loadplotstyletable(pfilebuf);
oddbplotsettingsvalidatorptr pplotsettings = this->_services.plotsettingsvalidator();
odresult res = pplotsettings->setcurrentstylesheet(playout, sstylename );
odgicontextfordbdatabaseptr pdwgcontext = odgicontextfordbdatabase::createobject();
pdwgcontext->setdatabase( _pdb );
// do not render paper
pdwgcontext->setplotgeneration( true );
pdwgcontext->loadplotstyletable(pfilebuf);//
...
odgslayouthelperptr phelper = oddbgsmanager::setupactivelayoutviews( dev, pdwgcontext );
...
phelper->onsize(screenrect);
// initiate rendering.
phelper->update( 0 );