查看单个帖子
旧 2009-05-06, 10:12 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)