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

yang686526 2009-05-05 11:06 AM

【转帖】foreground color with plotstyle files
 
foreground color with plotstyle files
foreground color with plotstyle files
hello,
in my app i try to display files using ctb mapping. everything is ok (lineweights and colors) until element's color is similar to background color.
elements with the same color as background aren't visible.
in e.g. while using "monochrome" plotstyle drawing isn't visible on black background.
i use following code in overwritten method ontraitsmodified():
code:
exgsgdivectorizedevice* pdevice = device();
(...)
const odpsplotstyledata& plotstyle = effectiveplotstyle();
pdevice->draw_color(plotstyle.color());
is there anything more to set or to do to make it work? or is it a problem on dwgdirect library side?
thanks in advance

i think it is a problem on dwgdirect side. i'll look to it. thank you for indication.
however, you can work-around this problem by comparing plotstyle.color() with pdevice->getcolor(0) (background color) in your ontraitsmodified implementation.
sincerely yours,
george udov
quote:
originally posted by george udov
i think it is a problem on dwgdirect side. i'll look to it. thank you for indication.
however, you can work-around this problem by comparing plotstyle.color() with pdevice->getcolor(0) (background color) in your ontraitsmodified implementation.
hi,
i managed the problem in modelspace by swaping colors, but i could not get rid of this with paperspace.
please let me know, if the problem is solved.
best regards.
savip

what is problem with paper space?
pdevice->getcolor(0) returns background color.
if plotstyle.color() is same with this color - take some actions.
sincerely yours,
george udov
quote:
originally posted by george udov
what is problem with paper space?
i make following action:
code:
exgsgdivectorizedevice* pdevice = device();
(...)
const odpsplotstyledata& plotstyle = effectiveplotstyle();
odcmentitycolor color;
color = plotstyle.color();
odcolorref clr = odrgb(color.red(),
color.green(),
color.blue());
if(pdevice->getcolor(0) == clr)
{
//swaping colors for black or white background
if(clr == odrgb(0,0,0))
color.setrgb(255,255,255);
else if(clr == odrgb(255,255,255))
color.setrgb(0,0,0);
}
pdevice->draw_color(color);
for modelspace it works fine, entities with the same color as background are being changed, but for paperspace whole paper color is being changed. in result, for "monochrome.ctb" style on black background i get white paper with white entities.
how can i get paper color to compare it with background?
best regards
savip

please try this temporary hack:
code:
// temporary hack, should be removed when dd 1.14 or higher will be used
const odgisubentitytraitsdata& enttraits = effectivetraits();
odcmentitycolor color;
color = plotstyle.color();

odcolorref clr = odrgb(color.red(),
color.green(),
color.blue());

if((pdevice->getcolor(0) == clr) && enttraits.truecolor().isbyaci())
{
//swaping colors for black or white background
if(clr == odrgb(0,0,0))
color.setrgb(255,255,255);
else if(clr == odrgb(255,255,255))
color.setrgb(0,0,0);
}
pdevice->draw_color(color);
hope it helps.
sincerely yours,
george udov

thanks , it works
savip


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