高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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
|