交换黑白复选框

Swap black and white chec box

我需要在 forge viewer 中设置黑白切换功能,以便用户能够将 2D 文档可视化切换为黑色或白色背景。

当我在js代码中设置这个功能时,只有黑白层交换。背景保持白色。

有人可以帮忙吗?

这应该适用于 AutoCAD 二维绘图,根据 documentation:

setSwapBlackAndWhite(value)

AutoCAD drawings are commonly displayed with white lines on a black background. Setting reverse swaps (just) these two colors.

代码应如下所示:

viewer.setSwapBlackAndWhite(true)  // background black
viewer.setSwapBlackAndWhite(false) // background white

要设置 'surrounding' 背景的颜色,请尝试使用此...

viewer.setBackgroundColor(0,0,0,0,0,0);

如果您想要 'gradient' 背景,例如,顶部为蓝色,底部为红色,试试这个...

viewer.setBackgroundColor(0,0,255,255,0,0);

因此,规范如下所示:

viewer.setBackgroundColor(colorTopRed,colorTopGreen,colorTopBlue, colorBottomRed, colorBottomGreen, colorBottomBlue);

单击 here 查看完整规格。