几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】polygonout and background color (http://www.dimcax.com/hust/showthread.php?t=17934)

yang686526 2009-05-06 10:12 PM

【转帖】polygonout and background color
 
polygonout and background color
polygonout and background color
i've implemented polygonout. in some cases it is the purpose of the entity (wipeout, mtext w/background rectangle, etc) is to fill using the background color. this colour depends on device settings (white, black, grey, etc.)
is there something i can do to detect inside polygonout that the current fill is intended to be done with the bg color?

may be something like this will be helpful:
code:
bool isbackgroundcolor = false;
odcmentitycolor color = drawcontext()->effectivetraits().truecolor();
// odcmentitycolor color = drawcontext()->subentitytraits().truecolor();
if (color.isbyaci())
{
isbackgroundcolor = (color.colorindex() == 0);
}
else
{
odcolorref bgcolor = drawcontext()->gsview()->device()->getbackgroundcolor();
isbackgroundcolor = (odgetred(bgcolor) == color.red() && odgetgreen(bgcolor) == color.green() && odgetblue(bgcolor) == color.blue());
}
if (isbackgroundcolor)
{
// @@@ do something
thanks! that seems to be something i can use. (the safest would of cause be a query that could confirm that the current colour is intended to be background. there is after all a "foreground" colour.)
one thing; where is it documented that color.colorindex() == 0 means bacground when drawing to a device? according to the documentation is means "byblock". ("byblock" is irrelevant when you are filling a polygon on a device, but anyhow...)

hi,
typically background color has 0 index only in logical vectorization device pallete. effectivetraits() returns color, in which already substituted block and layer color, so aci == 0 color is invalid situation.
in your case you can convert aci color to true color using odcmentitycolor::lookuprgb() function and compare with background color.


所有的时间均为北京时间。 现在的时间是 12:14 PM.